Files
brave-core/browser/ui/brave_browser_command_controller.h
T
Mario Sanchez Prada bbf5fd3fe9 Remove deprecated DISALLOW_ macros from Brave-specific code
Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

This CL is created semi-mechanically with remove_disallow and
remove_base_macros [4].

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types
[4]: https://pkg.go.dev/go.timothygu.me/tools/cr/cmd

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/d002a3bee7ae75780b604d17df19291a3dd303fb

commit d002a3bee7ae75780b604d17df19291a3dd303fb
Author: Peter Boström <pbos@chromium.org>
Date:   Fri Nov 5 17:17:19 2021 +0000

    Remove DISALLOW_ macros from base/macros.h

    This removes DISALLOW_COPY(), DISALLOW_ASSIGN() and
    DISALLOW_COPY_AND_ASSIGN() from base/macros.h. PRESUBMITs are also
    updated to no longer check for these macros.

    IWYU removal is left as a separate change just in case this needs to be
    reverted.

    Bug: 1010217
2022-01-24 15:33:37 -05:00

86 lines
2.9 KiB
C++

/* Copyright 2019 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_BROWSER_UI_BRAVE_BROWSER_COMMAND_CONTROLLER_H_
#define BRAVE_BROWSER_UI_BRAVE_BROWSER_COMMAND_CONTROLLER_H_
#include "brave/components/brave_vpn/buildflags/buildflags.h"
#include "brave/components/ipfs/buildflags/buildflags.h"
#include "brave/components/tor/buildflags/buildflags.h"
#include "chrome/browser/ui/browser_command_controller.h"
#if BUILDFLAG(ENABLE_IPFS)
#include "components/prefs/pref_change_registrar.h"
#endif
#if BUILDFLAG(ENABLE_BRAVE_VPN)
#include "brave/components/brave_vpn/brave_vpn_service_observer.h"
#endif
class BraveAppMenuBrowserTest;
class BraveBrowserCommandControllerTest;
// This namespace is needed for a chromium_src override
namespace chrome {
class BraveBrowserCommandController : public chrome::BrowserCommandController
#if BUILDFLAG(ENABLE_BRAVE_VPN)
,
public BraveVPNServiceObserver
#endif
{
public:
explicit BraveBrowserCommandController(Browser* browser);
BraveBrowserCommandController(const BraveBrowserCommandController&) = delete;
BraveBrowserCommandController& operator=(
const BraveBrowserCommandController&) = delete;
~BraveBrowserCommandController() override;
#if BUILDFLAG(ENABLE_TOR)
void UpdateCommandForTor();
#endif
private:
friend class ::BraveAppMenuBrowserTest;
friend class ::BraveBrowserCommandControllerTest;
// Overriden from CommandUpdater:
bool SupportsCommand(int id) const override;
bool IsCommandEnabled(int id) const override;
bool ExecuteCommandWithDisposition(
int id,
WindowOpenDisposition disposition,
base::TimeTicks time_stamp = base::TimeTicks::Now()) override;
void AddCommandObserver(int id, CommandObserver* observer) override;
void RemoveCommandObserver(int id, CommandObserver* observer) override;
void RemoveCommandObserver(CommandObserver* observer) override;
bool UpdateCommandEnabled(int id, bool state) override;
#if BUILDFLAG(ENABLE_BRAVE_VPN)
// BraveVPNServiceObserver overrides:
void OnPurchasedStateChanged(brave_vpn::mojom::PurchasedState state) override;
#endif
void InitBraveCommandState();
void UpdateCommandForBraveRewards();
void UpdateCommandForBraveAdblock();
void UpdateCommandForWebcompatReporter();
void UpdateCommandForBraveSync();
void UpdateCommandForBraveWallet();
void UpdateCommandForSidebar();
void UpdateCommandForBraveVPN();
bool ExecuteBraveCommandWithDisposition(int id,
WindowOpenDisposition disposition,
base::TimeTicks time_stamp);
Browser* const browser_;
CommandUpdaterImpl brave_command_updater_;
};
} // namespace chrome
#endif // BRAVE_BROWSER_UI_BRAVE_BROWSER_COMMAND_CONTROLLER_H_