Skip to content

Commit

Permalink
Remove DISALLOW_* macros from ash/
Browse files Browse the repository at this point in the history
This inlines all remaining DISALLOW_* macros in ash/. This is done
manually (vim regex + manually finding insertion position).

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: If5a71f565daa8ad7cc84f1a8acf2be8c9aa18d4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3176289
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#924608}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed Sep 24, 2021
1 parent 0d1e384 commit 5fc1d31
Show file tree
Hide file tree
Showing 194 changed files with 859 additions and 490 deletions.
5 changes: 3 additions & 2 deletions ash/accelerators/accelerator_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2627,6 +2627,9 @@ class FakeMagnificationManager {
public:
FakeMagnificationManager() = default;

FakeMagnificationManager(const FakeMagnificationManager&) = delete;
FakeMagnificationManager& operator=(const FakeMagnificationManager&) = delete;

void SetPrefs(PrefService* prefs) {
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
pref_change_registrar_->Init(prefs);
Expand All @@ -2645,8 +2648,6 @@ class FakeMagnificationManager {
private:
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
PrefService* prefs_;

DISALLOW_COPY_AND_ASSIGN(FakeMagnificationManager);
};

TEST_F(MagnifiersAcceleratorsTester, TestToggleFullscreenMagnifier) {
Expand Down
6 changes: 3 additions & 3 deletions ash/accelerators/accelerator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class AcceleratorTest : public AshTestBase, public OverviewObserver {
public:
AcceleratorTest() : is_in_overview_mode_(false) {}

AcceleratorTest(const AcceleratorTest&) = delete;
AcceleratorTest& operator=(const AcceleratorTest&) = delete;

void SetUp() override {
ui_controls::InstallUIControlsAura(test::CreateAshUIControls());

Expand Down Expand Up @@ -98,9 +101,6 @@ class AcceleratorTest : public AshTestBase, public OverviewObserver {

protected:
bool is_in_overview_mode_;

private:
DISALLOW_COPY_AND_ASSIGN(AcceleratorTest);
};

////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions ash/accelerators/exit_warning_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
SetLayoutManager(std::make_unique<views::FillLayout>());
}

ExitWarningWidgetDelegateView(const ExitWarningWidgetDelegateView&) = delete;
ExitWarningWidgetDelegateView& operator=(
const ExitWarningWidgetDelegateView&) = delete;

void OnPaint(gfx::Canvas* canvas) override {
cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style);
Expand All @@ -82,8 +86,6 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
std::u16string text_;
std::u16string accessible_name_;
int text_width_;

DISALLOW_COPY_AND_ASSIGN(ExitWarningWidgetDelegateView);
};

} // namespace
Expand Down
7 changes: 5 additions & 2 deletions ash/accessibility/accessibility_controller_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ class ASH_EXPORT AccessibilityControllerImpl : public AccessibilityController,
};

AccessibilityControllerImpl();

AccessibilityControllerImpl(const AccessibilityControllerImpl&) = delete;
AccessibilityControllerImpl& operator=(const AccessibilityControllerImpl&) =
delete;

~AccessibilityControllerImpl() override;

// See Shell::RegisterProfilePrefs().
Expand Down Expand Up @@ -579,8 +584,6 @@ class ASH_EXPORT AccessibilityControllerImpl : public AccessibilityController,
base::WeakPtr<AccessibilityConfirmationDialog> confirmation_dialog_;

base::WeakPtrFactory<AccessibilityControllerImpl> weak_ptr_factory_{this};

DISALLOW_COPY_AND_ASSIGN(AccessibilityControllerImpl);
};

} // namespace ash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class TouchExplorationControllerTestApi {
touch_exploration_controller_.reset(touch_exploration_controller);
}

TouchExplorationControllerTestApi(const TouchExplorationControllerTestApi&) =
delete;
TouchExplorationControllerTestApi& operator=(
const TouchExplorationControllerTestApi&) = delete;

void CallTapTimerNowForTesting() {
DCHECK(touch_exploration_controller_->tap_timer_.IsRunning());
touch_exploration_controller_->tap_timer_.Stop();
Expand Down Expand Up @@ -157,8 +162,6 @@ class TouchExplorationControllerTestApi {

private:
std::unique_ptr<TouchExplorationController> touch_exploration_controller_;

DISALLOW_COPY_AND_ASSIGN(TouchExplorationControllerTestApi);
};

class TouchExplorationTest : public aura::test::AuraTestBase {
Expand Down
6 changes: 4 additions & 2 deletions ash/accessibility/sticky_keys/sticky_keys_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
namespace ash {

class StickyKeysTest : public AshTestBase {
public:
StickyKeysTest(const StickyKeysTest&) = delete;
StickyKeysTest& operator=(const StickyKeysTest&) = delete;

protected:
StickyKeysTest() : target_(NULL), root_window_(NULL) {}

Expand Down Expand Up @@ -163,8 +167,6 @@ class StickyKeysTest : public AshTestBase {
aura::Window* target_;
// The root window of |target_|. Not owned.
aura::Window* root_window_;

DISALLOW_COPY_AND_ASSIGN(StickyKeysTest);
};

TEST_F(StickyKeysTest, BasicOneshotScenarioTest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
namespace ash {

class PointScanControllerTest : public AshTestBase {
public:
PointScanControllerTest(const PointScanControllerTest&) = delete;
PointScanControllerTest& operator=(const PointScanControllerTest&) = delete;

protected:
PointScanControllerTest() = default;
~PointScanControllerTest() override = default;
Expand Down Expand Up @@ -117,8 +121,6 @@ class PointScanControllerTest : public AshTestBase {
int diff_count_ = 0;
int row_diff_count_ = 0;
int col_diff_count_ = 0;

DISALLOW_COPY_AND_ASSIGN(PointScanControllerTest);
};

TEST_F(PointScanControllerTest, StartScanning) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ class MockTextInputClient : public ui::DummyTextInputClient {
} // namespace

class AccessibilityHighlightControllerTest : public AshTestBase {
public:
AccessibilityHighlightControllerTest(
const AccessibilityHighlightControllerTest&) = delete;
AccessibilityHighlightControllerTest& operator=(
const AccessibilityHighlightControllerTest&) = delete;

protected:
AccessibilityHighlightControllerTest() = default;
~AccessibilityHighlightControllerTest() override = default;
Expand Down Expand Up @@ -130,8 +136,6 @@ class AccessibilityHighlightControllerTest : public AshTestBase {
gfx::Image after_;
int diff_count_ = 0;
SkColor average_diff_color_ = SK_ColorTRANSPARENT;

DISALLOW_COPY_AND_ASSIGN(AccessibilityHighlightControllerTest);
};

TEST_F(AccessibilityHighlightControllerTest, TestCaretRingDrawsBluePixels) {
Expand Down
5 changes: 3 additions & 2 deletions ash/app_list/folder_image_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class TestFolderImageObserver : public FolderImageObserver {
public:
TestFolderImageObserver() : updated_flag_(false) {}

TestFolderImageObserver(const TestFolderImageObserver&) = delete;
TestFolderImageObserver& operator=(const TestFolderImageObserver&) = delete;

bool updated() const { return updated_flag_; }

void Reset() { updated_flag_ = false; }
Expand All @@ -50,8 +53,6 @@ class TestFolderImageObserver : public FolderImageObserver {

private:
bool updated_flag_;

DISALLOW_COPY_AND_ASSIGN(TestFolderImageObserver);
};

} // namespace
Expand Down
5 changes: 3 additions & 2 deletions ash/app_list/model/app_list_test_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class AppListTestModel : public AppListModel {

AppListTestModel();

AppListTestModel(const AppListTestModel&) = delete;
AppListTestModel& operator=(const AppListTestModel&) = delete;

// Raw pointer version convenience versions of AppListModel methods.
AppListItem* AddItem(AppListItem* item);
AppListItem* AddItemToFolder(AppListItem* item, const std::string& folder_id);
Expand Down Expand Up @@ -87,8 +90,6 @@ class AppListTestModel : public AppListModel {
int activate_count_ = 0;
AppListItem* last_activated_ = nullptr;
int naming_index_ = 0;

DISALLOW_COPY_AND_ASSIGN(AppListTestModel);
};

} // namespace test
Expand Down
6 changes: 4 additions & 2 deletions ash/app_list/views/app_list_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ class ASH_EXPORT AppListView : public views::WidgetDelegateView,

// Does not take ownership of |delegate|.
explicit AppListView(AppListViewDelegate* delegate);

AppListView(const AppListView&) = delete;
AppListView& operator=(const AppListView&) = delete;

~AppListView() override;

// Prevents handling input events for the |window| in context of handling in
Expand Down Expand Up @@ -653,8 +657,6 @@ class ASH_EXPORT AppListView : public views::WidgetDelegateView,
// detects that `SetState()` got called again (in which case the weak ptr will
// be invalidated).
base::WeakPtrFactory<AppListView> set_state_weak_factory_{this};

DISALLOW_COPY_AND_ASSIGN(AppListView);
};

} // namespace ash
Expand Down
18 changes: 10 additions & 8 deletions ash/app_list/views/assistant/assistant_page_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ class GestureEventForTest : public ui::GestureEvent {
base::TimeTicks(),
details) {}

private:
DISALLOW_COPY_AND_ASSIGN(GestureEventForTest);
GestureEventForTest(const GestureEventForTest&) = delete;
GestureEventForTest& operator=(const GestureEventForTest&) = delete;
};

// Base class for tests of the embedded assistant page in:
Expand All @@ -175,6 +175,9 @@ class AssistantPageViewTest : public AssistantAshTestBase {
public:
AssistantPageViewTest() = default;

AssistantPageViewTest(const AssistantPageViewTest&) = delete;
AssistantPageViewTest& operator=(const AssistantPageViewTest&) = delete;

void ShowAssistantUiInTextMode() {
ShowAssistantUi(AssistantEntryPoint::kUnspecified);
EXPECT_TRUE(IsVisible());
Expand Down Expand Up @@ -207,9 +210,6 @@ class AssistantPageViewTest : public AssistantAshTestBase {
SetNumberOfSessionsWhereOnboardingShown(
assistant::ui::kOnboardingMaxSessionsShown);
}

private:
DISALLOW_COPY_AND_ASSIGN(AssistantPageViewTest);
};

// Tests for the legacy non-bubble app list ("peeking launcher").
Expand Down Expand Up @@ -993,6 +993,11 @@ class AssistantPageViewTabletModeTest : public AssistantPageViewTest {
public:
AssistantPageViewTabletModeTest() = default;

AssistantPageViewTabletModeTest(const AssistantPageViewTabletModeTest&) =
delete;
AssistantPageViewTabletModeTest& operator=(
const AssistantPageViewTabletModeTest&) = delete;

void SetUp() override {
AssistantPageViewTest::SetUp();
SetTabletMode(true);
Expand Down Expand Up @@ -1030,9 +1035,6 @@ class AssistantPageViewTabletModeTest : public AssistantPageViewTest {
gfx::Point GetPointInside(const views::View* view) {
return view->GetBoundsInScreen().CenterPoint();
}

private:
DISALLOW_COPY_AND_ASSIGN(AssistantPageViewTabletModeTest);
};

TEST_F(AssistantPageViewTabletModeTest,
Expand Down
6 changes: 4 additions & 2 deletions ash/app_list/views/contents_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class ASH_EXPORT ContentsView : public views::View,
};

explicit ContentsView(AppListView* app_list_view);

ContentsView(const ContentsView&) = delete;
ContentsView& operator=(const ContentsView&) = delete;

~ContentsView() override;

// Initialize the pages of the launcher. Should be called after
Expand Down Expand Up @@ -304,8 +308,6 @@ class ASH_EXPORT ContentsView : public views::View,
// to a new app list view state.
absl::optional<AppListState> target_page_for_last_view_state_update_;
absl::optional<AppListViewState> last_target_view_state_;

DISALLOW_COPY_AND_ASSIGN(ContentsView);
};

} // namespace ash
Expand Down
6 changes: 4 additions & 2 deletions ash/app_list/views/result_selection_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class TestResultViewWithActions : public TestResultView,
set_actions_view(actions_view_owned_.get());
}

TestResultViewWithActions(const TestResultViewWithActions&) = delete;
TestResultViewWithActions& operator=(const TestResultViewWithActions&) =
delete;

// TestResultView:
TestResultViewWithActions* AsResultViewWithActions() override { return this; }

Expand All @@ -65,8 +69,6 @@ class TestResultViewWithActions : public TestResultView,

private:
std::unique_ptr<SearchResultActionsView> actions_view_owned_;

DISALLOW_COPY_AND_ASSIGN(TestResultViewWithActions);
};

// Allows immediate invocation of |VerticalTestContainer| and its derivatives,
Expand Down
5 changes: 3 additions & 2 deletions ash/app_list/views/search_result_base_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class ASH_EXPORT SearchResultBaseView : public views::Button,
public:
SearchResultBaseView();

SearchResultBaseView(const SearchResultBaseView&) = delete;
SearchResultBaseView& operator=(const SearchResultBaseView&) = delete;

// Set whether the result is selected. It updates the background highlight,
// and selects the result action associated with the result if
// SearchBoxSelection feature is enabled.
Expand Down Expand Up @@ -128,8 +131,6 @@ class ASH_EXPORT SearchResultBaseView : public views::Button,
// activated by user by pressing ENTER key.
bool is_default_result_ = false;
SearchResult* result_ = nullptr; // Owned by SearchModel::SearchResults.

DISALLOW_COPY_AND_ASSIGN(SearchResultBaseView);
};

} // namespace ash
Expand Down
5 changes: 3 additions & 2 deletions ash/app_menu/notification_menu_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ class TestAppMenuModelAdapter : public AppMenuModelAdapter {
base::OnceClosure(),
false /* is_tablet_mode */) {}

TestAppMenuModelAdapter(const TestAppMenuModelAdapter&) = delete;
TestAppMenuModelAdapter& operator=(const TestAppMenuModelAdapter&) = delete;

private:
// AppMenuModelAdapter overrides:
void RecordHistogramOnMenuClosed() override {}

DISALLOW_COPY_AND_ASSIGN(TestAppMenuModelAdapter);
};

} // namespace
Expand Down
8 changes: 5 additions & 3 deletions ash/assistant/assistant_alarm_timer_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ class AssistantAlarmTimerControllerTest : public AssistantAshTestBase {
: AssistantAshTestBase(
base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}

AssistantAlarmTimerControllerTest(const AssistantAlarmTimerControllerTest&) =
delete;
AssistantAlarmTimerControllerTest& operator=(
const AssistantAlarmTimerControllerTest&) = delete;

~AssistantAlarmTimerControllerTest() override = default;

// AshTestBase:
Expand Down Expand Up @@ -370,9 +375,6 @@ class AssistantAlarmTimerControllerTest : public AssistantAshTestBase {
AssistantAlarmTimerController* controller() {
return AssistantAlarmTimerController::Get();
}

private:
DISALLOW_COPY_AND_ASSIGN(AssistantAlarmTimerControllerTest);
};

// Tests -----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ class AssistantServiceMock : public TestAssistantService {
// AssistantNotificationControllerTest -----------------------------------------

class AssistantNotificationControllerTest : public AshTestBase {
public:
AssistantNotificationControllerTest(
const AssistantNotificationControllerTest&) = delete;
AssistantNotificationControllerTest& operator=(
const AssistantNotificationControllerTest&) = delete;

protected:
AssistantNotificationControllerTest()
: AshTestBase(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
Expand Down Expand Up @@ -238,8 +244,6 @@ class AssistantNotificationControllerTest : public AshTestBase {
private:
AssistantNotificationControllerImpl* controller_;
std::unique_ptr<AssistantNotificationModelObserverMock> observer_;

DISALLOW_COPY_AND_ASSIGN(AssistantNotificationControllerTest);
};

} // namespace
Expand Down
Loading

0 comments on commit 5fc1d31

Please sign in to comment.