Commit bcd20a2a authored by Jongmok Kim's avatar Jongmok Kim Committed by Commit Bot

[tabs] Inline DISALLOW_COPY_AND_ASSIGN in c/b/u/tabs

Uses explicit deletion instead, removes use of base/macros.h.

Bug: 1010217
Change-Id: Id7efbf60060e975843f53dc363763f369195f488
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2326515
Commit-Queue: Connie Wan <connily@chromium.org>
Reviewed-by: default avatarConnie Wan <connily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794580}
parent adf21fee
......@@ -7,7 +7,6 @@
#include <stddef.h>
#include "base/macros.h"
#include "chrome/browser/ui/tabs/existing_base_sub_menu_model.h"
class TabStripModel;
......@@ -21,6 +20,9 @@ class ExistingTabGroupSubMenuModel : public ExistingBaseSubMenuModel {
ExistingTabGroupSubMenuModel(ui::SimpleMenuModel::Delegate* parent_delegate,
TabStripModel* model,
int context_index);
ExistingTabGroupSubMenuModel(const ExistingTabGroupSubMenuModel&) = delete;
ExistingTabGroupSubMenuModel& operator=(const ExistingTabGroupSubMenuModel&) =
delete;
~ExistingTabGroupSubMenuModel() override = default;
// Whether the submenu should be shown in the provided context. True iff
......@@ -44,8 +46,6 @@ class ExistingTabGroupSubMenuModel : public ExistingBaseSubMenuModel {
static bool ShouldShowGroup(TabStripModel* model,
int context_index,
tab_groups::TabGroupId group);
DISALLOW_COPY_AND_ASSIGN(ExistingTabGroupSubMenuModel);
};
#endif // CHROME_BROWSER_UI_TABS_EXISTING_TAB_GROUP_SUB_MENU_MODEL_H_
......@@ -18,6 +18,9 @@ class ExistingWindowSubMenuModel : public ExistingBaseSubMenuModel {
ExistingWindowSubMenuModel(ui::SimpleMenuModel::Delegate* parent_delegate,
TabStripModel* model,
int context_index);
ExistingWindowSubMenuModel(const ExistingWindowSubMenuModel&) = delete;
ExistingWindowSubMenuModel& operator=(const ExistingWindowSubMenuModel&) =
delete;
~ExistingWindowSubMenuModel() override;
// ui::SimpleMenuModel
......@@ -37,8 +40,6 @@ class ExistingWindowSubMenuModel : public ExistingBaseSubMenuModel {
// ExistingBaseSubMenuModel
void ExecuteNewCommand(int event_flags) override;
void ExecuteExistingCommand(int command_index) override;
DISALLOW_COPY_AND_ASSIGN(ExistingWindowSubMenuModel);
};
#endif // CHROME_BROWSER_UI_TABS_EXISTING_WINDOW_SUB_MENU_MODEL_H_
......@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_TABS_HOVER_TAB_SELECTOR_H_
#define CHROME_BROWSER_UI_TABS_HOVER_TAB_SELECTOR_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
class TabStripModel;
......@@ -15,6 +14,8 @@ class TabStripModel;
class HoverTabSelector {
public:
explicit HoverTabSelector(TabStripModel* tab_strip_model);
HoverTabSelector(const HoverTabSelector&) = delete;
HoverTabSelector& operator=(const HoverTabSelector&) = delete;
~HoverTabSelector();
// Begin a delayed tab transition to the tab at |index|. Only starts
......@@ -38,8 +39,6 @@ class HoverTabSelector {
// Factory for creating tab transition tasks.
base::WeakPtrFactory<HoverTabSelector> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(HoverTabSelector);
};
#endif // CHROME_BROWSER_UI_TABS_HOVER_TAB_SELECTOR_H_
......
......@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
......@@ -26,6 +25,8 @@ class PinnedTabService : public content::NotificationObserver,
public KeyedService {
public:
explicit PinnedTabService(Profile* profile);
PinnedTabService(const PinnedTabService&) = delete;
PinnedTabService& operator=(const PinnedTabService&) = delete;
~PinnedTabService() override;
private:
......@@ -57,8 +58,6 @@ class PinnedTabService : public content::NotificationObserver,
bool need_to_write_pinned_tabs_ = true;
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(PinnedTabService);
};
#endif // CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_
......@@ -27,6 +27,8 @@ class BrowserRemovalWaiter : public BrowserListObserver {
explicit BrowserRemovalWaiter(const Browser* browser) : browser_(browser) {
BrowserList::AddObserver(this);
}
BrowserRemovalWaiter(const BrowserRemovalWaiter&) = delete;
BrowserRemovalWaiter& operator=(const BrowserRemovalWaiter&) = delete;
~BrowserRemovalWaiter() override = default;
void WaitForRemoval() {
......@@ -47,8 +49,6 @@ class BrowserRemovalWaiter : public BrowserListObserver {
const Browser* const browser_;
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
DISALLOW_COPY_AND_ASSIGN(BrowserRemovalWaiter);
};
using PinnedTabServiceBrowserTest = InProcessBrowserTest;
......
......@@ -9,7 +9,6 @@
#include <vector>
#include "base/bind.h"
#include "base/macros.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tabs/pinned_tab_codec.h"
......@@ -36,6 +35,8 @@ PinnedTabService* BuildForProfile(Profile* profile) {
class PinnedTabServiceTest : public BrowserWithTestWindowTest {
public:
PinnedTabServiceTest() : pinned_tab_service_(nullptr) {}
PinnedTabServiceTest(const PinnedTabServiceTest&) = delete;
PinnedTabServiceTest& operator=(const PinnedTabServiceTest&) = delete;
protected:
TestingProfile* CreateProfile() override {
......@@ -46,8 +47,6 @@ class PinnedTabServiceTest : public BrowserWithTestWindowTest {
private:
PinnedTabService* pinned_tab_service_;
DISALLOW_COPY_AND_ASSIGN(PinnedTabServiceTest);
};
// Makes sure closing a popup triggers writing pinned tabs.
......
......@@ -18,12 +18,11 @@ class TabActivitySimulator::TestWebContentsObserver
: public content::WebContentsObserver {
public:
explicit TestWebContentsObserver(content::WebContents* web_contents);
TestWebContentsObserver(const TestWebContentsObserver&) = delete;
TestWebContentsObserver& operator=(const TestWebContentsObserver&) = delete;
// content::WebContentsObserver:
void WebContentsDestroyed() override;
private:
DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver);
};
TabActivitySimulator::TestWebContentsObserver::TestWebContentsObserver(
......
......@@ -8,7 +8,6 @@
#include <memory>
#include <vector>
#include "base/macros.h"
#include "ui/base/page_transition_types.h"
class GURL;
......@@ -26,6 +25,8 @@ class TabActivitySimulator {
class TestWebContentsObserver;
TabActivitySimulator();
TabActivitySimulator(const TabActivitySimulator&) = delete;
TabActivitySimulator& operator=(const TabActivitySimulator&) = delete;
~TabActivitySimulator();
// Simulates a navigation to |url| using the given transition type.
......@@ -53,8 +54,6 @@ class TabActivitySimulator {
private:
// Owns the observers we've created.
std::vector<std::unique_ptr<TestWebContentsObserver>> observers_;
DISALLOW_COPY_AND_ASSIGN(TabActivitySimulator);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_ACTIVITY_SIMULATOR_H_
......@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_TABS_TAB_MENU_MODEL_H_
#define CHROME_BROWSER_UI_TABS_TAB_MENU_MODEL_H_
#include "base/macros.h"
#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_sub_menu_model.h"
#include "ui/base/models/simple_menu_model.h"
......@@ -25,6 +24,8 @@ class TabMenuModel : public ui::SimpleMenuModel {
TabMenuModel(ui::SimpleMenuModel::Delegate* delegate,
TabStripModel* tab_strip,
int index);
TabMenuModel(const TabMenuModel&) = delete;
TabMenuModel& operator=(const TabMenuModel&) = delete;
~TabMenuModel() override;
private:
......@@ -36,8 +37,6 @@ class TabMenuModel : public ui::SimpleMenuModel {
// Send tab to self submenu.
std::unique_ptr<send_tab_to_self::SendTabToSelfSubMenuModel>
send_tab_to_self_sub_menu_model_;
DISALLOW_COPY_AND_ASSIGN(TabMenuModel);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_MENU_MODEL_H_
......@@ -11,7 +11,6 @@
#include "base/auto_reset.h"
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/numerics/ranges.h"
......@@ -123,6 +122,11 @@ class RenderWidgetHostVisibilityTracker
"TabSwitchVisibilityRequest", this);
}
RenderWidgetHostVisibilityTracker(const RenderWidgetHostVisibilityTracker&) =
delete;
RenderWidgetHostVisibilityTracker& operator=(
const RenderWidgetHostVisibilityTracker&) = delete;
~RenderWidgetHostVisibilityTracker() override {
if (host_)
host_->RemoveObserver(this);
......@@ -150,8 +154,6 @@ class RenderWidgetHostVisibilityTracker
content::RenderWidgetHost* host_ = nullptr;
base::ElapsedTimer timer_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostVisibilityTracker);
};
} // namespace
......@@ -164,6 +166,8 @@ class RenderWidgetHostVisibilityTracker
class TabStripModel::WebContentsData : public content::WebContentsObserver {
public:
explicit WebContentsData(std::unique_ptr<WebContents> a_contents);
WebContentsData(const WebContentsData&) = delete;
WebContentsData& operator=(const WebContentsData&) = delete;
// Changes the WebContents that this WebContentsData tracks.
std::unique_ptr<WebContents> ReplaceWebContents(
......@@ -225,8 +229,6 @@ class TabStripModel::WebContentsData : public content::WebContentsObserver {
// - The exact shape of the group-related changes to the TabStripModel API
// (and the relevant bits of the extension API) are TBD.
base::Optional<tab_groups::TabGroupId> group_ = base::nullopt;
DISALLOW_COPY_AND_ASSIGN(WebContentsData);
};
TabStripModel::WebContentsData::WebContentsData(
......@@ -257,6 +259,8 @@ struct TabStripModel::DetachedWebContents {
: contents(std::move(contents)),
index_before_any_removals(index_before_any_removals),
index_at_time_of_removal(index_at_time_of_removal) {}
DetachedWebContents(const DetachedWebContents&) = delete;
DetachedWebContents& operator=(const DetachedWebContents&) = delete;
~DetachedWebContents() = default;
DetachedWebContents(DetachedWebContents&&) = default;
......@@ -271,9 +275,6 @@ struct TabStripModel::DetachedWebContents {
// tabs are being simultaneously removed, the index reflects previously
// removed tabs in this batch.
const int index_at_time_of_removal;
private:
DISALLOW_COPY_AND_ASSIGN(DetachedWebContents);
};
// Holds all state necessary to send notifications for detached tabs. Will
......@@ -285,6 +286,8 @@ struct TabStripModel::DetachNotifications {
: initially_active_web_contents(initially_active_web_contents),
selection_model(selection_model),
will_delete(will_delete) {}
DetachNotifications(const DetachNotifications&) = delete;
DetachNotifications& operator=(const DetachNotifications&) = delete;
~DetachNotifications() = default;
// The WebContents that was active prior to any detaches happening.
......@@ -305,9 +308,6 @@ struct TabStripModel::DetachNotifications {
// Whether to delete the WebContents after sending notifications.
const bool will_delete;
private:
DISALLOW_COPY_AND_ASSIGN(DetachNotifications);
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -8,7 +8,6 @@
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/optional.h"
#include "components/tab_groups/tab_group_id.h"
......@@ -67,15 +66,14 @@ class TabStripModelDelegate {
// TabStripModelDelegate, or perhaps even move this code elsewhere.
struct NewStripContents {
NewStripContents();
NewStripContents(const NewStripContents&) = delete;
NewStripContents& operator=(const NewStripContents&) = delete;
~NewStripContents();
NewStripContents(NewStripContents&&);
// The WebContents to add.
std::unique_ptr<content::WebContents> web_contents;
// A bitmask of TabStripModel::AddTabTypes to apply to the added contents.
int add_types = 0;
private:
DISALLOW_COPY_AND_ASSIGN(NewStripContents);
};
virtual Browser* CreateNewStripWithContents(
std::vector<NewStripContents> contentses,
......
......@@ -8,7 +8,6 @@
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_change_type.h"
#include "components/tab_groups/tab_group_id.h"
......@@ -141,6 +140,8 @@ class TabStripModelChange {
explicit TabStripModelChange(Remove delta);
explicit TabStripModelChange(Replace delta);
explicit TabStripModelChange(Move delta);
TabStripModelChange(const TabStripModelChange&) = delete;
TabStripModelChange& operator=(const TabStripModelChange&) = delete;
~TabStripModelChange();
Type type() const { return type_; }
......@@ -154,8 +155,6 @@ class TabStripModelChange {
const Type type_ = kSelectionOnly;
std::unique_ptr<Delta> delta_;
DISALLOW_COPY_AND_ASSIGN(TabStripModelChange);
};
// Struct to carry changes on selection/activation.
......@@ -243,6 +242,9 @@ class TabStripModelObserver {
kCloseAllCompleted = 1,
};
TabStripModelObserver(const TabStripModelObserver&) = delete;
TabStripModelObserver& operator=(const TabStripModelObserver&) = delete;
// |change| is a series of changes in tabstrip model. |change| consists
// of changes with same type and those changes may have caused selection or
// activation changes. |selection| is determined by comparing the state of
......@@ -337,8 +339,6 @@ class TabStripModelObserver {
private:
std::set<TabStripModel*> observed_models_;
DISALLOW_COPY_AND_ASSIGN(TabStripModelObserver);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_
......@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
#define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
#include "base/macros.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "ui/base/page_transition_types.h"
......@@ -20,6 +19,9 @@ class TabStripModel;
class TabStripModelOrderController : public TabStripModelObserver {
public:
explicit TabStripModelOrderController(TabStripModel* model);
TabStripModelOrderController(const TabStripModelOrderController&) = delete;
TabStripModelOrderController& operator=(const TabStripModelOrderController&) =
delete;
~TabStripModelOrderController() override;
// Determine where to place a newly opened tab by using the supplied
......@@ -43,8 +45,6 @@ class TabStripModelOrderController : public TabStripModelObserver {
int GetValidIndex(int index, int removing_index) const;
TabStripModel* model_;
DISALLOW_COPY_AND_ASSIGN(TabStripModelOrderController);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
......@@ -7,7 +7,6 @@
#include <vector>
#include "base/macros.h"
#include "chrome/browser/ui/browser_tab_strip_tracker.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
......@@ -45,6 +44,9 @@ class TabStripModelStatsRecorder : public TabStripModelObserver {
};
TabStripModelStatsRecorder();
TabStripModelStatsRecorder(const TabStripModelStatsRecorder&) = delete;
TabStripModelStatsRecorder& operator=(const TabStripModelStatsRecorder&) =
delete;
~TabStripModelStatsRecorder() override;
private:
......@@ -67,8 +69,6 @@ class TabStripModelStatsRecorder : public TabStripModelObserver {
std::vector<content::WebContents*> active_tab_history_;
BrowserTabStripTracker browser_tab_strip_tracker_;
DISALLOW_COPY_AND_ASSIGN(TabStripModelStatsRecorder);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_STATS_RECORDER_H_
......@@ -59,6 +59,9 @@ class TabStripModelTestIDUserData : public base::SupportsUserData::Data {
class MockTabStripModelObserver : public TabStripModelObserver {
public:
MockTabStripModelObserver() = default;
MockTabStripModelObserver(const MockTabStripModelObserver&) = delete;
MockTabStripModelObserver& operator=(const MockTabStripModelObserver&) =
delete;
~MockTabStripModelObserver() override = default;
enum TabStripModelObserverAction {
......@@ -330,8 +333,6 @@ class MockTabStripModelObserver : public TabStripModelObserver {
private:
std::vector<State> states_;
std::map<tab_groups::TabGroupId, TabGroupUpdate> group_updates_;
DISALLOW_COPY_AND_ASSIGN(MockTabStripModelObserver);
};
const char* const MockTabStripModelObserver::State::kActionNames[]{
......
......@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_TABS_TAB_STYLE_H_
#define CHROME_BROWSER_UI_TABS_TAB_STYLE_H_
#include "base/macros.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/insets.h"
......@@ -79,6 +78,8 @@ class TabStyle {
SkColor background_color;
};
TabStyle(const TabStyle&) = delete;
TabStyle& operator=(const TabStyle&) = delete;
virtual ~TabStyle();
// Gets the specific |path_type| associated with the specific |tab|.
......@@ -156,9 +157,6 @@ class TabStyle {
// Returns how far from the leading and trailing edges of a tab the contents
// should actually be laid out.
static int GetContentsHorizontalInsetSize();
private:
DISALLOW_COPY_AND_ASSIGN(TabStyle);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_STYLE_H_
......@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_TABS_TAB_SWITCH_EVENT_LATENCY_RECORDER_H_
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/time/time.h"
......@@ -18,6 +17,9 @@ class TabSwitchEventLatencyRecorder {
enum class EventType { kMouse, kKeyboard, kTouch, kWheel, kOther };
TabSwitchEventLatencyRecorder();
TabSwitchEventLatencyRecorder(const TabSwitchEventLatencyRecorder&) = delete;
TabSwitchEventLatencyRecorder& operator=(
const TabSwitchEventLatencyRecorder&) = delete;
// Starts timing the tab switch input event latency. If this is called again
// without a following OnWillChangeActiveTab, this will overwrite the
......@@ -37,8 +39,6 @@ class TabSwitchEventLatencyRecorder {
private:
base::TimeTicks input_event_timestamp_ = base::TimeTicks();
base::Optional<EventType> event_type_ = base::nullopt;
DISALLOW_COPY_AND_ASSIGN(TabSwitchEventLatencyRecorder);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_SWITCH_EVENT_LATENCY_RECORDER_H_
......@@ -7,7 +7,6 @@
#include <map>
#include "base/macros.h"
#include "base/optional.h"
#include "components/ukm/test_ukm_recorder.h"
......@@ -27,6 +26,8 @@ using SourceUkmMetricMap =
class UkmEntryChecker {
public:
UkmEntryChecker();
UkmEntryChecker(const UkmEntryChecker&) = delete;
UkmEntryChecker& operator=(const UkmEntryChecker&) = delete;
~UkmEntryChecker();
// Expects that the next untested entry for |entry_name| matches the value
......@@ -72,8 +73,6 @@ class UkmEntryChecker {
// |num_entries_| records the number of entries that have been expected via
// calls to ExpectNewEntries() or similar.
std::map<std::string, size_t> num_entries_;
DISALLOW_COPY_AND_ASSIGN(UkmEntryChecker);
};
#endif // CHROME_BROWSER_UI_TABS_TAB_UKM_TEST_HELPER_H_
......@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "components/tab_groups/tab_group_id.h"
......@@ -19,6 +18,9 @@ class WebContents;
class TestTabStripModelDelegate : public TabStripModelDelegate {
public:
TestTabStripModelDelegate();
TestTabStripModelDelegate(const TestTabStripModelDelegate&) = delete;
TestTabStripModelDelegate& operator=(const TestTabStripModelDelegate&) =
delete;
~TestTabStripModelDelegate() override;
// Overridden from TabStripModelDelegate:
......@@ -44,9 +46,6 @@ class TestTabStripModelDelegate : public TabStripModelDelegate {
content::WebContents* contents) override;
bool RunUnloadListenerBeforeClosing(content::WebContents* contents) override;
bool ShouldDisplayFavicon(content::WebContents* web_contents) const override;
private:
DISALLOW_COPY_AND_ASSIGN(TestTabStripModelDelegate);
};
#endif // CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment