Skip to content

Commit 840177e

Browse files
author
James Cook
committed
chromeos: Rename ash::WmShelf to Shelf
The "Wm" porting layer is being removed, so it can go back to its original name. No behavior changes, just a mechanical refactor. tools/git/move_source_file.py for wm_shelf.h to shelf.h wm_shelf.cc to shelf.cc wm_shelf_observer.h to shelf_observer.h tools/git/mffr.py for WmShelfObserver to ShelfObserver WmShelf to Shelf wm_shelf to shelf Fix up a couple call sites like "wm_shelf_container" window. Replace deprecated GetAlignment() with alignment() because it touches the same lines as the rest of this change. BUG=none TEST=compiles, ash_unittests, chrome unit_tests R=msw@chromium.org, tsepez@chromium.org TBR=reveman@chromium.org, xiyuan@chromium.org Review-Url: https://codereview.chromium.org/2899253002 . Cr-Commit-Position: refs/heads/master@{#474526}
1 parent d4d3003 commit 840177e

File tree

154 files changed

+768
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+768
-798
lines changed

ash/BUILD.gn

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ component("ash") {
284284
"shelf/overflow_bubble_view.h",
285285
"shelf/overflow_button.cc",
286286
"shelf/overflow_button.h",
287+
"shelf/shelf.cc",
288+
"shelf/shelf.h",
287289
"shelf/shelf_alignment_menu.cc",
288290
"shelf/shelf_alignment_menu.h",
289291
"shelf/shelf_application_menu_model.cc",
@@ -308,6 +310,7 @@ component("ash") {
308310
"shelf/shelf_model.cc",
309311
"shelf/shelf_model.h",
310312
"shelf/shelf_model_observer.h",
313+
"shelf/shelf_observer.h",
311314
"shelf/shelf_tooltip_manager.cc",
312315
"shelf/shelf_tooltip_manager.h",
313316
"shelf/shelf_view.cc",
@@ -320,9 +323,6 @@ component("ash") {
320323
"shelf/shelf_window_watcher.h",
321324
"shelf/shelf_window_watcher_item_delegate.cc",
322325
"shelf/shelf_window_watcher_item_delegate.h",
323-
"shelf/wm_shelf.cc",
324-
"shelf/wm_shelf.h",
325-
"shelf/wm_shelf_observer.h",
326326
"shell.cc",
327327
"shell.h",
328328
"shell_delegate.h",

ash/accelerators/accelerator_controller.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "ash/root_window_controller.h"
2121
#include "ash/rotator/window_rotation.h"
2222
#include "ash/session/session_controller.h"
23+
#include "ash/shelf/shelf.h"
2324
#include "ash/shelf/shelf_widget.h"
24-
#include "ash/shelf/wm_shelf.h"
2525
#include "ash/shell.h"
2626
#include "ash/shell_delegate.h"
2727
#include "ash/shell_port.h"
@@ -211,18 +211,18 @@ void HandleRotatePaneFocus(FocusCycler::Direction direction) {
211211
void HandleFocusShelf() {
212212
base::RecordAction(UserMetricsAction("Accel_Focus_Shelf"));
213213
// TODO(jamescook): Should this be GetRootWindowForNewWindows()?
214-
WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow());
214+
Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow());
215215
Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
216216
}
217217

218218
void HandleLaunchAppN(int n) {
219219
base::RecordAction(UserMetricsAction("Accel_Launch_App"));
220-
WmShelf::LaunchShelfItem(n);
220+
Shelf::LaunchShelfItem(n);
221221
}
222222

223223
void HandleLaunchLastApp() {
224224
base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
225-
WmShelf::LaunchShelfItem(-1);
225+
Shelf::LaunchShelfItem(-1);
226226
}
227227

228228
void HandleMediaNextTrack() {
@@ -332,7 +332,7 @@ void HandleShowKeyboardOverlay() {
332332
bool CanHandleShowMessageCenterBubble() {
333333
aura::Window* target_root = Shell::GetRootWindowForNewWindows();
334334
StatusAreaWidget* status_area_widget =
335-
WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
335+
Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
336336
return status_area_widget &&
337337
status_area_widget->web_notification_tray()->visible();
338338
}
@@ -341,7 +341,7 @@ void HandleShowMessageCenterBubble() {
341341
base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble"));
342342
aura::Window* target_root = Shell::GetRootWindowForNewWindows();
343343
StatusAreaWidget* status_area_widget =
344-
WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
344+
Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
345345
if (status_area_widget) {
346346
WebNotificationTray* notification_tray =
347347
status_area_widget->web_notification_tray();
@@ -464,7 +464,7 @@ void HandleShowImeMenuBubble() {
464464
base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
465465

466466
StatusAreaWidget* status_area_widget =
467-
WmShelf::ForWindow(Shell::GetPrimaryRootWindow())->GetStatusAreaWidget();
467+
Shelf::ForWindow(Shell::GetPrimaryRootWindow())->GetStatusAreaWidget();
468468
if (status_area_widget) {
469469
ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray();
470470
if (ime_menu_tray && ime_menu_tray->visible() &&

ash/accelerators/accelerator_controller_delegate_aura.cc

-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919
#include "ash/public/cpp/shell_window_ids.h"
2020
#include "ash/root_window_controller.h"
2121
#include "ash/screenshot_delegate.h"
22-
#include "ash/shelf/wm_shelf.h"
2322
#include "ash/shell.h"
2423
#include "ash/system/system_notifier.h"
2524
#include "ash/touch/touch_hud_debug.h"
2625
#include "ash/utility/screenshot_controller.h"
2726
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
2827
#include "ash/wm/power_button_controller.h"
2928
#include "ash/wm/window_state.h"
30-
3129
#include "ash/wm/wm_event.h"
3230
#include "base/memory/ptr_util.h"
3331
#include "base/metrics/histogram_macros.h"

ash/app_list/app_list_delegate_impl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include "ash/root_window_controller.h"
88
#include "ash/shelf/app_list_button.h"
9+
#include "ash/shelf/shelf.h"
910
#include "ash/shelf/shelf_widget.h"
10-
#include "ash/shelf/wm_shelf.h"
1111
#include "ash/shell.h"
1212
#include "ash/shell_port.h"
1313
#include "ash/wm_window.h"
@@ -28,7 +28,7 @@ void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible,
2828
aura::Window* root_window =
2929
ShellPort::Get()->GetRootWindowForDisplayId(display_id);
3030
AppListButton* app_list_button =
31-
WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
31+
Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
3232
if (!app_list_button)
3333
return;
3434

ash/app_list/app_list_presenter_delegate.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "ash/root_window_controller.h"
1111
#include "ash/screen_util.h"
1212
#include "ash/shelf/app_list_button.h"
13+
#include "ash/shelf/shelf.h"
1314
#include "ash/shelf/shelf_layout_manager.h"
1415
#include "ash/shelf/shelf_widget.h"
15-
#include "ash/shelf/wm_shelf.h"
1616
#include "ash/shell.h"
1717
#include "ash/shell_port.h"
1818
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
@@ -111,7 +111,7 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view,
111111
if (keyboard_controller)
112112
keyboard_controller->AddObserver(this);
113113
Shell::Get()->AddPreTargetHandler(this);
114-
WmShelf* shelf = WmShelf::ForWindow(root_window);
114+
Shelf* shelf = Shelf::ForWindow(root_window);
115115
shelf->AddObserver(this);
116116

117117
// By setting us as DnD recipient, the app list knows that we can
@@ -126,7 +126,7 @@ void AppListPresenterDelegate::OnShown(int64_t display_id) {
126126
aura::Window* root_window =
127127
ShellPort::Get()->GetRootWindowForDisplayId(display_id);
128128
AppListButton* app_list_button =
129-
WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
129+
Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
130130
if (app_list_button)
131131
app_list_button->OnAppListShown();
132132
}
@@ -138,7 +138,7 @@ void AppListPresenterDelegate::OnDismissed() {
138138
is_visible_ = false;
139139

140140
// Update applist button status when app list visibility is changed.
141-
WmShelf* shelf = WmShelf::ForWindow(view_->GetWidget()->GetNativeWindow());
141+
Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow());
142142
AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton();
143143
if (app_list_button)
144144
app_list_button->OnAppListDismissed();
@@ -160,7 +160,7 @@ gfx::Vector2d AppListPresenterDelegate::GetVisibilityAnimationOffset(
160160

161161
// App list needs to know the new shelf layout in order to calculate its
162162
// UI layout when AppListView visibility changes.
163-
WmShelf* shelf = WmShelf::ForWindow(root_window);
163+
Shelf* shelf = Shelf::ForWindow(root_window);
164164
shelf->UpdateAutoHideState();
165165

166166
switch (shelf->alignment()) {
@@ -240,7 +240,7 @@ void AppListPresenterDelegate::OnOverviewModeStarting() {
240240
}
241241

242242
////////////////////////////////////////////////////////////////////////////////
243-
// AppListPresenterDelegate, WmShelfObserver implementation:
243+
// AppListPresenterDelegate, ShelfObserver implementation:
244244

245245
void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
246246
UpdateBounds();

ash/app_list/app_list_presenter_delegate.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <stdint.h>
99

1010
#include "ash/ash_export.h"
11-
#include "ash/shelf/wm_shelf_observer.h"
11+
#include "ash/shelf/shelf_observer.h"
1212
#include "ash/shell_observer.h"
1313
#include "base/macros.h"
1414
#include "ui/app_list/presenter/app_list_presenter_delegate.h"
@@ -37,7 +37,7 @@ class ASH_EXPORT AppListPresenterDelegate
3737
public ui::EventHandler,
3838
public keyboard::KeyboardControllerObserver,
3939
public ShellObserver,
40-
public WmShelfObserver {
40+
public ShelfObserver {
4141
public:
4242
AppListPresenterDelegate(
4343
app_list::AppListPresenterImpl* presenter,
@@ -69,7 +69,7 @@ class ASH_EXPORT AppListPresenterDelegate
6969
// ShellObserver overrides:
7070
void OnOverviewModeStarting() override;
7171

72-
// WmShelfObserver overrides:
72+
// ShelfObserver overrides:
7373
void OnShelfIconPositionsChanged() override;
7474

7575
// Whether the app list is visible (or in the process of being shown).

ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h"
66

77
#include "ash/public/cpp/shelf_types.h"
8-
#include "ash/shelf/wm_shelf.h"
8+
#include "ash/shelf/shelf.h"
99
#include "ash/shell.h"
1010
#include "ash/test/ash_test_base.h"
1111
#include "base/strings/utf_string_conversions.h"

ash/dip_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include <algorithm>
66
#include <vector>
77

8+
#include "ash/shelf/shelf.h"
89
#include "ash/shelf/shelf_widget.h"
9-
#include "ash/shelf/wm_shelf.h"
1010
#include "ash/shell.h"
1111
#include "ash/test/ash_test_base.h"
1212
#include "ash/wm/window_properties.h"
@@ -62,7 +62,7 @@ TEST_F(DIPTest, WorkArea) {
6262

6363
// Sanity check if the workarea's inset hight is same as
6464
// the shelf's height.
65-
WmShelf* shelf = GetPrimaryShelf();
65+
Shelf* shelf = GetPrimaryShelf();
6666
EXPECT_EQ(display_2x.bounds().InsetsFrom(work_area).height(),
6767
shelf->shelf_widget()->GetNativeView()->layer()->bounds().height());
6868
}

ash/display/window_tree_host_manager_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include "ash/display/display_util.h"
1010
#include "ash/screen_util.h"
11+
#include "ash/shelf/shelf.h"
1112
#include "ash/shelf/shelf_widget.h"
12-
#include "ash/shelf/wm_shelf.h"
1313
#include "ash/shell.h"
1414
#include "ash/test/ash_test_base.h"
1515
#include "ash/test/ash_test_helper.h"

ash/first_run/first_run_helper_impl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include "ash/public/cpp/shell_window_ids.h"
88
#include "ash/shelf/app_list_button.h"
9+
#include "ash/shelf/shelf.h"
910
#include "ash/shelf/shelf_widget.h"
10-
#include "ash/shelf/wm_shelf.h"
1111
#include "ash/shell.h"
1212
#include "ash/system/tray/system_tray.h"
1313
#include "ash/wm_window.h"
@@ -55,7 +55,7 @@ views::Widget* FirstRunHelperImpl::GetOverlayWidget() {
5555
}
5656

5757
gfx::Rect FirstRunHelperImpl::GetAppListButtonBounds() {
58-
WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow());
58+
Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow());
5959
AppListButton* app_button = shelf->shelf_widget()->GetAppListButton();
6060
return app_button->GetBoundsInScreen();
6161
}

ash/focus_cycler_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
#include <memory>
88

9+
#include "ash/shelf/shelf.h"
910
#include "ash/shelf/shelf_widget.h"
10-
#include "ash/shelf/wm_shelf.h"
1111
#include "ash/shell.h"
1212
#include "ash/system/status_area_widget.h"
1313
#include "ash/system/status_area_widget_delegate.h"

ash/metrics/user_metrics_recorder.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "ash/public/cpp/shell_window_ids.h"
1111
#include "ash/session/session_controller.h"
1212
#include "ash/session/session_state_delegate.h"
13+
#include "ash/shelf/shelf.h"
1314
#include "ash/shelf/shelf_model.h"
1415
#include "ash/shelf/shelf_view.h"
15-
#include "ash/shelf/wm_shelf.h"
1616
#include "ash/shell.h"
1717
#include "ash/wm/window_state.h"
1818
#include "ash/wm_window.h"
@@ -624,7 +624,7 @@ void UserMetricsRecorder::OnShellShuttingDown() {
624624
}
625625

626626
void UserMetricsRecorder::RecordPeriodicMetrics() {
627-
WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow());
627+
Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow());
628628
// TODO(bruthig): Investigating whether the check for |manager| is necessary
629629
// and add tests if it is.
630630
if (shelf) {

ash/mus/context_menu_mus.cc

+8-10
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
#include "ash/mus/context_menu_mus.h"
66

77
#include "ash/public/cpp/shelf_types.h"
8-
#include "ash/shelf/wm_shelf.h"
8+
#include "ash/shelf/shelf.h"
99
#include "ash/shell.h"
1010
#include "ash/strings/grit/ash_strings.h"
1111
#include "ash/wallpaper/wallpaper_controller.h"
1212
#include "ash/wallpaper/wallpaper_delegate.h"
1313

1414
namespace ash {
1515

16-
ContextMenuMus::ContextMenuMus(WmShelf* wm_shelf)
17-
: ui::SimpleMenuModel(nullptr),
18-
wm_shelf_(wm_shelf),
19-
alignment_menu_(wm_shelf) {
16+
ContextMenuMus::ContextMenuMus(Shelf* shelf)
17+
: ui::SimpleMenuModel(nullptr), shelf_(shelf), alignment_menu_(shelf) {
2018
set_delegate(this);
2119
AddCheckItemWithStringId(MENU_AUTO_HIDE,
2220
IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
@@ -29,7 +27,7 @@ ContextMenuMus::~ContextMenuMus() {}
2927

3028
bool ContextMenuMus::IsCommandIdChecked(int command_id) const {
3129
if (command_id == MENU_AUTO_HIDE)
32-
return wm_shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
30+
return shelf_->auto_hide_behavior() == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
3331
return false;
3432
}
3533

@@ -41,10 +39,10 @@ bool ContextMenuMus::IsCommandIdEnabled(int command_id) const {
4139

4240
void ContextMenuMus::ExecuteCommand(int command_id, int event_flags) {
4341
if (command_id == MENU_AUTO_HIDE) {
44-
wm_shelf_->SetAutoHideBehavior(wm_shelf_->auto_hide_behavior() ==
45-
SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
46-
? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
47-
: SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
42+
shelf_->SetAutoHideBehavior(shelf_->auto_hide_behavior() ==
43+
SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS
44+
? SHELF_AUTO_HIDE_BEHAVIOR_NEVER
45+
: SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
4846
} else if (command_id == MENU_CHANGE_WALLPAPER) {
4947
Shell::Get()->wallpaper_controller()->OpenSetWallpaperPage();
5048
}

ash/mus/context_menu_mus.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
namespace ash {
1313

14-
class WmShelf;
14+
class Shelf;
1515

1616
// Context menu for mash.
1717
// TODO: Mimic logic in LauncherContextMenu. http://crbug.com/640693
1818
class ContextMenuMus : public ui::SimpleMenuModel,
1919
public ui::SimpleMenuModel::Delegate {
2020
public:
21-
explicit ContextMenuMus(WmShelf* wm_shelf);
21+
explicit ContextMenuMus(Shelf* shelf);
2222
~ContextMenuMus() override;
2323

2424
// ui::SimpleMenuModel::Delegate overrides:
@@ -33,7 +33,7 @@ class ContextMenuMus : public ui::SimpleMenuModel,
3333
MENU_CHANGE_WALLPAPER,
3434
};
3535

36-
WmShelf* wm_shelf_;
36+
Shelf* shelf_;
3737
ShelfAlignmentMenu alignment_menu_;
3838

3939
DISALLOW_COPY_AND_ASSIGN(ContextMenuMus);

ash/mus/shell_delegate_mus.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ std::unique_ptr<PaletteDelegate> ShellDelegateMus::CreatePaletteDelegate() {
134134
return nullptr;
135135
}
136136

137-
ui::MenuModel* ShellDelegateMus::CreateContextMenu(WmShelf* wm_shelf,
137+
ui::MenuModel* ShellDelegateMus::CreateContextMenu(Shelf* shelf,
138138
const ShelfItem* item) {
139-
return new ContextMenuMus(wm_shelf);
139+
return new ContextMenuMus(shelf);
140140
}
141141

142142
GPUSupport* ShellDelegateMus::CreateGPUSupport() {

ash/mus/shell_delegate_mus.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ShellDelegateMus : public ShellDelegate {
4040
SessionStateDelegate* CreateSessionStateDelegate() override;
4141
AccessibilityDelegate* CreateAccessibilityDelegate() override;
4242
std::unique_ptr<PaletteDelegate> CreatePaletteDelegate() override;
43-
ui::MenuModel* CreateContextMenu(WmShelf* wm_shelf,
43+
ui::MenuModel* CreateContextMenu(Shelf* shelf,
4444
const ShelfItem* item) override;
4545
GPUSupport* CreateGPUSupport() override;
4646
base::string16 GetProductName() const override;

ash/public/interfaces/shelf.mojom

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface ShelfController {
6161
// Observers are immediately notified of the current shelf states when added.
6262
AddObserver(associated ShelfObserver observer);
6363

64-
// Set the shelf alignment and auto-hide behavior. See WmShelf for details.
64+
// Set the shelf alignment and auto-hide behavior. See Shelf for details.
6565
SetAlignment(ShelfAlignment alignment, int64 display_id);
6666
SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id);
6767

0 commit comments

Comments
 (0)