diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 04:19:38 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 04:19:38 +0000 |
commit | 864b5855c27945ea0f099bf82d44f41a041851ff (patch) | |
tree | 8f3737b10405128113a113f373f4472727f149de /ash | |
parent | 7a22adbf507b6f35788ea89f12bbd2c1b96d451b (diff) | |
download | chromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.zip chromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.tar.gz chromium_src-864b5855c27945ea0f099bf82d44f41a041851ff.tar.bz2 |
Rename Launcher to Shelf.
- move launcher* from launcher to shelf.
- rename to launcher.* to shelf.* and launcher_unittest.cc to
shelf_unittest.cc
- rename LauncherTestAPI to ShelfTestAPI.
- rename to launcher_test_api.* to shelf_test_api.*
BUG=248353
TEST=None, no functional changes
R=jamescook@chromium.org,harrym@chromium.org
TBR=sky
Review URL: https://codereview.chromium.org/115113006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
80 files changed, 742 insertions, 733 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 30271ef..3f0c538 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -19,7 +19,6 @@ #include "ash/display/display_manager.h" #include "ash/focus_cycler.h" #include "ash/ime_control_delegate.h" -#include "ash/launcher/launcher.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" #include "ash/media_delegate.h" @@ -29,6 +28,7 @@ #include "ash/rotator/screen_rotation.h" #include "ash/screenshot_delegate.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_delegate.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_widget.h" @@ -197,18 +197,18 @@ bool HandleFocusLauncher() { Shell* shell = Shell::GetInstance(); content::RecordAction(content::UserMetricsAction("Accel_Focus_Launcher")); return shell->focus_cycler()->FocusWidget( - Launcher::ForPrimaryDisplay()->shelf_widget()); + Shelf::ForPrimaryDisplay()->shelf_widget()); } bool HandleLaunchAppN(int n) { content::RecordAction(UserMetricsAction("Accel_Launch_App")); - Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(n); + Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n); return true; } bool HandleLaunchLastApp() { content::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); - Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(-1); + Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(-1); return true; } diff --git a/ash/ash.gyp b/ash/ash.gyp index 2c4f36e..4d7cde1 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -157,8 +157,6 @@ 'keyboard_overlay/keyboard_overlay_view.h', 'keyboard_uma_event_filter.cc', 'keyboard_uma_event_filter.h', - 'launcher/launcher.cc', - 'launcher/launcher.h', 'launcher/launcher_types.cc', 'launcher/launcher_types.h', 'magnifier/magnification_controller.cc', @@ -203,6 +201,8 @@ 'shelf/overflow_button.cc', 'shelf/overflow_button.h', 'shelf/scoped_observer_with_duplicated_sources.h', + 'shelf/shelf.cc', + 'shelf/shelf.h', 'shelf/shelf_alignment_menu.cc', 'shelf/shelf_alignment_menu.h', 'shelf/shelf_bezel_event_filter.cc', @@ -649,10 +649,10 @@ 'ash_resources', ], 'sources': [ - 'shell/toplevel_window.cc', - 'shell/toplevel_window.h', 'shell/keyboard_controller_proxy_stub.cc', 'shell/keyboard_controller_proxy_stub.h', + 'shell/toplevel_window.cc', + 'shell/toplevel_window.h', 'test/app_list_controller_test_api.cc', 'test/app_list_controller_test_api.h', 'test/ash_test_base.cc', @@ -663,14 +663,14 @@ 'test/cursor_manager_test_api.h', 'test/display_manager_test_api.cc', 'test/display_manager_test_api.h', - 'test/launcher_test_api.cc', - 'test/launcher_test_api.h', 'test/mirror_window_test_api.cc', 'test/mirror_window_test_api.h', 'test/overflow_bubble_view_test_api.cc', 'test/overflow_bubble_view_test_api.h', 'test/shelf_item_delegate_manager_test_api.cc', 'test/shelf_item_delegate_manager_test_api.h', + 'test/shelf_test_api.cc', + 'test/shelf_test_api.h', 'test/shelf_view_test_api.cc', 'test/shelf_view_test_api.h', 'test/shell_test_api.cc', @@ -783,7 +783,6 @@ 'focus_cycler_unittest.cc', 'keyboard_overlay/keyboard_overlay_delegate_unittest.cc', 'keyboard_overlay/keyboard_overlay_view_unittest.cc', - 'launcher/launcher_unittest.cc', 'magnifier/magnification_controller_unittest.cc', 'root_window_controller_unittest.cc', 'screen_ash_unittest.cc', @@ -795,6 +794,7 @@ 'shelf/shelf_model_unittest.cc', 'shelf/shelf_navigator_unittest.cc', 'shelf/shelf_tooltip_manager_unittest.cc', + 'shelf/shelf_unittest.cc', 'shelf/shelf_view_unittest.cc', 'shelf/shelf_widget_unittest.cc', 'shelf/shelf_window_watcher_unittest.cc', diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index a501ad2..92f78bc 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -7,7 +7,7 @@ #include "ash/ash_switches.h" #include "ash/display/display_manager.h" -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" @@ -62,11 +62,11 @@ TEST_F(DIPTest, WorkArea) { EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString()); // Sanity check if the workarea's inset hight is same as - // the launcher's height. - Launcher* launcher = Launcher::ForPrimaryDisplay(); + // the shelf's height. + Shelf* shelf = Shelf::ForPrimaryDisplay(); EXPECT_EQ( display_2x.bounds().InsetsFrom(work_area).height(), - launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); + shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); } TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { @@ -101,11 +101,11 @@ TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); // Sanity check if the workarea's inset hight is same as - // the launcher's height. - Launcher* launcher = Launcher::ForPrimaryDisplay(); + // the shelf's height. + Shelf* shelf = Shelf::ForPrimaryDisplay(); EXPECT_EQ( display_2x.bounds().InsetsFrom(work_area).height(), - launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); + shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); } } // namespace ash diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 35b585f..1d4bb5a5 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -8,8 +8,8 @@ #include "ash/display/display_info.h" #include "ash/display/display_layout_store.h" #include "ash/display/display_manager.h" -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" @@ -31,8 +31,8 @@ #include "ui/views/widget/widget.h" #if defined(USE_X11) -#include "ui/gfx/x/x11_types.h" #include <X11/Xlib.h> +#include "ui/gfx/x/x11_types.h" #undef RootWindow #endif @@ -615,10 +615,10 @@ TEST_F(DisplayControllerTest, SwapPrimary) { aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); EXPECT_NE(primary_root, secondary_root); - aura::Window* launcher_window = - Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + aura::Window* shelf_window = + Shelf::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetDisplayNearestPoint( gfx::Point(-100, -100)).id()); @@ -653,8 +653,8 @@ TEST_F(DisplayControllerTest, SwapPrimary) { EXPECT_EQ( secondary_root, display_controller->GetRootWindowForDisplayId(primary_display.id())); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); // Test if the bounds are correctly swapped. gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay(); @@ -681,7 +681,7 @@ TEST_F(DisplayControllerTest, SwapPrimary) { Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_TRUE(tracker.Contains(primary_root)); EXPECT_FALSE(tracker.Contains(secondary_root)); - EXPECT_TRUE(primary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); } TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { @@ -709,10 +709,10 @@ TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); EXPECT_NE(primary_root, secondary_root); - aura::Window* launcher_window = - Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + aura::Window* shelf_window = + Shelf::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetDisplayNearestPoint( gfx::Point(-100, -100)).id()); @@ -747,8 +747,8 @@ TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { EXPECT_EQ( secondary_root, display_controller->GetRootWindowForDisplayId(primary_display.id())); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); // Test if the bounds are correctly swapped. gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay(); @@ -775,7 +775,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_TRUE(tracker.Contains(primary_root)); EXPECT_FALSE(tracker.Contains(secondary_root)); - EXPECT_TRUE(primary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); } TEST_F(DisplayControllerTest, SwapPrimaryById) { @@ -799,10 +799,10 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { display_controller->GetRootWindowForDisplayId(primary_display.id()); aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); - aura::Window* launcher_window = - Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + aura::Window* shelf_window = + Shelf::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); EXPECT_NE(primary_root, secondary_root); EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetDisplayNearestPoint( @@ -824,8 +824,8 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { EXPECT_EQ( secondary_root, display_controller->GetRootWindowForDisplayId(primary_display.id())); - EXPECT_TRUE(primary_root->Contains(launcher_window)); - EXPECT_FALSE(secondary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); + EXPECT_FALSE(secondary_root->Contains(shelf_window)); const DisplayLayout& inverted_layout = display_manager->GetCurrentDisplayLayout(); @@ -852,7 +852,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_TRUE(tracker.Contains(primary_root)); EXPECT_FALSE(tracker.Contains(secondary_root)); - EXPECT_TRUE(primary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); // Adding 2nd display with the same ID. The 2nd display should become primary // since secondary id is still stored as desirable_primary_id. @@ -873,7 +873,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { EXPECT_NE( primary_root, display_controller->GetRootWindowForDisplayId(primary_display.id())); - EXPECT_TRUE(primary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); // Deleting 2nd display and adding 2nd display with a different ID. The 2nd // display shouldn't become primary. @@ -899,7 +899,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { EXPECT_NE( primary_root, display_controller->GetRootWindowForDisplayId(third_display_info.id())); - EXPECT_TRUE(primary_root->Contains(launcher_window)); + EXPECT_TRUE(primary_root->Contains(shelf_window)); } TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index 7919243..e3b5e85 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc @@ -6,9 +6,9 @@ #include "ash/display/display_info.h" #include "ash/display/display_manager.h" -#include "ash/launcher/launcher.h" #include "ash/magnifier/magnification_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" diff --git a/ash/first_run/first_run_helper_impl.cc b/ash/first_run/first_run_helper_impl.cc index 9efb0db..f8a3ca6 100644 --- a/ash/first_run/first_run_helper_impl.cc +++ b/ash/first_run/first_run_helper_impl.cc @@ -4,7 +4,7 @@ #include "ash/first_run/first_run_helper_impl.h" -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/tray/system_tray.h" @@ -64,13 +64,13 @@ void FirstRunHelperImpl::CloseAppList() { } gfx::Rect FirstRunHelperImpl::GetLauncherBounds() { - ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay(); - return launcher->GetVisibleItemsBoundsInScreen(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + return shelf->GetVisibleItemsBoundsInScreen(); } gfx::Rect FirstRunHelperImpl::GetAppListButtonBounds() { - ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay(); - views::View* app_button = launcher->GetAppListButtonView(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + views::View* app_button = shelf->GetAppListButtonView(); return app_button->GetBoundsInScreen(); } @@ -120,4 +120,3 @@ gfx::Rect FirstRunHelperImpl::GetHelpButtonBounds() { } } // namespace ash - diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc index ed5340e..3bdc451 100644 --- a/ash/focus_cycler_unittest.cc +++ b/ash/focus_cycler_unittest.cc @@ -4,17 +4,17 @@ #include "ash/focus_cycler.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" +#include "ash/shell_factory.h" #include "ash/shell_window_ids.h" #include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget_delegate.h" #include "ash/system/tray/system_tray.h" -#include "ash/wm/window_util.h" #include "ash/test/ash_test_base.h" -#include "ash/shell_factory.h" +#include "ash/wm/window_util.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_windows.h" @@ -74,7 +74,7 @@ class FocusCyclerTest : public AshTestBase { focus_cycler_.reset(new FocusCycler()); - ASSERT_TRUE(Launcher::ForPrimaryDisplay()); + ASSERT_TRUE(Shelf::ForPrimaryDisplay()); } virtual void TearDown() OVERRIDE { @@ -116,7 +116,7 @@ class FocusCyclerTest : public AshTestBase { SystemTray* tray() { return tray_.get(); } ShelfWidget* shelf_widget() { - return Launcher::ForPrimaryDisplay()->shelf_widget(); + return Shelf::ForPrimaryDisplay()->shelf_widget(); } void InstallFocusCycleOnShelf() { diff --git a/ash/launcher/launcher_types.h b/ash/launcher/launcher_types.h index bbb1bbc..9a8b16b 100644 --- a/ash/launcher/launcher_types.h +++ b/ash/launcher/launcher_types.h @@ -91,7 +91,7 @@ enum CycleDirection { }; // LauncherItemDetails may be set on Window (by way of -// SetLauncherItemDetailsForWindow) to make the window appear in the shelf. See +// SetShelfItemDetailsForWindow) to make the window appear in the shelf. See // ShelfWindowWatcher for details. struct ASH_EXPORT LauncherItemDetails { LauncherItemDetails(); diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index b0c384f..fdf1663 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc @@ -361,7 +361,7 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { void UserMetricsRecorder::RecordPeriodicMetrics() { internal::ShelfLayoutManager* manager = - internal::ShelfLayoutManager::ForLauncher(Shell::GetPrimaryRootWindow()); + internal::ShelfLayoutManager::ForShelf(Shell::GetPrimaryRootWindow()); if (manager) { UMA_HISTOGRAM_ENUMERATION("Ash.ShelfAlignmentOverTime", manager->SelectValueForShelfAlignment( diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 58088c7..8332a2a 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -269,7 +269,7 @@ void RootWindowController::CreateForVirtualKeyboardDisplay( } // static -RootWindowController* RootWindowController::ForLauncher(aura::Window* window) { +RootWindowController* RootWindowController::ForShelf(aura::Window* window) { return GetRootWindowController(window->GetRootWindow()); } @@ -374,18 +374,18 @@ const aura::Window* RootWindowController::GetContainer(int container_id) const { return root_window_->window()->GetChildById(container_id); } -void RootWindowController::ShowLauncher() { - if (!shelf_->launcher()) +void RootWindowController::ShowShelf() { + if (!shelf_->shelf()) return; - shelf_->launcher()->SetVisible(true); + shelf_->shelf()->SetVisible(true); shelf_->status_area_widget()->Show(); } -void RootWindowController::OnLauncherCreated() { +void RootWindowController::OnShelfCreated() { if (panel_layout_manager_) - panel_layout_manager_->SetLauncher(shelf_->launcher()); + panel_layout_manager_->SetShelf(shelf_->shelf()); if (docked_layout_manager_) { - docked_layout_manager_->SetLauncher(shelf_->launcher()); + docked_layout_manager_->SetShelf(shelf_->shelf()); if (shelf_->shelf_layout_manager()) docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); } @@ -677,9 +677,9 @@ void RootWindowController::Init(RootWindowType root_window_type, root_window_->window()); root_window_->host()->Show(); - // Create a launcher if a user is already logged in. + // Create a shelf if a user is already logged in. if (shell->session_state_delegate()->NumberOfLoggedInUsers()) - shelf()->CreateLauncher(); + shelf()->CreateShelf(); } solo_window_tracker_.reset(new SoloWindowTracker(root_window_.get())); diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index e71b1ad..3d6f2fd 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -90,11 +90,11 @@ class ASH_EXPORT RootWindowController : public ShellObserver { // keyboard displays. static void CreateForVirtualKeyboardDisplay(aura::RootWindow* root_window); - // Returns a RootWindowController that has a launcher for given + // Returns a RootWindowController that has a shelf for given // |window|. This returns the RootWindowController for the |window|'s - // root window when multiple launcher mode is enabled, or the primary + // root window when multiple shelf mode is enabled, or the primary // RootWindowController otherwise. - static RootWindowController* ForLauncher(aura::Window* window); + static RootWindowController* ForShelf(aura::Window* window); // Returns a RootWindowController of the window's root window. static RootWindowController* ForWindow(const aura::Window* window); @@ -163,7 +163,7 @@ class ASH_EXPORT RootWindowController : public ShellObserver { ShelfLayoutManager* GetShelfLayoutManager(); // Returns the system tray on this root window. Note that - // calling this on the root window that doesn't have a launcher will + // calling this on the root window that doesn't have a shelf will // lead to a crash. SystemTray* GetSystemTray(); @@ -185,11 +185,11 @@ class ASH_EXPORT RootWindowController : public ShellObserver { aura::Window* GetContainer(int container_id); const aura::Window* GetContainer(int container_id) const; - // Show launcher view if it was created hidden (before session has started). - void ShowLauncher(); + // Show shelf view if it was created hidden (before session has started). + void ShowShelf(); - // Called when the launcher associated with this root window is created. - void OnLauncherCreated(); + // Called when the shelf associated with this root window is created. + void OnShelfCreated(); // Called when the login status changes after login (such as lock/unlock). // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. @@ -272,7 +272,7 @@ class ASH_EXPORT RootWindowController : public ShellObserver { scoped_ptr<StackingController> stacking_controller_; - // The shelf for managing the launcher and the status widget. + // The shelf for managing the shelf and the status widget. scoped_ptr<ShelfWidget> shelf_; // An invisible/empty window used as a event target for diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc index 35c885f..05106ec 100644 --- a/ash/shelf/overflow_bubble.cc +++ b/ash/shelf/overflow_bubble.cc @@ -96,8 +96,8 @@ void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { bubble_ = NULL; anchor_ = NULL; shelf_view_ = NULL; - ShelfLayoutManager::ForLauncher( - widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint(); + ShelfLayoutManager::ForShelf( + widget->GetNativeView())->shelf_widget()->shelf()->SchedulePaint(); } } // namespace internal diff --git a/ash/shelf/overflow_bubble_view.cc b/ash/shelf/overflow_bubble_view.cc index 67b483d..d878b08 100644 --- a/ash/shelf/overflow_bubble_view.cc +++ b/ash/shelf/overflow_bubble_view.cc @@ -42,8 +42,8 @@ OverflowBubbleView::~OverflowBubbleView() { void OverflowBubbleView::InitOverflowBubble(views::View* anchor, ShelfView* shelf_view) { - // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher - // can be called. + // set_anchor_view needs to be called before GetShelfLayoutManager() can be + // called. SetAnchorView(anchor); set_arrow(GetBubbleArrow()); set_background(NULL); @@ -69,10 +69,9 @@ void OverflowBubbleView::InitOverflowBubble(views::View* anchor, } bool OverflowBubbleView::IsHorizontalAlignment() const { - ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManagerForLauncher(); - return shelf_layout_manager ? - shelf_layout_manager->IsHorizontalAlignment() : - false; + ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); + return shelf_layout_manager ? shelf_layout_manager->IsHorizontalAlignment() + : false; } const gfx::Size OverflowBubbleView::GetContentsSize() const { @@ -81,7 +80,7 @@ const gfx::Size OverflowBubbleView::GetContentsSize() const { // Gets arrow location based on shelf alignment. views::BubbleBorder::Arrow OverflowBubbleView::GetBubbleArrow() const { - ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManagerForLauncher(); + ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); return shelf_layout_manager ? shelf_layout_manager->SelectValueForShelfAlignment( views::BubbleBorder::BOTTOM_LEFT, @@ -165,12 +164,10 @@ bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) { return true; } -ShelfLayoutManager* -OverflowBubbleView::GetShelfLayoutManagerForLauncher() const { - return GetAnchorView() ? - ShelfLayoutManager::ForLauncher( - GetAnchorView()->GetWidget()->GetNativeView()) : - NULL; +ShelfLayoutManager* OverflowBubbleView::GetShelfLayoutManager() const { + return GetAnchorView() ? ShelfLayoutManager::ForShelf( + GetAnchorView()->GetWidget()->GetNativeView()) + : NULL; } void OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) { diff --git a/ash/shelf/overflow_bubble_view.h b/ash/shelf/overflow_bubble_view.h index f5bfdc1..e8533c1 100644 --- a/ash/shelf/overflow_bubble_view.h +++ b/ash/shelf/overflow_bubble_view.h @@ -55,7 +55,7 @@ class ASH_EXPORT OverflowBubbleView : public views::BubbleDelegateView { // ui::EventHandler overrides: virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const; + ShelfLayoutManager* GetShelfLayoutManager() const; ShelfView* shelf_view_; // Owned by views hierarchy. gfx::Vector2d scroll_offset_; diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc index 66d5476..3c899ef 100644 --- a/ash/shelf/overflow_button.cc +++ b/ash/shelf/overflow_button.cc @@ -57,7 +57,7 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) { gfx::Rect bounds(GetContentsBounds()); gfx::Rect rect(0, 0, kButtonHoverSize, kButtonHoverSize); ShelfLayoutManager* shelf = - ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView()); + ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView()); // Nudge the background a little to line up right. if (shelf->IsHorizontalAlignment()) { @@ -85,15 +85,15 @@ void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) { } void OverflowButton::OnPaint(gfx::Canvas* canvas) { - ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForLauncher( - GetWidget()->GetNativeView()); + ShelfLayoutManager* layout_manager = + ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView()); ShelfAlignment alignment = layout_manager->GetAlignment(); gfx::Rect bounds(GetContentsBounds()); if (ash::switches::UseAlternateShelfLayout()) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); int background_image_id = 0; - if (layout_manager->shelf_widget()->launcher()->IsShowingOverflowBubble()) + if (layout_manager->shelf_widget()->shelf()->IsShowingOverflowBubble()) background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; else if(layout_manager->shelf_widget()->GetDimsShelf()) background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; diff --git a/ash/launcher/launcher.cc b/ash/shelf/shelf.cc index 58926e8..e016875 100644 --- a/ash/launcher/launcher.cc +++ b/ash/shelf/shelf.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include <algorithm> #include <cmath> @@ -40,11 +40,11 @@ namespace ash { -const char Launcher::kNativeViewName[] = "ShelfView"; +const char Shelf::kNativeViewName[] = "ShelfView"; -Launcher::Launcher(ShelfModel* shelf_model, - ShelfDelegate* shelf_delegate, - ShelfWidget* shelf_widget) +Shelf::Shelf(ShelfModel* shelf_model, + ShelfDelegate* shelf_delegate, + ShelfWidget* shelf_widget) : shelf_view_(NULL), alignment_(shelf_widget->GetAlignment()), delegate_(shelf_delegate), @@ -54,34 +54,34 @@ Launcher::Launcher(ShelfModel* shelf_model, shelf_view_->Init(); shelf_widget_->GetContentsView()->AddChildView(shelf_view_); shelf_widget_->GetNativeView()->SetName(kNativeViewName); - delegate_->OnLauncherCreated(this); + delegate_->OnShelfCreated(this); } -Launcher::~Launcher() { - delegate_->OnLauncherDestroyed(this); +Shelf::~Shelf() { + delegate_->OnShelfDestroyed(this); } // static -Launcher* Launcher::ForPrimaryDisplay() { - ShelfWidget* shelf_widget = internal::RootWindowController::ForLauncher( +Shelf* Shelf::ForPrimaryDisplay() { + ShelfWidget* shelf_widget = internal::RootWindowController::ForShelf( Shell::GetPrimaryRootWindow())->shelf(); - return shelf_widget ? shelf_widget->launcher() : NULL; + return shelf_widget ? shelf_widget->shelf() : NULL; } // static -Launcher* Launcher::ForWindow(aura::Window* window) { +Shelf* Shelf::ForWindow(aura::Window* window) { ShelfWidget* shelf_widget = - internal::RootWindowController::ForLauncher(window)->shelf(); - return shelf_widget ? shelf_widget->launcher() : NULL; + internal::RootWindowController::ForShelf(window)->shelf(); + return shelf_widget ? shelf_widget->shelf() : NULL; } -void Launcher::SetAlignment(ShelfAlignment alignment) { +void Shelf::SetAlignment(ShelfAlignment alignment) { alignment_ = alignment; shelf_view_->OnShelfAlignmentChanged(); - // ShelfLayoutManager will resize the launcher. + // ShelfLayoutManager will resize the shelf. } -gfx::Rect Launcher::GetScreenBoundsOfItemIconForWindow(aura::Window* window) { +gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(aura::Window* window) { LauncherID id = GetLauncherIDForWindow(window); gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); gfx::Point screen_origin; @@ -92,15 +92,15 @@ gfx::Rect Launcher::GetScreenBoundsOfItemIconForWindow(aura::Window* window) { bounds.height()); } -void Launcher::UpdateIconPositionForWindow(aura::Window* window) { +void Shelf::UpdateIconPositionForWindow(aura::Window* window) { shelf_view_->UpdatePanelIconPosition( GetLauncherIDForWindow(window), - ash::ScreenAsh::ConvertRectFromScreen( + ScreenAsh::ConvertRectFromScreen( shelf_widget()->GetNativeView(), window->GetBoundsInScreen()).CenterPoint()); } -void Launcher::ActivateLauncherItem(int index) { +void Shelf::ActivateShelfItem(int index) { // We pass in a keyboard event which will then trigger a switch to the // next item if the current one is already active. ui::KeyEvent event(ui::ET_KEY_RELEASED, @@ -115,46 +115,46 @@ void Launcher::ActivateLauncherItem(int index) { item_delegate->ItemSelected(event); } -void Launcher::CycleWindowLinear(CycleDirection direction) { +void Shelf::CycleWindowLinear(CycleDirection direction) { int item_index = GetNextActivatedItemIndex( *(shelf_view_->model()), direction); if (item_index >= 0) - ActivateLauncherItem(item_index); + ActivateShelfItem(item_index); } -void Launcher::AddIconObserver(ShelfIconObserver* observer) { +void Shelf::AddIconObserver(ShelfIconObserver* observer) { shelf_view_->AddIconObserver(observer); } -void Launcher::RemoveIconObserver(ShelfIconObserver* observer) { +void Shelf::RemoveIconObserver(ShelfIconObserver* observer) { shelf_view_->RemoveIconObserver(observer); } -bool Launcher::IsShowingMenu() const { +bool Shelf::IsShowingMenu() const { return shelf_view_->IsShowingMenu(); } -bool Launcher::IsShowingOverflowBubble() const { +bool Shelf::IsShowingOverflowBubble() const { return shelf_view_->IsShowingOverflowBubble(); } -void Launcher::SetVisible(bool visible) const { +void Shelf::SetVisible(bool visible) const { shelf_view_->SetVisible(visible); } -bool Launcher::IsVisible() const { +bool Shelf::IsVisible() const { return shelf_view_->visible(); } -void Launcher::SchedulePaint() { +void Shelf::SchedulePaint() { shelf_view_->SchedulePaintForAllButtons(); } -views::View* Launcher::GetAppListButtonView() const { +views::View* Shelf::GetAppListButtonView() const { return shelf_view_->GetAppListButtonView(); } -void Launcher::LaunchAppIndexAt(int item_index) { +void Shelf::LaunchAppIndexAt(int item_index) { ShelfModel* shelf_model = shelf_view_->model(); const LauncherItems& items = shelf_model->items(); int item_count = shelf_model->item_count(); @@ -175,23 +175,23 @@ void Launcher::LaunchAppIndexAt(int item_index) { // requested (which is true when index was passed in as a negative number). if (found_index >= 0 && (indexes_left == -1 || item_index < 0)) { // Then set this one as active (or advance to the next item of its kind). - ActivateLauncherItem(found_index); + ActivateShelfItem(found_index); } } -void Launcher::SetShelfViewBounds(gfx::Rect bounds) { +void Shelf::SetShelfViewBounds(gfx::Rect bounds) { shelf_view_->SetBoundsRect(bounds); } -gfx::Rect Launcher::GetShelfViewBounds() const { +gfx::Rect Shelf::GetShelfViewBounds() const { return shelf_view_->bounds(); } -gfx::Rect Launcher::GetVisibleItemsBoundsInScreen() const { +gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { return shelf_view_->GetVisibleItemsBoundsInScreen(); } -app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() { +app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { return shelf_view_; } diff --git a/ash/launcher/launcher.h b/ash/shelf/shelf.h index 5c50b8c..00cb127 100644 --- a/ash/launcher/launcher.h +++ b/ash/shelf/shelf.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_LAUNCHER_LAUNCHER_H_ -#define ASH_LAUNCHER_LAUNCHER_H_ +#ifndef ASH_SHELF_SHELF_H_ +#define ASH_SHELF_SHELF_H_ #include "ash/ash_export.h" #include "ash/launcher/launcher_types.h" @@ -38,7 +38,7 @@ class ShelfView; } namespace test { -class LauncherTestAPI; +class ShelfTestAPI; } class ShelfDelegate; @@ -46,21 +46,20 @@ class ShelfIconObserver; class ShelfModel; class ShelfWidget; -class ASH_EXPORT Launcher { +class ASH_EXPORT Shelf { public: static const char kNativeViewName[]; - Launcher(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); - virtual ~Launcher(); + Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); + virtual ~Shelf(); - // Return the launcher for the primary display. NULL if no user is - // logged in yet. - static Launcher* ForPrimaryDisplay(); + // Return the shelf for the primary display. NULL if no user is logged in yet. + static Shelf* ForPrimaryDisplay(); - // Return the launcher for the display that |window| is currently on, - // or a launcher on primary display if the launcher per display feature - // is disabled. NULL if no user is logged in yet. - static Launcher* ForWindow(aura::Window* window); + // Return the shelf for the display that |window| is currently on, or a shelf + // on primary display if the shelf per display feature is disabled. NULL if + // no user is logged in yet. + static Shelf* ForWindow(aura::Window* window); void SetAlignment(ShelfAlignment alignment); ShelfAlignment alignment() const { return alignment_; } @@ -73,17 +72,17 @@ class ASH_EXPORT Launcher { // when dragging panels to reposition them with respect to the other panels. void UpdateIconPositionForWindow(aura::Window* window); - // Activates the the launcher item specified by the index in the list - // of launcher items. - void ActivateLauncherItem(int index); + // Activates the the shelf item specified by the index in the list of shelf + // items. + void ActivateShelfItem(int index); - // Cycles the window focus linearly over the current launcher items. + // Cycles the window focus linearly over the current shelf items. void CycleWindowLinear(CycleDirection direction); void AddIconObserver(ShelfIconObserver* observer); void RemoveIconObserver(ShelfIconObserver* observer); - // Returns true if the Launcher is showing a context menu. + // Returns true if the shelf is showing a context menu. bool IsShowingMenu() const; bool IsShowingOverflowBubble() const; @@ -95,8 +94,8 @@ class ASH_EXPORT Launcher { views::View* GetAppListButtonView() const; - // Launch a 0-indexed launcher item in the Launcher. - // A negative index launches the last launcher item in the launcher. + // Launch a 0-indexed shelf item in the shelf. + // A negative index launches the last shelf item in the shelf. void LaunchAppIndexAt(int item_index); ShelfWidget* shelf_widget() { return shelf_widget_; } @@ -105,15 +104,15 @@ class ASH_EXPORT Launcher { void SetShelfViewBounds(gfx::Rect bounds); gfx::Rect GetShelfViewBounds() const; - // Returns rectangle bounding all visible launcher items. Used screen - // coordinate system. + // Returns rectangle bounding all visible shelf items. Used screen coordinate + // system. gfx::Rect GetVisibleItemsBoundsInScreen() const; - // Returns ApplicationDragAndDropHost for this Launcher. + // Returns ApplicationDragAndDropHost for this shelf. app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); private: - friend class ash::test::LauncherTestAPI; + friend class test::ShelfTestAPI; // ShelfView used to display icons. internal::ShelfView* shelf_view_; @@ -124,9 +123,9 @@ class ASH_EXPORT Launcher { ShelfWidget* shelf_widget_; - DISALLOW_COPY_AND_ASSIGN(Launcher); + DISALLOW_COPY_AND_ASSIGN(Shelf); }; } // namespace ash -#endif // ASH_LAUNCHER_LAUNCHER_H_ +#endif // ASH_SHELF_SHELF_H_ diff --git a/ash/shelf/shelf_alignment_menu.cc b/ash/shelf/shelf_alignment_menu.cc index 3f77da1..84fe792 100644 --- a/ash/shelf/shelf_alignment_menu.cc +++ b/ash/shelf/shelf_alignment_menu.cc @@ -34,7 +34,7 @@ ShelfAlignmentMenu::ShelfAlignmentMenu(aura::Window* root) ShelfAlignmentMenu::~ShelfAlignmentMenu() {} bool ShelfAlignmentMenu::IsCommandIdChecked(int command_id) const { - return internal::ShelfLayoutManager::ForLauncher(root_window_)-> + return internal::ShelfLayoutManager::ForShelf(root_window_)-> SelectValueForShelfAlignment( MENU_ALIGN_BOTTOM == command_id, MENU_ALIGN_LEFT == command_id, diff --git a/ash/shelf/shelf_delegate.h b/ash/shelf/shelf_delegate.h index e168c47..03c2beb 100644 --- a/ash/shelf/shelf_delegate.h +++ b/ash/shelf/shelf_delegate.h @@ -9,34 +9,34 @@ #include "ash/launcher/launcher_types.h" namespace ash { -class Launcher; +class Shelf; -// Delegate for the Launcher. +// Delegate for the Shelf. class ASH_EXPORT ShelfDelegate { public: - // Launcher owns the delegate. + // Shelf owns the delegate. virtual ~ShelfDelegate() {} // Callback used to allow delegate to perform initialization actions that - // depend on the Launcher being in a known state. - virtual void OnLauncherCreated(Launcher* launcher) = 0; + // depend on the Shelf being in a known state. + virtual void OnShelfCreated(Shelf* shelf) = 0; - // Callback used to inform the delegate that a specific launcher no longer + // Callback used to inform the delegate that a specific shelf no longer // exists. - virtual void OnLauncherDestroyed(Launcher* launcher) = 0; + virtual void OnShelfDestroyed(Shelf* shelf) = 0; - // Get the launcher ID from an application ID. + // Get the shelf ID from an application ID. virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0; // Get the application ID for a given launcher ID. virtual const std::string& GetAppIDForLauncherID(LauncherID id) = 0; - // Pins an app with |app_id| to launcher. A running instance will get pinned. - // In case there is no running instance a new launcher item is created and + // Pins an app with |app_id| to shelf. A running instance will get pinned. + // In case there is no running instance a new shelf item is created and // pinned. virtual void PinAppWithID(const std::string& app_id) = 0; - // Check if the app with |app_id_| is pinned to the launcher. + // Check if the app with |app_id_| is pinned to the shelf. virtual bool IsAppPinned(const std::string& app_id) = 0; // Checks whether the user is allowed to pin/unpin apps. Pinning may be diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 999bd32..28ce634 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -11,11 +11,11 @@ #include <vector> #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/launcher/launcher_types.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_bezel_event_filter.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_widget.h" @@ -53,7 +53,7 @@ namespace internal { namespace { -// Delay before showing the launcher. This is after the mouse stops moving. +// Delay before showing the shelf. This is after the mouse stops moving. const int kAutoHideDelayMS = 200; // To avoid hiding the shelf when the mouse transitions from a message bubble @@ -286,15 +286,15 @@ void ShelfLayoutManager::LayoutShelf() { CalculateTargetBounds(state_, &target_bounds); UpdateBoundsAndOpacity(target_bounds, false, NULL); - if (shelf_->launcher()) { + if (shelf_->shelf()) { // This is not part of UpdateBoundsAndOpacity() because // SetShelfViewBounds() sets the bounds immediately and does not animate. // The height of the ShelfView for a horizontal shelf and the width of // the ShelfView for a vertical shelf are set when |shelf_|'s bounds // are changed via UpdateBoundsAndOpacity(). This sets the origin and the // dimension in the other direction. - shelf_->launcher()->SetShelfViewBounds( - target_bounds.launcher_bounds_in_shelf); + shelf_->shelf()->SetShelfViewBounds( + target_bounds.shelf_bounds_in_shelf); } } @@ -544,8 +544,8 @@ bool ShelfLayoutManager::IsHorizontalAlignment() const { } // static -ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { - ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); +ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { + ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf(); return shelf ? shelf->shelf_layout_manager() : NULL; } @@ -581,7 +581,7 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { if (state.visibility_state == SHELF_AUTO_HIDE) { // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the - // launcher to unhide the shelf. AutoHideEventFilter does that for us. + // shelf to unhide it. AutoHideEventFilter does that for us. if (!auto_hide_event_filter_) auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); } else { @@ -650,15 +650,15 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity( ui::ImplicitAnimationObserver* observer) { base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); - ui::ScopedLayerAnimationSettings launcher_animation_setter( + ui::ScopedLayerAnimationSettings shelf_animation_setter( GetLayer(shelf_)->GetAnimator()); ui::ScopedLayerAnimationSettings status_animation_setter( GetLayer(shelf_->status_area_widget())->GetAnimator()); if (animate) { - launcher_animation_setter.SetTransitionDuration( + shelf_animation_setter.SetTransitionDuration( base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); - launcher_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); - launcher_animation_setter.SetPreemptionStrategy( + shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); + shelf_animation_setter.SetPreemptionStrategy( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); status_animation_setter.SetTransitionDuration( base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); @@ -667,7 +667,7 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); } else { StopAnimating(); - launcher_animation_setter.SetTransitionDuration(base::TimeDelta()); + shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); status_animation_setter.SetTransitionDuration(base::TimeDelta()); } if (observer) @@ -822,7 +822,7 @@ void ShelfLayoutManager::CalculateTargetBounds( // This needs to happen after calling UpdateTargetBoundsForGesture(), because // that can change the size of the shelf. - target_bounds->launcher_bounds_in_shelf = SelectValueForShelfAlignment( + target_bounds->shelf_bounds_in_shelf = SelectValueForShelfAlignment( gfx::Rect(0, 0, shelf_width - status_size.width(), target_bounds->shelf_bounds_in_root.height()), @@ -871,7 +871,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture( } if (horizontal) { - // Move and size the launcher with the gesture. + // Move and size the shelf with the gesture. int shelf_height = target_bounds->shelf_bounds_in_root.height() - translate; shelf_height = std::max(shelf_height, kAutoHideSize); target_bounds->shelf_bounds_in_root.set_height(shelf_height); @@ -891,7 +891,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture( target_bounds->status_bounds_in_shelf.set_y(status_y.y()); } } else { - // Move and size the launcher with the gesture. + // Move and size the shelf with the gesture. int shelf_width = target_bounds->shelf_bounds_in_root.width(); bool right_aligned = GetAlignment() == SHELF_ALIGNMENT_RIGHT; if (right_aligned) @@ -988,13 +988,13 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( return SHELF_AUTO_HIDE_SHOWN; if (shelf_->status_area_widget() && - shelf_->status_area_widget()->ShouldShowLauncher()) + shelf_->status_area_widget()->ShouldShowShelf()) return SHELF_AUTO_HIDE_SHOWN; - if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) + if (shelf_->shelf() && shelf_->shelf()->IsShowingMenu()) return SHELF_AUTO_HIDE_SHOWN; - if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) + if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble()) return SHELF_AUTO_HIDE_SHOWN; if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) @@ -1078,7 +1078,7 @@ void ShelfLayoutManager::UpdateHitTestBounds() { gfx::Insets mouse_insets; gfx::Insets touch_insets; if (state_.visibility_state == SHELF_VISIBLE) { - // Let clicks at the very top of the launcher through so windows can be + // Let clicks at the very top of the shelf through so windows can be // resized with the bottom-right corner and bottom edge. mouse_insets = GetInsetsForAlignment(kWorkspaceAreaVisibleInset); } else if (state_.visibility_state == SHELF_AUTO_HIDE) { diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index 5d0496b..ee9091b 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -8,8 +8,8 @@ #include <vector> #include "ash/ash_export.h" -#include "ash/launcher/launcher.h" #include "ash/shelf/background_animator.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" #include "ash/shell_observer.h" #include "ash/system/status_area_widget.h" @@ -51,9 +51,9 @@ class ShelfLayoutManagerTest; class StatusAreaWidget; class WorkspaceController; -// ShelfLayoutManager is the layout manager responsible for the launcher and -// status widgets. The launcher is given the total available width and told the -// width of the status area. This allows the launcher to draw the background and +// ShelfLayoutManager is the layout manager responsible for the shelf and +// status widgets. The shelf is given the total available width and told the +// width of the status area. This allows the shelf to draw the background and // layout to the status area. // To respond to bounds changes in the status area StatusAreaLayoutManager works // closely with ShelfLayoutManager. @@ -82,7 +82,7 @@ class ASH_EXPORT ShelfLayoutManager : static const int kShelfSize; // Inset between the inner edge of the shelf (towards centre of screen), and - // the launcher items, notifications, status area etc. + // the shelf items, notifications, status area etc. static const int kShelfItemInset; // Returns the preferred size for the shelf (either kLauncherPreferredSize or @@ -115,7 +115,7 @@ class ASH_EXPORT ShelfLayoutManager : // Clears internal data for shutdown process. void PrepareForShutdown(); - // Returns whether the shelf and its contents (launcher, status) are visible + // Returns whether the shelf and its contents (shelf, status) are visible // on the screen. bool IsVisible() const; @@ -125,7 +125,7 @@ class ASH_EXPORT ShelfLayoutManager : // Returns the docked area bounds. const gfx::Rect& dock_bounds() const { return dock_bounds_; } - // Stops any animations and sets the bounds of the launcher and status + // Stops any animations and sets the bounds of the shelf and status // widgets. void LayoutShelf(); @@ -136,7 +136,7 @@ class ASH_EXPORT ShelfLayoutManager : // Updates the visibility state. void UpdateVisibilityState(); - // Invoked by the shelf/launcher when the auto-hide state may have changed. + // Invoked by the shelf when the auto-hide state may have changed. void UpdateAutoHideState(); ShelfVisibilityState visibility_state() const { @@ -215,9 +215,9 @@ class ASH_EXPORT ShelfLayoutManager : // Is the shelf's alignment horizontal? bool IsHorizontalAlignment() const; - // Returns a ShelfLayoutManager on the display which has a launcher for - // given |window|. See RootWindowController::ForLauncher for more info. - static ShelfLayoutManager* ForLauncher(aura::Window* window); + // Returns a ShelfLayoutManager on the display which has a shelf for + // given |window|. See RootWindowController::ForShelf for more info. + static ShelfLayoutManager* ForShelf(aura::Window* window); private: class AutoHideEventFilter; @@ -234,7 +234,7 @@ class ASH_EXPORT ShelfLayoutManager : float opacity; float status_opacity; gfx::Rect shelf_bounds_in_root; - gfx::Rect launcher_bounds_in_shelf; + gfx::Rect shelf_bounds_in_shelf; gfx::Rect status_bounds_in_shelf; gfx::Insets work_area_insets; }; @@ -266,7 +266,7 @@ class ASH_EXPORT ShelfLayoutManager : // Sets the visibility of the shelf to |state|. void SetState(ShelfVisibilityState visibility_state); - // Updates the bounds and opacity of the launcher and status widgets. + // Updates the bounds and opacity of the shelf and status widgets. // If |observer| is specified, it will be called back when the animations, if // any, are complete. void UpdateBoundsAndOpacity(const TargetBounds& target_bounds, @@ -309,12 +309,12 @@ class ASH_EXPORT ShelfLayoutManager : // two displays. gfx::Rect GetAutoHideShowShelfRegionInScreen() const; - // Returns the AutoHideState. This value is determined from the launcher and + // Returns the AutoHideState. This value is determined from the shelf and // tray. ShelfAutoHideState CalculateAutoHideState( ShelfVisibilityState visibility_state) const; - // Updates the hit test bounds override for launcher and status area. + // Updates the hit test bounds override for shelf and status area. void UpdateHitTestBounds(); // Returns true if |window| is a descendant of the shelf. @@ -369,8 +369,8 @@ class ASH_EXPORT ShelfLayoutManager : // False when neither the auto hide timer nor the timer task are running. bool mouse_over_shelf_when_auto_hide_timer_started_; - // EventFilter used to detect when user moves the mouse over the launcher to - // trigger showing the launcher. + // EventFilter used to detect when user moves the mouse over the shelf to + // trigger showing the shelf. scoped_ptr<AutoHideEventFilter> auto_hide_event_filter_; // EventFilter used to detect when user issues a gesture on a bezel sensor. diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index e8300d3..500450a 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -9,10 +9,10 @@ #include "ash/ash_switches.h" #include "ash/display/display_manager.h" #include "ash/focus_cycler.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_widget.h" @@ -22,7 +22,7 @@ #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_item.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/command_line.h" @@ -669,7 +669,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { gfx::Rect status_bounds( shelf->status_area_widget()->GetWindowBoundsInScreen()); - gfx::Rect launcher_bounds( + gfx::Rect shelf_bounds( shelf->GetWindowBoundsInScreen()); int shelf_height = manager->GetIdealBounds().height(); gfx::Screen* screen = Shell::GetScreen(); @@ -707,9 +707,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { EXPECT_EQ(shelf_height, display.GetWorkAreaInsets().bottom()); // Make sure the bounds of the two widgets changed. - launcher_bounds = shelf->GetNativeView()->bounds(); - EXPECT_LT(launcher_bounds.y(), - screen->GetPrimaryDisplay().bounds().bottom()); + shelf_bounds = shelf->GetNativeView()->bounds(); + EXPECT_LT(shelf_bounds.y(), screen->GetPrimaryDisplay().bounds().bottom()); status_bounds = shelf->status_area_widget()->GetNativeView()->bounds(); EXPECT_LT(status_bounds.y(), screen->GetPrimaryDisplay().bounds().bottom()); @@ -775,17 +774,17 @@ TEST_F(ShelfLayoutManagerTest, SetStateWhileAnimating) { small_change); } -// Makes sure the launcher is sized when the status area changes size. -TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) { - Launcher* launcher = Launcher::ForPrimaryDisplay(); - ASSERT_TRUE(launcher); +// Makes sure the shelf is sized when the status area changes size. +TEST_F(ShelfLayoutManagerTest, ShelfUpdatedWhenStatusAreaChangesSize) { + Shelf* shelf = Shelf::ForPrimaryDisplay(); + ASSERT_TRUE(shelf); ShelfWidget* shelf_widget = GetShelfWidget(); ASSERT_TRUE(shelf_widget); ASSERT_TRUE(shelf_widget->status_area_widget()); shelf_widget->status_area_widget()->SetBounds( gfx::Rect(0, 0, 200, 200)); EXPECT_EQ(200, shelf_widget->GetContentsView()->width() - - test::LauncherTestAPI(launcher).shelf_view()->width()); + test::ShelfTestAPI(shelf).shelf_view()->width()); } @@ -816,7 +815,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); // LayoutShelf() forces the animation to completion, at which point the - // launcher should go off the screen. + // shelf should go off the screen. shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, GetShelfWidget()->GetWindowBoundsInScreen().y()); @@ -977,7 +976,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { aura::Window* root = Shell::GetPrimaryRootWindow(); // LayoutShelf() forces the animation to completion, at which point the - // launcher should go off the screen. + // shelf should go off the screen. shelf->LayoutShelf(); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, GetShelfWidget()->GetWindowBoundsInScreen().y()); @@ -1197,8 +1196,8 @@ TEST_F(ShelfLayoutManagerTest, TestDimmingBehaviorWithMenus) { EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); } -// Verifies the shelf is visible when status/launcher is focused. -TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { +// Verifies the shelf is visible when status/shelf is focused. +TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) { // Since ShelfLayoutManager queries for mouse location, move the mouse so // it isn't over the shelf. aura::test::EventGenerator generator( @@ -1217,7 +1216,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); - // Focus the launcher. Have to go through the focus cycler as normal focus + // Focus the shelf. Have to go through the focus cycler as normal focus // requests to it do nothing. GetShelfWidget()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); @@ -1404,7 +1403,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); - gfx::Rect launcher_bounds( + gfx::Rect shelf_bounds( GetShelfWidget()->GetWindowBoundsInScreen()); const gfx::Screen* screen = Shell::GetScreen(); gfx::Display display = @@ -1413,7 +1412,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { EXPECT_EQ(shelf->GetIdealBounds().width(), display.GetWorkAreaInsets().left()); EXPECT_GE( - launcher_bounds.width(), + shelf_bounds.width(), GetShelfWidget()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(SHELF_ALIGNMENT_LEFT, GetSystemTray()->shelf_alignment()); StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); @@ -1425,9 +1424,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { EXPECT_EQ(0, display.GetWorkAreaInsets().top()); EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); EXPECT_EQ(0, display.GetWorkAreaInsets().right()); - EXPECT_EQ(display.bounds().x(), launcher_bounds.x()); - EXPECT_EQ(display.bounds().y(), launcher_bounds.y()); - EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); + EXPECT_EQ(display.bounds().x(), shelf_bounds.x()); + EXPECT_EQ(display.bounds().y(), shelf_bounds.y()); + EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, @@ -1437,13 +1436,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); - launcher_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); + shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), display.GetWorkAreaInsets().right()); - EXPECT_GE(launcher_bounds.width(), - GetShelfWidget()->GetContentsView()->GetPreferredSize().width()); + EXPECT_GE(shelf_bounds.width(), + GetShelfWidget()->GetContentsView()->GetPreferredSize().width()); EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, GetSystemTray()->shelf_alignment()); status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen()); EXPECT_GE(status_bounds.width(), @@ -1453,9 +1452,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { EXPECT_EQ(0, display.GetWorkAreaInsets().top()); EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); EXPECT_EQ(0, display.GetWorkAreaInsets().left()); - EXPECT_EQ(display.work_area().right(), launcher_bounds.x()); - EXPECT_EQ(display.bounds().y(), launcher_bounds.y()); - EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); + EXPECT_EQ(display.work_area().right(), shelf_bounds.x()); + EXPECT_EQ(display.bounds().y(), shelf_bounds.y()); + EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, @@ -1466,13 +1465,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); shelf->SetAlignment(SHELF_ALIGNMENT_TOP); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); - launcher_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); + shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); EXPECT_EQ(shelf->GetIdealBounds().height(), display.GetWorkAreaInsets().top()); - EXPECT_GE(launcher_bounds.height(), - GetShelfWidget()->GetContentsView()->GetPreferredSize().height()); + EXPECT_GE(shelf_bounds.height(), + GetShelfWidget()->GetContentsView()->GetPreferredSize().height()); EXPECT_EQ(SHELF_ALIGNMENT_TOP, GetSystemTray()->shelf_alignment()); status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen()); EXPECT_GE(status_bounds.height(), @@ -1482,9 +1481,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { EXPECT_EQ(0, display.GetWorkAreaInsets().right()); EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); EXPECT_EQ(0, display.GetWorkAreaInsets().left()); - EXPECT_EQ(display.work_area().y(), launcher_bounds.bottom()); - EXPECT_EQ(display.bounds().x(), launcher_bounds.x()); - EXPECT_EQ(display.bounds().width(), launcher_bounds.width()); + EXPECT_EQ(display.work_area().y(), shelf_bounds.bottom()); + EXPECT_EQ(display.bounds().x(), shelf_bounds.x()); + EXPECT_EQ(display.bounds().width(), shelf_bounds.width()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, diff --git a/ash/shelf/shelf_navigator_unittest.cc b/ash/shelf/shelf_navigator_unittest.cc index c4f392d..6ee07a5 100644 --- a/ash/shelf/shelf_navigator_unittest.cc +++ b/ash/shelf/shelf_navigator_unittest.cc @@ -5,8 +5,8 @@ #include "ash/shelf/shelf_navigator.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/launcher/launcher_types.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_model.h" #include "base/command_line.h" #include "base/compiler_specific.h" diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc index 6114202..2294ba4 100644 --- a/ash/shelf/shelf_tooltip_manager_unittest.cc +++ b/ash/shelf/shelf_tooltip_manager_unittest.cc @@ -10,7 +10,7 @@ #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/wm/window_util.h" #include "base/strings/string16.h" #include "base/time/time.h" @@ -46,7 +46,7 @@ class ShelfTooltipManagerTest : public AshTestBase { Shell::GetPrimaryRootWindowController(); tooltip_manager_.reset(new internal::ShelfTooltipManager( controller->GetShelfLayoutManager(), - LauncherTestAPI(controller->shelf()->launcher()).shelf_view())); + ShelfTestAPI(controller->shelf()->shelf()).shelf_view())); } virtual void TearDown() OVERRIDE { diff --git a/ash/launcher/launcher_unittest.cc b/ash/shelf/shelf_unittest.cc index 24eca33..5a7369e 100644 --- a/ash/launcher/launcher_unittest.cc +++ b/ash/shelf/shelf_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_button.h" #include "ash/shelf/shelf_item_delegate_manager.h" #include "ash/shelf/shelf_model.h" @@ -10,7 +10,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/test/test_shelf_item_delegate.h" #include "ash/wm/window_util.h" @@ -25,29 +25,28 @@ #include "base/win/windows_version.h" #endif -typedef ash::test::AshTestBase LauncherTest; using ash::internal::ShelfView; using ash::internal::ShelfButton; namespace ash { -class LauncherTest : public ash::test::AshTestBase { +class ShelfTest : public ash::test::AshTestBase { public: - LauncherTest() : launcher_(NULL), - shelf_view_(NULL), - shelf_model_(NULL), - item_delegate_manager_(NULL) { - } + ShelfTest() + : shelf_(NULL), + shelf_view_(NULL), + shelf_model_(NULL), + item_delegate_manager_(NULL) {} - virtual ~LauncherTest() {} + virtual ~ShelfTest() {} virtual void SetUp() { test::AshTestBase::SetUp(); - launcher_ = Launcher::ForPrimaryDisplay(); - ASSERT_TRUE(launcher_); + shelf_ = Shelf::ForPrimaryDisplay(); + ASSERT_TRUE(shelf_); - ash::test::LauncherTestAPI test(launcher_); + test::ShelfTestAPI test(shelf_); shelf_view_ = test.shelf_view(); shelf_model_ = shelf_view_->model(); item_delegate_manager_ = @@ -60,8 +59,8 @@ class LauncherTest : public ash::test::AshTestBase { test::AshTestBase::TearDown(); } - Launcher* launcher() { - return launcher_; + Shelf* shelf() { + return shelf_; } ShelfView* shelf_view() { @@ -81,17 +80,17 @@ class LauncherTest : public ash::test::AshTestBase { } private: - Launcher* launcher_; + Shelf* shelf_; ShelfView* shelf_view_; ShelfModel* shelf_model_; ShelfItemDelegateManager* item_delegate_manager_; scoped_ptr<test::ShelfViewTestAPI> test_; - DISALLOW_COPY_AND_ASSIGN(LauncherTest); + DISALLOW_COPY_AND_ASSIGN(ShelfTest); }; // Confirms that LauncherItem reflects the appropriated state. -TEST_F(LauncherTest, StatusReflection) { +TEST_F(ShelfTest, StatusReflection) { // Initially we have the app list. int button_count = test_api()->GetButtonCount(); @@ -111,7 +110,7 @@ TEST_F(LauncherTest, StatusReflection) { // Confirm that using the menu will clear the hover attribute. To avoid another // browser test we check this here. -TEST_F(LauncherTest, checkHoverAfterMenu) { +TEST_F(ShelfTest, checkHoverAfterMenu) { // Initially we have the app list. int button_count = test_api()->GetButtonCount(); @@ -136,7 +135,7 @@ TEST_F(LauncherTest, checkHoverAfterMenu) { shelf_model()->RemoveItemAt(index); } -TEST_F(LauncherTest, ShowOverflowBubble) { +TEST_F(ShelfTest, ShowOverflowBubble) { LauncherID first_item_id = shelf_model()->next_id(); // Add platform app button until overflow. @@ -153,14 +152,14 @@ TEST_F(LauncherTest, ShowOverflowBubble) { // Shows overflow bubble. test_api()->ShowOverflowBubble(); - EXPECT_TRUE(launcher()->IsShowingOverflowBubble()); + EXPECT_TRUE(shelf()->IsShowingOverflowBubble()); // Removes the first item in main shelf view. shelf_model()->RemoveItemAt(shelf_model()->ItemIndexByID(first_item_id)); // Waits for all transitions to finish and there should be no crash. test_api()->RunMessageLoopUntilAnimationsDone(); - EXPECT_FALSE(launcher()->IsShowingOverflowBubble()); + EXPECT_FALSE(shelf()->IsShowingOverflowBubble()); } } // namespace ash diff --git a/ash/shelf/shelf_util.cc b/ash/shelf/shelf_util.cc index 77031d8..f914188 100644 --- a/ash/shelf/shelf_util.cc +++ b/ash/shelf/shelf_util.cc @@ -31,14 +31,14 @@ LauncherID GetLauncherIDForWindow(aura::Window* window) { return window->GetProperty(kLauncherID); } -void SetLauncherItemDetailsForWindow(aura::Window* window, - const LauncherItemDetails& details) { +void SetShelfItemDetailsForWindow(aura::Window* window, + const LauncherItemDetails& details) { // |item_details| is owned by |window|. LauncherItemDetails* item_details = new LauncherItemDetails(details); window->SetProperty(kLauncherItemDetailsKey, item_details); } -void ClearLauncherItemDetailsForWindow(aura::Window* window) { +void ClearShelfItemDetailsForWindow(aura::Window* window) { window->ClearProperty(kLauncherItemDetailsKey); } diff --git a/ash/shelf/shelf_util.h b/ash/shelf/shelf_util.h index 6fb3d5e..9b9764d 100644 --- a/ash/shelf/shelf_util.h +++ b/ash/shelf/shelf_util.h @@ -28,14 +28,14 @@ ASH_EXPORT void SetLauncherIDForWindow(LauncherID id, aura::Window* window); ASH_EXPORT LauncherID GetLauncherIDForWindow(aura::Window* window); // Sets LauncherItemDetails for |window|. -ASH_EXPORT void SetLauncherItemDetailsForWindow( +ASH_EXPORT void SetShelfItemDetailsForWindow( aura::Window* window, const LauncherItemDetails& details); // Clears LauncherItemDetails for |window|. -// If |window| has a LauncherItem by SetLauncherItemDetailsForWindow(), it will +// If |window| has a LauncherItem by SetShelfItemDetailsForWindow(), it will // be removed. -ASH_EXPORT void ClearLauncherItemDetailsForWindow(aura::Window* window); +ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window); // Returns LauncherItemDetails for |window| or NULL if it doesn't have. // Returned LauncherItemDetails object is owned by the |window|. diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 101c0cd..01dfae4 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -87,7 +87,7 @@ const int kHorizontalIconSpacing = 2; const int kHorizontalNoIconInsetSpacing = kHorizontalIconSpacing + kDefaultLeadingInset; -// The proportion of the launcher space reserved for non-panel icons. Panels +// The proportion of the shelf space reserved for non-panel icons. Panels // may flow into this space but will be put into the overflow bubble if there // is contention for the space. const float kReservedNonPanelIconProportion = 0.67f; @@ -203,14 +203,14 @@ bool ShelfMenuModelAdapter::ShouldReserveSpaceForSubmenuIndicator() const { return false; } -// Custom FocusSearch used to navigate the launcher in the order items are in +// Custom FocusSearch used to navigate the shelf in the order items are in // the ViewModel. -class LauncherFocusSearch : public views::FocusSearch { +class ShelfFocusSearch : public views::FocusSearch { public: - explicit LauncherFocusSearch(views::ViewModel* view_model) + explicit ShelfFocusSearch(views::ViewModel* view_model) : FocusSearch(NULL, true, true), view_model_(view_model) {} - virtual ~LauncherFocusSearch() {} + virtual ~ShelfFocusSearch() {} // views::FocusSearch overrides: virtual View* FindNextFocusableView( @@ -239,7 +239,7 @@ class LauncherFocusSearch : public views::FocusSearch { private: views::ViewModel* view_model_; - DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch); + DISALLOW_COPY_AND_ASSIGN(ShelfFocusSearch); }; // AnimationDelegate used when inserting a new item. This steadily increases the @@ -385,7 +385,7 @@ ShelfView::ShelfView(ShelfModel* model, bounds_animator_.reset(new views::BoundsAnimator(this)); bounds_animator_->AddObserver(this); set_context_menu_controller(this); - focus_search_.reset(new LauncherFocusSearch(view_model_.get())); + focus_search_.reset(new ShelfFocusSearch(view_model_.get())); tooltip_.reset(new ShelfTooltipManager(manager, this)); } @@ -585,7 +585,7 @@ bool ShelfView::StartDrag(const std::string& app_id, drag_and_drop_launcher_id_ = delegate_->GetLauncherIDForAppID(drag_and_drop_app_id_); // Check if the application is known and pinned - if not, we have to pin it so - // that we can re-arrange the launcher order accordingly. Note that items have + // that we can re-arrange the shelf order accordingly. Note that items have // to be pinned to give them the same (order) possibilities as a shortcut. // When an item is dragged from overflow to shelf, IsShowingOverflowBubble() // returns true. At this time, we don't need to pin the item. @@ -716,7 +716,7 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) { // Initial x,y values account both leading_inset in primary // coordinate and secondary coordinate based on the dynamic edge of the - // launcher (eg top edge on bottom-aligned launcher). + // shelf (eg top edge on bottom-aligned shelf). int inset = ash::switches::UseAlternateShelfLayout() ? 0 : leading_inset_; int x = layout_manager_->SelectValueForShelfAlignment(inset, 0, 0, inset); int y = layout_manager_->SelectValueForShelfAlignment(0, inset, inset, 0); @@ -744,7 +744,7 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) { return; } - // To address Fitt's law, we make the first launcher button include the + // To address Fitt's law, we make the first shelf button include the // leading inset (if there is one). if (!ash::switches::UseAlternateShelfLayout()) { if (view_model_->view_size() > 0) { @@ -1060,7 +1060,7 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { if (target_index == current_index) return; - // Change the model, the LauncherItemMoved() callback will handle the + // Change the model, the ShelfItemMoved() callback will handle the // |view_model_| update. model_->Move(current_index, target_index); bounds_animator_->StopAnimatingView(drag_view_); @@ -1143,7 +1143,7 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) { dragged_off_shelf_ = true; if (RemovableByRipOff(current_index) == REMOVABLE) { // Move the item to the front of the first panel item and hide it. - // LauncherItemMoved() callback will handle the |view_model_| update and + // ShelfItemMoved() callback will handle the |view_model_| update and // call AnimateToIdealBounds(). if (current_index != model_->FirstPanelIndex() - 1) { model_->Move(current_index, model_->FirstPanelIndex() - 1); @@ -1306,7 +1306,7 @@ void ShelfView::UpdateFirstButtonPadding() { if (ash::switches::UseAlternateShelfLayout()) return; - // Creates an empty border for first launcher button to make included leading + // Creates an empty border for first shelf button to make included leading // inset act as the button's padding. This is only needed on button creation // and when shelf alignment changes. if (view_model_->view_size() > 0) { @@ -1557,7 +1557,7 @@ void ShelfView::ShelfItemRemoved(int model_index, LauncherID id) { // When the overflow bubble is visible, the overflow range needs to be set // before CalculateIdealBounds() gets called. Otherwise CalculateIdealBounds() - // could trigger a LauncherItemChanged() by hiding the overflow bubble and + // could trigger a ShelfItemChanged() by hiding the overflow bubble and // since the overflow bubble is not yet synced with the ShelfModel this // could cause a crash. if (overflow_bubble_ && overflow_bubble_->IsShowing()) { @@ -1631,7 +1631,7 @@ void ShelfView::ShelfItemChanged(int model_index, void ShelfView::ShelfItemMoved(int start_index, int target_index) { view_model_->Move(start_index, target_index); - // When cancelling a drag due to a launcher item being added, the currently + // When cancelling a drag due to a shelf item being added, the currently // dragged item is moved back to its initial position. AnimateToIdealBounds // will be called again when the new item is added to the |view_model_| but // at this time the |view_model_| is inconsistent with the |model_|. @@ -1874,7 +1874,7 @@ void ShelfView::ShowMenu(scoped_ptr<views::MenuModelAdapter> menu_model_adapter, views::MenuItemView::TOPLEFT; gfx::Rect anchor_point = gfx::Rect(click_point, gfx::Size()); - ShelfWidget* shelf = RootWindowController::ForLauncher( + ShelfWidget* shelf = RootWindowController::ForShelf( GetWidget()->GetNativeView())->shelf(); if (!context_menu) { // Application lists use a bubble. @@ -1909,7 +1909,7 @@ void ShelfView::ShowMenu(scoped_ptr<views::MenuModelAdapter> menu_model_adapter, break; } } - // If this gets deleted while we are in the menu, the launcher will be gone + // If this gets deleted while we are in the menu, the shelf will be gone // as well. bool got_deleted = false; got_deleted_ = &got_deleted; @@ -2005,7 +2005,7 @@ bool ShelfView::ShouldShowTooltipForView(const views::View* view) const { } int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { - ShelfWidget* shelf = RootWindowController::ForLauncher( + ShelfWidget* shelf = RootWindowController::ForShelf( GetWidget()->GetNativeView())->shelf(); ash::ShelfAlignment align = shelf->GetAlignment(); const gfx::Rect bounds = GetBoundsInScreen(); diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 47d1c80..15c37fe 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc @@ -8,11 +8,11 @@ #include <vector> #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/launcher/launcher_types.h" #include "ash/root_window_controller.h" #include "ash/shelf/overflow_bubble.h" #include "ash/shelf/overflow_bubble_view.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_button.h" #include "ash/shelf/shelf_icon_observer.h" #include "ash/shelf/shelf_item_delegate_manager.h" @@ -23,8 +23,8 @@ #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" #include "ash/test/overflow_bubble_view_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" @@ -56,16 +56,16 @@ namespace test { class TestShelfIconObserver : public ShelfIconObserver { public: - explicit TestShelfIconObserver(Launcher* launcher) - : launcher_(launcher), + explicit TestShelfIconObserver(Shelf* shelf) + : shelf_(shelf), change_notified_(false) { - if (launcher_) - launcher_->AddIconObserver(this); + if (shelf_) + shelf_->AddIconObserver(this); } virtual ~TestShelfIconObserver() { - if (launcher_) - launcher_->RemoveIconObserver(this); + if (shelf_) + shelf_->RemoveIconObserver(this); } // ShelfIconObserver implementation. @@ -77,7 +77,7 @@ class TestShelfIconObserver : public ShelfIconObserver { void Reset() { change_notified_ = false; } private: - Launcher* launcher_; + Shelf* shelf_; bool change_notified_; DISALLOW_COPY_AND_ASSIGN(TestShelfIconObserver); @@ -90,11 +90,11 @@ class ShelfViewIconObserverTest : public AshTestBase { virtual void SetUp() OVERRIDE { AshTestBase::SetUp(); - Launcher* launcher = Launcher::ForPrimaryDisplay(); - observer_.reset(new TestShelfIconObserver(launcher)); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + observer_.reset(new TestShelfIconObserver(shelf)); - shelf_view_test_.reset(new ShelfViewTestAPI( - LauncherTestAPI(launcher).shelf_view())); + shelf_view_test_.reset( + new ShelfViewTestAPI(ShelfTestAPI(shelf).shelf_view())); shelf_view_test_->SetAnimationDuration(1); } @@ -109,8 +109,8 @@ class ShelfViewIconObserverTest : public AshTestBase { return shelf_view_test_.get(); } - Launcher* LauncherForSecondaryDisplay() { - return Launcher::ForWindow(Shell::GetAllRootWindows()[1]); + Shelf* ShelfForSecondaryDisplay() { + return Shelf::ForWindow(Shell::GetAllRootWindows()[1]); } private: @@ -152,10 +152,10 @@ TEST_F(ShelfViewIconObserverTest, AddRemove) { AddRemoveWithMultipleDisplays #endif // Make sure creating/deleting an window on one displays notifies a -// launcher on external display as well as one on primary. +// shelf on external display as well as one on primary. TEST_F(ShelfViewIconObserverTest, MAYBE_AddRemoveWithMultipleDisplays) { UpdateDisplay("400x400,400x400"); - TestShelfIconObserver second_observer(LauncherForSecondaryDisplay()); + TestShelfIconObserver second_observer(ShelfForSecondaryDisplay()); TestShelfDelegate* shelf_delegate = TestShelfDelegate::instance(); ASSERT_TRUE(shelf_delegate); @@ -184,13 +184,12 @@ TEST_F(ShelfViewIconObserverTest, MAYBE_AddRemoveWithMultipleDisplays) { } TEST_F(ShelfViewIconObserverTest, BoundsChanged) { - ShelfWidget* shelf = Shell::GetPrimaryRootWindowController()->shelf(); - Launcher* launcher = Launcher::ForPrimaryDisplay(); - gfx::Size shelf_size = - shelf->GetWindowBoundsInScreen().size(); + ShelfWidget* widget = Shell::GetPrimaryRootWindowController()->shelf(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + gfx::Size shelf_size = widget->GetWindowBoundsInScreen().size(); shelf_size.set_width(shelf_size.width() / 2); ASSERT_GT(shelf_size.width(), 0); - launcher->SetShelfViewBounds(gfx::Rect(shelf_size)); + shelf->SetShelfViewBounds(gfx::Rect(shelf_size)); // No animation happens for ShelfView bounds change. EXPECT_TRUE(observer()->change_notified()); observer()->Reset(); @@ -208,9 +207,9 @@ class TestShelfDelegateForShelfView : public ShelfDelegate { virtual ~TestShelfDelegateForShelfView() {} // ShelfDelegate overrides: - virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE {} + virtual void OnShelfCreated(Shelf* shelf) OVERRIDE {} - virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE {} + virtual void OnShelfDestroyed(Shelf* shelf) OVERRIDE {} virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE { LauncherID id = 0; @@ -267,8 +266,8 @@ class ShelfViewTest : public AshTestBase { AshTestBase::SetUp(); test::ShellTestApi test_api(Shell::GetInstance()); model_ = test_api.shelf_model(); - Launcher* launcher = Launcher::ForPrimaryDisplay(); - shelf_view_ = test::LauncherTestAPI(launcher).shelf_view(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + shelf_view_ = ShelfTestAPI(shelf).shelf_view(); // The bounds should be big enough for 4 buttons + overflow chevron. shelf_view_->SetBounds(0, 0, 500, @@ -280,7 +279,7 @@ class ShelfViewTest : public AshTestBase { item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager(); DCHECK(item_manager_); - // Add browser shortcut launcher item at index 0 for test. + // Add browser shortcut shelf item at index 0 for test. AddBrowserShortcut(); } @@ -382,7 +381,7 @@ class ShelfViewTest : public AshTestBase { ASSERT_EQ(map_index, id_map.size()); } - void VerifyLauncherItemBoundsAreValid() { + void VerifyShelfItemBoundsAreValid() { for (int i=0;i <= test_api_->GetLastVisibleIndex(); ++i) { if (test_api_->GetButton(i)) { gfx::Rect shelf_view_bounds = shelf_view_->GetLocalBounds(); @@ -434,14 +433,14 @@ class ShelfViewTest : public AshTestBase { void SetupForDragTest( std::vector<std::pair<LauncherID, views::View*> >* id_map) { - // Initialize |id_map| with the automatically-created launcher buttons. + // Initialize |id_map| with the automatically-created shelf buttons. for (size_t i = 0; i < model_->items().size(); ++i) { internal::ShelfButton* button = test_api_->GetButton(i); id_map->push_back(std::make_pair(model_->items()[i].id, button)); } ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map)); - // Add 5 app launcher buttons for testing. + // Add 5 app shelf buttons for testing. for (int i = 0; i < 5; ++i) { LauncherID id = AddAppShortcut(); // App Icon is located at index 0, and browser shortcut is located at @@ -568,8 +567,7 @@ class ShelfViewTest : public AshTestBase { test_api.SetShelfDelegate(NULL); ShelfDelegate* delegate = new TestShelfDelegateForShelfView(model_); test_api.SetShelfDelegate(delegate); - test::LauncherTestAPI( - Launcher::ForPrimaryDisplay()).SetShelfDelegate(delegate); + test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).SetShelfDelegate(delegate); test_api_->SetShelfDelegate(delegate); } @@ -956,7 +954,7 @@ TEST_F(ShelfViewTest, AddButtonQuickly) { } } -// Check that model changes are handled correctly while a launcher icon is being +// Check that model changes are handled correctly while a shelf icon is being // dragged. TEST_F(ShelfViewTest, ModelChangesWhileDragging) { internal::ShelfButtonHost* button_host = shelf_view_; @@ -1002,7 +1000,7 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { internal::ShelfButtonHost::MOUSE, false); - // Adding a launcher item cancels the drag and respects the order. + // Adding a shelf item cancels the drag and respects the order. dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); LauncherID new_id = AddAppShortcut(); id_map.insert(id_map.begin() + 6, @@ -1012,7 +1010,7 @@ TEST_F(ShelfViewTest, ModelChangesWhileDragging) { internal::ShelfButtonHost::MOUSE, false); - // Adding a launcher item at the end (i.e. a panel) canels drag and respects + // Adding a shelf item at the end (i.e. a panel) canels drag and respects // the order. dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 1, 3); new_id = AddPanel(); @@ -1068,7 +1066,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { internal::ShelfButtonHost::MOUSE, false); - // Adding a launcher item cancels the drag and respects the order. + // Adding a shelf item cancels the drag and respects the order. dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); LauncherID new_id = AddAppShortcut(); id_map.insert(id_map.begin() + 5, @@ -1078,7 +1076,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) { internal::ShelfButtonHost::MOUSE, false); - // Adding a launcher item at the end (i.e. a panel) canels drag and respects + // Adding a shelf item at the end (i.e. a panel) canels drag and respects // the order. dragged_button = SimulateDrag(internal::ShelfButtonHost::MOUSE, 0, 2); new_id = AddPanel(); @@ -1162,7 +1160,7 @@ TEST_F(ShelfViewTest, ClickOneDragAnother) { } // Confirm that item status changes are reflected in the buttons. -TEST_F(ShelfViewTest, LauncherItemStatus) { +TEST_F(ShelfViewTest, ShelfItemStatus) { // All buttons should be visible. ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); @@ -1182,12 +1180,12 @@ TEST_F(ShelfViewTest, LauncherItemStatus) { } TEST_F(ShelfViewLegacyShelfLayoutTest, - LauncherItemPositionReflectedOnStateChanged) { + ShelfItemPositionReflectedOnStateChanged) { // All buttons should be visible. ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); - // Add 2 items to the launcher. + // Add 2 items to the shelf. LauncherID item1_id = AddPlatformApp(); LauncherID item2_id = AddPlatformAppNoWait(); internal::ShelfButton* item1_button = GetButtonByID(item1_id); @@ -1217,7 +1215,7 @@ TEST_F(ShelfViewLegacyShelfLayoutTest, // Confirm that item status changes are reflected in the buttons // for platform apps. -TEST_F(ShelfViewTest, LauncherItemStatusPlatformApp) { +TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) { // All buttons should be visible. ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); @@ -1236,24 +1234,24 @@ TEST_F(ShelfViewTest, LauncherItemStatusPlatformApp) { ASSERT_EQ(internal::ShelfButton::STATE_ATTENTION, button->state()); } -// Confirm that launcher item bounds are correctly updated on shelf changes. -TEST_F(ShelfViewTest, LauncherItemBoundsCheck) { - VerifyLauncherItemBoundsAreValid(); +// Confirm that shelf item bounds are correctly updated on shelf changes. +TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { + VerifyShelfItemBoundsAreValid(); shelf_view_->shelf_layout_manager()->SetAutoHideBehavior( SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); test_api_->RunMessageLoopUntilAnimationsDone(); - VerifyLauncherItemBoundsAreValid(); + VerifyShelfItemBoundsAreValid(); shelf_view_->shelf_layout_manager()->SetAutoHideBehavior( SHELF_AUTO_HIDE_BEHAVIOR_NEVER); test_api_->RunMessageLoopUntilAnimationsDone(); - VerifyLauncherItemBoundsAreValid(); + VerifyShelfItemBoundsAreValid(); } TEST_F(ShelfViewTest, ShelfTooltipTest) { ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); - // Prepare some items to the launcher. + // Prepare some items to the shelf. LauncherID app_button_id = AddAppShortcut(); LauncherID platform_button_id = AddPlatformApp(); @@ -1295,14 +1293,14 @@ TEST_F(ShelfViewTest, ShelfTooltipTest) { EXPECT_EQ(platform_button, GetTooltipAnchorView()); } -// Verify a fix for crash caused by a tooltip update for a deleted launcher +// Verify a fix for crash caused by a tooltip update for a deletedshelf // button, see crbug.com/288838. TEST_F(ShelfViewTest, RemovingItemClosesTooltip) { internal::ShelfButtonHost* button_host = shelf_view_; internal::ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager(); - // Add an item to the launcher. + // Add an item to the shelf. LauncherID app_button_id = AddAppShortcut(); internal::ShelfButton* app_button = GetButtonByID(app_button_id); @@ -1327,7 +1325,7 @@ TEST_F(ShelfViewTest, ShelfAlignmentClosesTooltip) { internal::ShelfTooltipManager* tooltip_manager = shelf_view_->tooltip_manager(); - // Add an item to the launcher. + // Add an item to the shelf. LauncherID app_button_id = AddAppShortcut(); internal::ShelfButton* app_button = GetButtonByID(app_button_id); @@ -1621,10 +1619,9 @@ TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { return; UpdateDisplay("800x600,800x600"); - Launcher* secondary_launcher = - Launcher::ForWindow(Shell::GetAllRootWindows()[1]); + Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]); internal::ShelfView* shelf_view_for_secondary = - test::LauncherTestAPI(secondary_launcher).shelf_view(); + ShelfTestAPI(secondary_shelf).shelf_view(); // The bounds should be big enough for 4 buttons + overflow chevron. shelf_view_for_secondary->SetBounds(0, 0, 500, @@ -1705,9 +1702,9 @@ TEST_F(ShelfViewTest, CheckRipOffFromLeftShelfAlignmentWithMultiMonitor) { int browser_index = model_->GetItemIndexForType(TYPE_BROWSER_SHORTCUT); EXPECT_GT(browser_index, 0); - Launcher* secondary_launcher = Launcher::ForWindow(second_root); + Shelf* secondary_shelf = Shelf::ForWindow(second_root); internal::ShelfView* shelf_view_for_secondary = - test::LauncherTestAPI(secondary_launcher).shelf_view(); + ShelfTestAPI(secondary_shelf).shelf_view(); ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary); internal::ShelfButton* button = @@ -1744,8 +1741,8 @@ class ShelfViewVisibleBoundsTest : public ShelfViewTest, void CheckAllItemsAreInBounds() { gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); - gfx::Rect launcher_bounds = shelf_view_->GetBoundsInScreen(); - EXPECT_TRUE(launcher_bounds.Contains(visible_bounds)); + gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen(); + EXPECT_TRUE(shelf_bounds.Contains(visible_bounds)); for (int i = 0; i < test_api_->GetButtonCount(); ++i) if (internal::ShelfButton* button = test_api_->GetButton(i)) EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen())); diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 960e70c..907ac9d 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -38,7 +38,7 @@ #include "ui/views/widget/widget_delegate.h" namespace { -// Size of black border at bottom (or side) of launcher. +// Size of black border at bottom (or side) of shelf. const int kNumBlackPixels = 3; // Alpha to paint dimming image with. const int kDimAlpha = 128; @@ -85,7 +85,7 @@ class DimmerView : public views::View, int get_dimming_alpha_for_test() { return alpha_; } private: - // This class monitors mouse events to see if it is on top of the launcher. + // This class monitors mouse events to see if it is on top of the shelf. class DimmerEventFilter : public ui::EventHandler { public: explicit DimmerEventFilter(DimmerView* owner); @@ -174,12 +174,12 @@ void DimmerView::ForceUndimming(bool force) { void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { SkPaint paint; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::ImageSkia launcher_background = + gfx::ImageSkia shelf_background = *rb.GetImageNamed(IDR_AURA_LAUNCHER_DIMMING).ToImageSkia(); if (shelf_->GetAlignment() != ash::SHELF_ALIGNMENT_BOTTOM) { - launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage( - launcher_background, + shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( + shelf_background, shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( SkBitmapOperations::ROTATION_90_CW, SkBitmapOperations::ROTATION_90_CW, @@ -187,12 +187,17 @@ void DimmerView::OnPaintBackground(gfx::Canvas* canvas) { SkBitmapOperations::ROTATION_180_CW)); } paint.setAlpha(alpha_); - canvas->DrawImageInt( - launcher_background, - 0, 0, launcher_background.width(), launcher_background.height(), - 0, 0, width(), height(), - false, - paint); + canvas->DrawImageInt(shelf_background, + 0, + 0, + shelf_background.width(), + shelf_background.height(), + 0, + 0, + width(), + height(), + false, + paint); } DimmerView::DimmerEventFilter::DimmerEventFilter(DimmerView* owner) @@ -352,7 +357,7 @@ void ShelfWidget::DelegateView::SetDimmed(bool value) { dimmer_->Init(params); dimmer_->GetNativeWindow()->SetName("ShelfDimmer"); dimmer_->SetBounds(shelf_->GetWindowBoundsInScreen()); - // The launcher should not take focus when it is initially shown. + // The shelf should not take focus when it is initially shown. dimmer_->set_focus_on_creation(false); dimmer_view_ = new DimmerView(shelf_, disable_dimming_animations_for_test_); dimmer_->SetContentsView(dimmer_view_); @@ -379,11 +384,11 @@ void ShelfWidget::DelegateView::SetParentLayer(ui::Layer* layer) { void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::ImageSkia launcher_background = + gfx::ImageSkia shelf_background = *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND); if (SHELF_ALIGNMENT_BOTTOM != shelf_->GetAlignment()) - launcher_background = gfx::ImageSkiaOperations::CreateRotatedImage( - launcher_background, + shelf_background = gfx::ImageSkiaOperations::CreateRotatedImage( + shelf_background, shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( SkBitmapOperations::ROTATION_90_CW, SkBitmapOperations::ROTATION_90_CW, @@ -392,45 +397,59 @@ void ShelfWidget::DelegateView::OnPaintBackground(gfx::Canvas* canvas) { const gfx::Rect dock_bounds(shelf_->shelf_layout_manager()->dock_bounds()); SkPaint paint; paint.setAlpha(alpha_); - canvas->DrawImageInt( - launcher_background, - 0, 0, launcher_background.width(), launcher_background.height(), - (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() && - dock_bounds.x() == 0 && dock_bounds.width() > 0) ? - dock_bounds.width() : 0, 0, - SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() ? - width() - dock_bounds.width() : width(), height(), - false, - paint); + canvas->DrawImageInt(shelf_background, + 0, + 0, + shelf_background.width(), + shelf_background.height(), + (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() && + dock_bounds.x() == 0 && dock_bounds.width() > 0) + ? dock_bounds.width() + : 0, + 0, + SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() + ? width() - dock_bounds.width() + : width(), + height(), + false, + paint); if (SHELF_ALIGNMENT_BOTTOM == shelf_->GetAlignment() && dock_bounds.width() > 0) { // The part of the shelf background that is in the corner below the docked // windows close to the work area is an arched gradient that blends // vertically oriented docked background and horizontal shelf. - gfx::ImageSkia launcher_corner = + gfx::ImageSkia shelf_corner = *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_CORNER); if (dock_bounds.x() == 0) { - launcher_corner = gfx::ImageSkiaOperations::CreateRotatedImage( - launcher_corner, SkBitmapOperations::ROTATION_90_CW); + shelf_corner = gfx::ImageSkiaOperations::CreateRotatedImage( + shelf_corner, SkBitmapOperations::ROTATION_90_CW); } canvas->DrawImageInt( - launcher_corner, - 0, 0, launcher_corner.width(), launcher_corner.height(), + shelf_corner, + 0, + 0, + shelf_corner.width(), + shelf_corner.height(), dock_bounds.x() > 0 ? dock_bounds.x() : dock_bounds.width() - height(), 0, - height(), height(), + height(), + height(), false, paint); // The part of the shelf background that is just below the docked windows // is drawn using the last (lowest) 1-pixel tall strip of the image asset. // This avoids showing the border 3D shadow between the shelf and the dock. - canvas->DrawImageInt( - launcher_background, - 0, launcher_background.height() - 1, launcher_background.width(), 1, - dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0, 0, - dock_bounds.width() - height(), height(), - false, - paint); + canvas->DrawImageInt(shelf_background, + 0, + shelf_background.height() - 1, + shelf_background.width(), + 1, + dock_bounds.x() > 0 ? dock_bounds.x() + height() : 0, + 0, + dock_bounds.width() - height(), + height(), + false, + paint); } gfx::Rect black_rect = shelf_->shelf_layout_manager()->SelectValueForShelfAlignment( @@ -614,8 +633,8 @@ ShelfAlignment ShelfWidget::GetAlignment() const { } void ShelfWidget::SetAlignment(ShelfAlignment alignment) { - if (launcher_) - launcher_->SetAlignment(alignment); + if (shelf_) + shelf_->SetAlignment(alignment); status_area_widget_->SetShelfAlignment(alignment); delegate_view_->SchedulePaint(); } @@ -624,8 +643,8 @@ void ShelfWidget::SetDimsShelf(bool dimming) { delegate_view_->SetDimmed(dimming); // Repaint all children, allowing updates to reflect dimmed state eg: // status area background, app list button and overflow button. - if (launcher_) - launcher_->SchedulePaint(); + if (shelf_) + shelf_->SchedulePaint(); status_area_widget_->GetContentsView()->SchedulePaint(); } @@ -633,38 +652,37 @@ bool ShelfWidget::GetDimsShelf() const { return delegate_view_->GetDimmed(); } -void ShelfWidget::CreateLauncher() { - if (launcher_) +void ShelfWidget::CreateShelf() { + if (shelf_) return; Shell* shell = Shell::GetInstance(); // This needs to be called before shelf_model(). ShelfDelegate* shelf_delegate = shell->GetShelfDelegate(); if (!shelf_delegate) - return; // Not ready to create Launcher + return; // Not ready to create Shelf. - launcher_.reset(new Launcher(shell->shelf_model(), - shell->GetShelfDelegate(), - this)); + shelf_.reset( + new Shelf(shell->shelf_model(), shell->GetShelfDelegate(), this)); SetFocusCycler(shell->focus_cycler()); // Inform the root window controller. - internal::RootWindowController::ForWindow(window_container_)-> - OnLauncherCreated(); + internal::RootWindowController::ForWindow(window_container_) + ->OnShelfCreated(); - launcher_->SetVisible( + shelf_->SetVisible( shell->session_state_delegate()->IsActiveUserSessionStarted()); shelf_layout_manager_->LayoutShelf(); Show(); } -bool ShelfWidget::IsLauncherVisible() const { - return launcher_.get() && launcher_->IsVisible(); +bool ShelfWidget::IsShelfVisible() const { + return shelf_.get() && shelf_->IsVisible(); } -void ShelfWidget::SetLauncherVisibility(bool visible) { - if (launcher_) - launcher_->SetVisible(visible); +void ShelfWidget::SetShelfVisibility(bool visible) { + if (shelf_) + shelf_->SetVisible(visible); } void ShelfWidget::SetFocusCycler(internal::FocusCycler* focus_cycler) { diff --git a/ash/shelf/shelf_widget.h b/ash/shelf/shelf_widget.h index 6c9eeba..d2ff8b4 100644 --- a/ash/shelf/shelf_widget.h +++ b/ash/shelf/shelf_widget.h @@ -17,7 +17,7 @@ class Window; } namespace ash { -class Launcher; +class Shelf; namespace internal { class FocusCycler; @@ -56,22 +56,22 @@ class ASH_EXPORT ShelfWidget : public views::Widget, internal::ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } - Launcher* launcher() const { return launcher_.get(); } + Shelf* shelf() const { return shelf_.get(); } internal::StatusAreaWidget* status_area_widget() const { return status_area_widget_; } - void CreateLauncher(); + void CreateShelf(); - // Set visibility of the launcher component of the shelf. - void SetLauncherVisibility(bool visible); - bool IsLauncherVisible() const; + // Set visibility of the shelf. + void SetShelfVisibility(bool visible); + bool IsShelfVisible() const; - // Sets the focus cycler. Also adds the launcher to the cycle. + // Sets the focus cycler. Also adds the shelf to the cycle. void SetFocusCycler(internal::FocusCycler* focus_cycler); internal::FocusCycler* GetFocusCycler(); - // Called by the activation delegate, before the launcher is activated + // Called by the activation delegate, before the shelf is activated // when no other windows are visible. void WillActivateAsFallback() { activating_as_fallback_ = true; } @@ -105,7 +105,7 @@ class ASH_EXPORT ShelfWidget : public views::Widget, class DelegateView; internal::ShelfLayoutManager* shelf_layout_manager_; - scoped_ptr<Launcher> launcher_; + scoped_ptr<Shelf> shelf_; internal::StatusAreaWidget* status_area_widget_; // delegate_view_ is attached to window_container_ and is cleaned up diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index c4e9b87..9f36556 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc @@ -4,15 +4,15 @@ #include "ash/shelf/shelf_widget.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_button.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_view.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/wm/window_util.h" #include "ui/aura/root_window.h" @@ -27,7 +27,7 @@ namespace ash { namespace { ShelfWidget* GetShelfWidget() { - return Launcher::ForPrimaryDisplay()->shelf_widget(); + return Shelf::ForPrimaryDisplay()->shelf_widget(); } internal::ShelfLayoutManager* GetShelfLayoutManager() { @@ -43,8 +43,8 @@ typedef test::AshTestBase ShelfWidgetTest; // TODO(mtomasz): make this test work with the FocusController. // crbug.com/285364. TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) { - Launcher* launcher = Launcher::ForPrimaryDisplay(); - ShelfWidget* shelf_widget = launcher->shelf_widget(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + ShelfWidget* shelf_widget = shelf->shelf_widget(); EXPECT_FALSE(shelf_widget->CanActivate()); shelf_widget->WillActivateAsFallback(); @@ -64,9 +64,9 @@ void TestLauncherAlignment(aura::Window* root, } TEST_F(ShelfWidgetTest, TestAlignment) { - Launcher* launcher = Launcher::ForPrimaryDisplay(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); UpdateDisplay("400x400"); - ASSERT_TRUE(launcher); + ASSERT_TRUE(shelf); { SCOPED_TRACE("Single Bottom"); TestLauncherAlignment(Shell::GetPrimaryRootWindow(), @@ -128,11 +128,11 @@ TEST_F(ShelfWidgetTest, TestAlignment) { } } -// Makes sure the launcher is initially sized correctly. +// Makes sure the shelf is initially sized correctly. TEST_F(ShelfWidgetTest, LauncherInitiallySized) { ShelfWidget* shelf_widget = GetShelfWidget(); - Launcher* launcher = shelf_widget->launcher(); - ASSERT_TRUE(launcher); + Shelf* shelf = shelf_widget->shelf(); + ASSERT_TRUE(shelf); internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); ASSERT_TRUE(shelf_layout_manager); ASSERT_TRUE(shelf_widget->status_area_widget()); @@ -141,11 +141,11 @@ TEST_F(ShelfWidgetTest, LauncherInitiallySized) { // Test only makes sense if the status is > 0, which it better be. EXPECT_GT(status_width, 0); EXPECT_EQ(status_width, shelf_widget->GetContentsView()->width() - - test::LauncherTestAPI(launcher).shelf_view()->width()); + test::ShelfTestAPI(shelf).shelf_view()->width()); } // Verifies when the shell is deleted with a full screen window we don't crash. -TEST_F(ShelfWidgetTest, DontReferenceLauncherAfterDeletion) { +TEST_F(ShelfWidgetTest, DontReferenceShelfAfterDeletion) { views::Widget* widget = new views::Widget; views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); params.bounds = gfx::Rect(0, 0, 200, 200); @@ -156,38 +156,38 @@ TEST_F(ShelfWidgetTest, DontReferenceLauncherAfterDeletion) { } #if defined(OS_CHROMEOS) -// Verifies launcher is created with correct size after user login and when its +// Verifies shelf is created with correct size after user login and when its // container and status widget has finished sizing. // See http://crbug.com/252533 -TEST_F(ShelfWidgetTest, LauncherInitiallySizedAfterLogin) { +TEST_F(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) { SetUserLoggedIn(false); UpdateDisplay("300x200,400x300"); - ShelfWidget* shelf = NULL; + ShelfWidget* shelf_widget = NULL; Shell::RootWindowControllerList controllers( Shell::GetAllRootWindowControllers()); for (Shell::RootWindowControllerList::const_iterator i = controllers.begin(); i != controllers.end(); ++i) { - if (!(*i)->shelf()->launcher()) { - shelf = (*i)->shelf(); + if (!(*i)->shelf()->shelf()) { + shelf_widget = (*i)->shelf(); break; } } - ASSERT_TRUE(shelf != NULL); + ASSERT_TRUE(shelf_widget != NULL); SetUserLoggedIn(true); - Shell::GetInstance()->CreateLauncher(); + Shell::GetInstance()->CreateShelf(); - Launcher* launcher = shelf->launcher(); - ASSERT_TRUE(launcher != NULL); + Shelf* shelf = shelf_widget->shelf(); + ASSERT_TRUE(shelf != NULL); const int status_width = - shelf->status_area_widget()->GetWindowBoundsInScreen().width(); + shelf_widget->status_area_widget()->GetWindowBoundsInScreen().width(); EXPECT_GT(status_width, 0); EXPECT_EQ(status_width, - shelf->GetContentsView()->width() - - test::LauncherTestAPI(launcher).shelf_view()->width()); + shelf_widget->GetContentsView()->width() - + test::ShelfTestAPI(shelf).shelf_view()->width()); } #endif diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc index b4e65e25..f297315 100644 --- a/ash/shelf/shelf_window_watcher.cc +++ b/ash/shelf/shelf_window_watcher.cc @@ -22,7 +22,7 @@ namespace { // Sets LauncherItem property by using the value of |details|. -void SetLauncherItemDetailsForLauncherItem( +void SetShelfItemDetailsForLauncherItem( ash::LauncherItem* item, const ash::LauncherItemDetails& details) { item->type = details.type; @@ -87,7 +87,7 @@ void ShelfWindowWatcher::AddLauncherItem(aura::Window* window) { LauncherItem item; LauncherID id = model_->next_id(); item.status = ash::wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING; - SetLauncherItemDetailsForLauncherItem(&item, *item_details); + SetShelfItemDetailsForLauncherItem(&item, *item_details); SetLauncherIDForWindow(id, window); scoped_ptr<ShelfItemDelegate> item_delegate( new ShelfWindowWatcherItemDelegate(window)); @@ -190,7 +190,7 @@ void ShelfWindowWatcher::OnWindowPropertyChanged(aura::Window* window, LauncherItem item = model_->items()[index]; const LauncherItemDetails* details = GetLauncherItemDetailsForWindow(window); - SetLauncherItemDetailsForLauncherItem(&item, *details); + SetShelfItemDetailsForLauncherItem(&item, *details); model_->Set(index, item); return; } diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc index 1217aae..3982c76 100644 --- a/ash/shelf/shelf_window_watcher_unittest.cc +++ b/ash/shelf/shelf_window_watcher_unittest.cc @@ -33,11 +33,11 @@ class ShelfWindowWatcherTest : public test::AshTestBase { test::AshTestBase::TearDown(); } - ash::LauncherID CreateLauncherItem(aura::Window* window) { + ash::LauncherID CreateShelfItem(aura::Window* window) { LauncherID id = model_->next_id(); ash::LauncherItemDetails item_details; item_details.type = TYPE_PLATFORM_APP; - SetLauncherItemDetailsForWindow(window, item_details); + SetShelfItemDetailsForWindow(window, item_details); return id; } @@ -59,26 +59,26 @@ TEST_F(ShelfWindowWatcherTest, CreateAndRemoveLauncherItem) { scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithId(0)); // Create a LauncherItem for w1. - LauncherID id_w1 = CreateLauncherItem(w1.get()); + LauncherID id_w1 = CreateShelfItem(w1.get()); EXPECT_EQ(2, model_->item_count()); int index_w1 = model_->ItemIndexByID(id_w1); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); // Create a LauncherItem for w2. - LauncherID id_w2 = CreateLauncherItem(w2.get()); + LauncherID id_w2 = CreateShelfItem(w2.get()); EXPECT_EQ(3, model_->item_count()); int index_w2 = model_->ItemIndexByID(id_w2); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w2].status); // LauncherItem is removed when assoicated window is destroyed. - ClearLauncherItemDetailsForWindow(w1.get()); + ClearShelfItemDetailsForWindow(w1.get()); EXPECT_EQ(2, model_->item_count()); - ClearLauncherItemDetailsForWindow(w2.get()); + ClearShelfItemDetailsForWindow(w2.get()); EXPECT_EQ(1, model_->item_count()); // Clears twice doesn't do anything. - ClearLauncherItemDetailsForWindow(w2.get()); + ClearShelfItemDetailsForWindow(w2.get()); EXPECT_EQ(1, model_->item_count()); } @@ -90,13 +90,13 @@ TEST_F(ShelfWindowWatcherTest, ActivateWindow) { scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithId(0)); // Create a LauncherItem for w1. - LauncherID id_w1 = CreateLauncherItem(w1.get()); + LauncherID id_w1 = CreateShelfItem(w1.get()); EXPECT_EQ(2, model_->item_count()); int index_w1 = model_->ItemIndexByID(id_w1); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); // Create a LauncherItem for w2. - LauncherID id_w2 = CreateLauncherItem(w2.get()); + LauncherID id_w2 = CreateShelfItem(w2.get()); EXPECT_EQ(3, model_->item_count()); int index_w2 = model_->ItemIndexByID(id_w2); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); @@ -119,7 +119,7 @@ TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) { scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); // Create a LauncherItem for |window|. - LauncherID id = CreateLauncherItem(window.get()); + LauncherID id = CreateShelfItem(window.get()); EXPECT_EQ(2, model_->item_count()); int index = model_->ItemIndexByID(id); @@ -129,7 +129,7 @@ TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) { LauncherItemDetails details; details.type = TYPE_PLATFORM_APP; - SetLauncherItemDetailsForWindow(window.get(), details); + SetShelfItemDetailsForWindow(window.get(), details); // No new item is created after updating a launcher item. EXPECT_EQ(2, model_->item_count()); // index and id are not changed after updating a launcher item. @@ -145,7 +145,7 @@ TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { wm::WindowState* window_state = wm::GetWindowState(window.get()); // Create a LauncherItem for |window|. - LauncherID id = CreateLauncherItem(window.get()); + LauncherID id = CreateShelfItem(window.get()); EXPECT_EQ(2, model_->item_count()); int index = model_->ItemIndexByID(id); diff --git a/ash/shell.cc b/ash/shell.cc index 607601d..d5e7a6e 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -344,7 +344,7 @@ void Shell::OnLoginStateChanged(user::LoginStatus status) { } void Shell::OnLoginUserProfilePrepared() { - CreateLauncher(); + CreateShelf(); CreateKeyboard(); } @@ -375,11 +375,11 @@ void Shell::OnLockStateChanged(bool locked) { #endif } -void Shell::CreateLauncher() { +void Shell::CreateShelf() { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); iter != controllers.end(); ++iter) - (*iter)->shelf()->CreateLauncher(); + (*iter)->shelf()->CreateShelf(); } void Shell::CreateKeyboard() { @@ -395,11 +395,11 @@ void Shell::CreateKeyboard() { } } -void Shell::ShowLauncher() { +void Shell::ShowShelf() { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); iter != controllers.end(); ++iter) - (*iter)->ShowLauncher(); + (*iter)->ShowShelf(); } void Shell::AddShellObserver(ShellObserver* observer) { @@ -420,19 +420,19 @@ void Shell::UpdateShelfVisibility() { void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, aura::Window* root_window) { - ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> + ash::internal::ShelfLayoutManager::ForShelf(root_window)-> SetAutoHideBehavior(behavior); } ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( aura::Window* root_window) const { - return ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> + return ash::internal::ShelfLayoutManager::ForShelf(root_window)-> auto_hide_behavior(); } void Shell::SetShelfAlignment(ShelfAlignment alignment, aura::Window* root_window) { - if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> + if (ash::internal::ShelfLayoutManager::ForShelf(root_window)-> SetAlignment(alignment)) { FOR_EACH_OBSERVER( ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); @@ -619,8 +619,8 @@ Shell::~Shell() { RemovePreTargetHandler(tooltip_controller_.get()); // AppList needs to be released before shelf layout manager, which is - // destroyed with launcher container in the loop below. However, app list - // container is now on top of launcher container and released after it. + // destroyed with shelf container in the loop below. However, app list + // container is now on top of shelf container and released after it. // TODO(xiyuan): Move it back when app list container is no longer needed. app_list_controller_.reset(); @@ -754,7 +754,7 @@ void Shell::Init() { display_manager_->InitDefaultDisplay(); // Install the custom factory first so that views::FocusManagers for Tray, - // Launcher, and WallPaper could be created by the factory. + // Shelf, and WallPaper could be created by the factory. views::FocusManagerFactory::Install(new AshFocusManagerFactory); // Env creates the compositor. Historically it seems to have been implicitly diff --git a/ash/shell.h b/ash/shell.h index 339c68c..4b8ab21 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -84,8 +84,6 @@ class DesktopBackgroundController; class DisplayController; class FirstRunHelper; class HighContrastController; -class Launcher; -class ShelfDelegate; class LockStateController; class MagnificationController; class MediaDelegate; @@ -97,6 +95,8 @@ class PowerButtonController; class RootWindowHostFactory; class ScreenAsh; class SessionStateDelegate; +class Shelf; +class ShelfDelegate; class ShelfItemDelegateManager; class ShelfModel; class ShellDelegate; @@ -284,15 +284,15 @@ class ASH_EXPORT Shell // unlocked. void OnLockStateChanged(bool locked); - // Initializes |launcher_|. Does nothing if it's already initialized. - void CreateLauncher(); + // Initializes |shelf_|. Does nothing if it's already initialized. + void CreateShelf(); // Creates virtual keyboard. Deletes the old virtual keyboard if it's already // exist. void CreateKeyboard(); // Show shelf view if it was created hidden (before session has started). - void ShowLauncher(); + void ShowShelf(); // Adds/removes observer. void AddShellObserver(ShellObserver* observer); diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index 980c63b..70d523e 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -119,7 +119,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { ash::Shell::CreateInstance(delegate_); delegate_->set_browser_context(browser_context_.get()); - ash::Shell::GetInstance()->CreateLauncher(); + ash::Shell::GetInstance()->CreateShelf(); ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( user::LOGGED_IN_USER); diff --git a/ash/shell/context_menu.cc b/ash/shell/context_menu.cc index 19ad408..b7bffb3 100644 --- a/ash/shell/context_menu.cc +++ b/ash/shell/context_menu.cc @@ -4,8 +4,8 @@ #include "ash/shell/context_menu.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" #include "ash/shell.h" #include "grit/ash_strings.h" diff --git a/ash/shell/shelf_delegate_impl.cc b/ash/shell/shelf_delegate_impl.cc index 0112009..f2f8e1b 100644 --- a/ash/shell/shelf_delegate_impl.cc +++ b/ash/shell/shelf_delegate_impl.cc @@ -21,10 +21,10 @@ ShelfDelegateImpl::ShelfDelegateImpl(WindowWatcher* watcher) ShelfDelegateImpl::~ShelfDelegateImpl() { } -void ShelfDelegateImpl::OnLauncherCreated(Launcher* launcher) { +void ShelfDelegateImpl::OnShelfCreated(Shelf* shelf) { } -void ShelfDelegateImpl::OnLauncherDestroyed(Launcher* launcher) { +void ShelfDelegateImpl::OnShelfDestroyed(Shelf* shelf) { } LauncherID ShelfDelegateImpl::GetLauncherIDForAppID(const std::string& app_id) { diff --git a/ash/shell/shelf_delegate_impl.h b/ash/shell/shelf_delegate_impl.h index ed6dc6d..eb7bc33 100644 --- a/ash/shell/shelf_delegate_impl.h +++ b/ash/shell/shelf_delegate_impl.h @@ -25,8 +25,8 @@ class ShelfDelegateImpl : public ShelfDelegate { void set_watcher(WindowWatcher* watcher) { watcher_ = watcher; } // ShelfDelegate overrides: - virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE; - virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE; + virtual void OnShelfCreated(Shelf* shelf) OVERRIDE; + virtual void OnShelfDestroyed(Shelf* shelf) OVERRIDE; virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE; virtual const std::string& GetAppIDForLauncherID(LauncherID id) OVERRIDE; virtual void PinAppWithID(const std::string& app_id) OVERRIDE; diff --git a/ash/shell/window_watcher.cc b/ash/shell/window_watcher.cc index f63eeec..607719a 100644 --- a/ash/shell/window_watcher.cc +++ b/ash/shell/window_watcher.cc @@ -5,7 +5,7 @@ #include "ash/shell/window_watcher.h" #include "ash/display/display_controller.h" -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_item_delegate_manager.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_util.h" @@ -44,7 +44,7 @@ class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { panel_container->AddObserver(watcher_); aura::Window* container = - Launcher::ForWindow(root)->shelf_widget()->window_container(); + Shelf::ForWindow(root)->shelf_widget()->window_container(); container->AddObserver(this); for (size_t i = 0; i < container->children().size(); ++i) container->children()[i]->AddObserver(watcher_); @@ -57,7 +57,7 @@ class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { panel_container->RemoveObserver(watcher_); aura::Window* container = - Launcher::ForWindow(root)->shelf_widget()->window_container(); + Shelf::ForWindow(root)->shelf_widget()->window_container(); container->RemoveObserver(this); for (size_t i = 0; i < container->children().size(); ++i) container->children()[i]->RemoveObserver(watcher_); diff --git a/ash/shell/window_watcher_unittest.cc b/ash/shell/window_watcher_unittest.cc index 31959e6..285c313 100644 --- a/ash/shell/window_watcher_unittest.cc +++ b/ash/shell/window_watcher_unittest.cc @@ -25,7 +25,7 @@ TEST_F(WindowWatcherTest, ShellDeleteInstance) { shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; Shell::CreateInstance(delegate); Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->Show(); - Shell::GetInstance()->CreateLauncher(); + Shell::GetInstance()->CreateShelf(); Shell::GetInstance()->UpdateAfterLoginStatusChange( user::LOGGED_IN_USER); diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 93cabc8..99a67d4 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -11,9 +11,9 @@ #include "ash/desktop_background/desktop_background_widget_controller.h" #include "ash/display/mouse_cursor_event_filter.h" #include "ash/drag_drop/drag_drop_controller.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/session_state_delegate.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell_delegate.h" @@ -394,13 +394,13 @@ TEST_F(ShellTest, ManagedWindowModeBasics) { // We start with the usual window containers. ExpectAllContainers(); // Shelf is visible. - ShelfWidget* launcher_widget = Launcher::ForPrimaryDisplay()->shelf_widget(); - EXPECT_TRUE(launcher_widget->IsVisible()); + ShelfWidget* shelf_widget = Shelf::ForPrimaryDisplay()->shelf_widget(); + EXPECT_TRUE(shelf_widget->IsVisible()); // Shelf is at bottom-left of screen. - EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); + EXPECT_EQ(0, shelf_widget->GetWindowBoundsInScreen().x()); EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetDispatcher()->host()-> GetBounds().height(), - launcher_widget->GetWindowBoundsInScreen().bottom()); + shelf_widget->GetWindowBoundsInScreen().bottom()); // We have a desktop background but not a bare layer. // TODO (antrim): enable once we find out why it fails component build. // internal::DesktopBackgroundWidgetController* background = diff --git a/ash/system/chromeos/audio/tray_audio.cc b/ash/system/chromeos/audio/tray_audio.cc index 7d26fc6..3dbd815 100644 --- a/ash/system/chromeos/audio/tray_audio.cc +++ b/ash/system/chromeos/audio/tray_audio.cc @@ -596,7 +596,7 @@ bool TrayAudio::ShouldHideArrow() const { return true; } -bool TrayAudio::ShouldShowLauncher() const { +bool TrayAudio::ShouldShowShelf() const { return ash::switches::ShowAudioDeviceMenu() && !pop_up_volume_view_; } diff --git a/ash/system/chromeos/audio/tray_audio.h b/ash/system/chromeos/audio/tray_audio.h index d055a54..eb6e117a 100644 --- a/ash/system/chromeos/audio/tray_audio.h +++ b/ash/system/chromeos/audio/tray_audio.h @@ -32,7 +32,7 @@ class TrayAudio : public TrayImageItem, virtual void DestroyDefaultView() OVERRIDE; virtual void DestroyDetailedView() OVERRIDE; virtual bool ShouldHideArrow() const OVERRIDE; - virtual bool ShouldShowLauncher() const OVERRIDE; + virtual bool ShouldShowShelf() const OVERRIDE; // Overridden from chromeos::CrasAudioHandler::AudioObserver. virtual void OnOutputVolumeChanged() OVERRIDE; diff --git a/ash/system/chromeos/brightness/tray_brightness.cc b/ash/system/chromeos/brightness/tray_brightness.cc index 98cace08..dcce3c1 100644 --- a/ash/system/chromeos/brightness/tray_brightness.cc +++ b/ash/system/chromeos/brightness/tray_brightness.cc @@ -201,7 +201,7 @@ bool TrayBrightness::ShouldHideArrow() const { return true; } -bool TrayBrightness::ShouldShowLauncher() const { +bool TrayBrightness::ShouldShowShelf() const { return false; } diff --git a/ash/system/chromeos/brightness/tray_brightness.h b/ash/system/chromeos/brightness/tray_brightness.h index adabbc5..0c15a75 100644 --- a/ash/system/chromeos/brightness/tray_brightness.h +++ b/ash/system/chromeos/brightness/tray_brightness.h @@ -42,7 +42,7 @@ class TrayBrightness : public SystemTrayItem, virtual void DestroyDetailedView() OVERRIDE; virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; virtual bool ShouldHideArrow() const OVERRIDE; - virtual bool ShouldShowLauncher() const OVERRIDE; + virtual bool ShouldShowShelf() const OVERRIDE; // Overriden from PowerManagerClient::Observer. virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE; diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 19649b1..305dab8 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc @@ -76,16 +76,16 @@ void StatusAreaWidget::Shutdown() { system_tray_ = NULL; } -bool StatusAreaWidget::ShouldShowLauncher() const { - if ((system_tray_ && system_tray_->ShouldShowLauncher()) || +bool StatusAreaWidget::ShouldShowShelf() const { + if ((system_tray_ && system_tray_->ShouldShowShelf()) || (web_notification_tray_ && - web_notification_tray_->ShouldBlockLauncherAutoHide())) + web_notification_tray_->ShouldBlockShelfAutoHide())) return true; - if (!RootWindowController::ForLauncher(GetNativeView())->shelf()->IsVisible()) + if (!RootWindowController::ForShelf(GetNativeView())->shelf()->IsVisible()) return false; - // If the launcher is currently visible, don't hide the launcher if the mouse + // If the shelf is currently visible, don't hide the shelf if the mouse // is in any of the notification bubbles. return (system_tray_ && system_tray_->IsMouseInNotificationBubble()) || (web_notification_tray_ && diff --git a/ash/system/status_area_widget.h b/ash/system/status_area_widget.h index 731eed1..7aa2bc7 100644 --- a/ash/system/status_area_widget.h +++ b/ash/system/status_area_widget.h @@ -56,10 +56,10 @@ class ASH_EXPORT StatusAreaWidget : public views::Widget { user::LoginStatus login_status() const { return login_status_; } - // Returns true if the launcher should be visible. This is used when the - // launcher is configured to auto-hide and test if the shelf should force - // the launcher to remain visible. - bool ShouldShowLauncher() const; + // Returns true if the shelf should be visible. This is used when the + // shelf is configured to auto-hide and test if the shelf should force + // the shelf to remain visible. + bool ShouldShowShelf() const; // True if any message bubble is shown. bool IsMessageBubbleShown() const; diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index cee8847..48d90c5 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -342,8 +342,8 @@ void SystemTray::SetHideNotifications(bool hide_notifications) { hide_notifications_ = hide_notifications; } -bool SystemTray::ShouldShowLauncher() const { - return system_bubble_.get() && system_bubble_->bubble()->ShouldShowLauncher(); +bool SystemTray::ShouldShowShelf() const { + return system_bubble_.get() && system_bubble_->bubble()->ShouldShowShelf(); } bool SystemTray::HasSystemBubble() const { @@ -618,7 +618,7 @@ void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { void SystemTray::AnchorUpdated() { if (notification_bubble_) { notification_bubble_->bubble_view()->UpdateBubble(); - // Ensure that the notification buble is above the launcher/status area. + // Ensure that the notification buble is above the shelf/status area. notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); UpdateBubbleViewArrow(notification_bubble_->bubble_view()); } diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h index 7b1681d..afe6100 100644 --- a/ash/system/tray/system_tray.h +++ b/ash/system/tray/system_tray.h @@ -94,8 +94,8 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView, // Temporarily hides/unhides the notification bubble. void SetHideNotifications(bool hidden); - // Returns true if the launcher should be forced visible when auto-hidden. - bool ShouldShowLauncher() const; + // Returns true if the shelf should be forced visible when auto-hidden. + bool ShouldShowShelf() const; // Returns true if there is a system bubble (already visible or in the process // of being created). diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc index 1aa60bc..b3a0451 100644 --- a/ash/system/tray/system_tray_bubble.cc +++ b/ash/system/tray/system_tray_bubble.cc @@ -340,11 +340,11 @@ bool SystemTrayBubble::IsVisible() { return bubble_view() && bubble_view()->GetWidget()->IsVisible(); } -bool SystemTrayBubble::ShouldShowLauncher() const { +bool SystemTrayBubble::ShouldShowShelf() const { for (std::vector<ash::SystemTrayItem*>::const_iterator it = items_.begin(); it != items_.end(); ++it) { - if ((*it)->ShouldShowLauncher()) + if ((*it)->ShouldShowShelf()) return true; } return false; diff --git a/ash/system/tray/system_tray_bubble.h b/ash/system/tray/system_tray_bubble.h index b84c3ea..a8f576e 100644 --- a/ash/system/tray/system_tray_bubble.h +++ b/ash/system/tray/system_tray_bubble.h @@ -59,8 +59,8 @@ class SystemTrayBubble { bool IsVisible(); // Returns true if any of the SystemTrayItems return true from - // ShouldShowLauncher(). - bool ShouldShowLauncher() const; + // ShouldShowShelf(). + bool ShouldShowShelf() const; private: void CreateItemViews(user::LoginStatus login_status); diff --git a/ash/system/tray/system_tray_item.cc b/ash/system/tray/system_tray_item.cc index f5d5b71..554c589 100644 --- a/ash/system/tray/system_tray_item.cc +++ b/ash/system/tray/system_tray_item.cc @@ -85,7 +85,7 @@ bool SystemTrayItem::ShouldHideArrow() const { return false; } -bool SystemTrayItem::ShouldShowLauncher() const { +bool SystemTrayItem::ShouldShowShelf() const { return true; } diff --git a/ash/system/tray/system_tray_item.h b/ash/system/tray/system_tray_item.h index b42f3f5..b0d1284 100644 --- a/ash/system/tray/system_tray_item.h +++ b/ash/system/tray/system_tray_item.h @@ -101,9 +101,9 @@ class ASH_EXPORT SystemTrayItem { // Returns true if item should hide the arrow. virtual bool ShouldHideArrow() const; - // Returns true if this item needs to force the launcher to be visible when - // the launcher is in the auto-hide state. Default is true. - virtual bool ShouldShowLauncher() const; + // Returns true if this item needs to force the shelf to be visible when + // the shelf is in the auto-hide state. Default is true. + virtual bool ShouldShowShelf() const; // Returns the system tray that this item belongs to. SystemTray* system_tray() const { return system_tray_; } diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index 80cac07..952f622 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc @@ -429,7 +429,7 @@ void TrayBackgroundView::SetContentsBackground() { } ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() { - return ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView()); + return ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView()); } void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { @@ -623,7 +623,7 @@ void TrayBackgroundView::UpdateBubbleViewArrow( aura::Window* root_window = bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); ash::internal::ShelfLayoutManager* shelf = - ShelfLayoutManager::ForLauncher(root_window); + ShelfLayoutManager::ForShelf(root_window); bubble_view->SetArrowPaintType( (shelf && shelf->IsVisible()) ? views::BubbleBorder::PAINT_NORMAL : diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 1cbfbca..89c2dee 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -195,7 +195,7 @@ void WorkAreaObserver::UpdateShelf() { if (shelf_) return; - shelf_ = ShelfLayoutManager::ForLauncher(root_window_); + shelf_ = ShelfLayoutManager::ForShelf(root_window_); if (shelf_) shelf_->AddObserver(this); } @@ -431,7 +431,7 @@ bool WebNotificationTray::ShouldShowMessageCenter() { status_area_widget()->system_tray()->HasNotificationBubble()); } -bool WebNotificationTray::ShouldBlockLauncherAutoHide() const { +bool WebNotificationTray::ShouldBlockShelfAutoHide() const { return should_block_shelf_auto_hide_; } diff --git a/ash/system/web_notification/web_notification_tray.h b/ash/system/web_notification/web_notification_tray.h index 890369d..fdaf4d0 100644 --- a/ash/system/web_notification/web_notification_tray.h +++ b/ash/system/web_notification/web_notification_tray.h @@ -62,8 +62,8 @@ class ASH_EXPORT WebNotificationTray // shown in the system tray side. void SetSystemTrayHeight(int height); - // Returns true if it should block the auto hide behavior of the launcher. - bool ShouldBlockLauncherAutoHide() const; + // Returns true if it should block the auto hide behavior of the shelf. + bool ShouldBlockShelfAutoHide() const; // Returns true if the message center bubble is visible. bool IsMessageCenterBubbleVisible() const; diff --git a/ash/test/launcher_test_api.cc b/ash/test/launcher_test_api.cc deleted file mode 100644 index 2e56a86..0000000 --- a/ash/test/launcher_test_api.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/test/launcher_test_api.h" - -#include "ash/launcher/launcher.h" - -namespace ash { -namespace test { - -LauncherTestAPI::LauncherTestAPI(Launcher* launcher) - : launcher_(launcher) { -} - -LauncherTestAPI::~LauncherTestAPI() { -} - -internal::ShelfView* LauncherTestAPI::shelf_view() { - return launcher_->shelf_view_; -} - -void LauncherTestAPI::SetShelfDelegate(ShelfDelegate* delegate) { - launcher_->delegate_ = delegate; -} - -} // namespace test -} // namespace ash diff --git a/ash/test/shelf_test_api.cc b/ash/test/shelf_test_api.cc new file mode 100644 index 0000000..0ce27f7 --- /dev/null +++ b/ash/test/shelf_test_api.cc @@ -0,0 +1,28 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/test/shelf_test_api.h" + +#include "ash/shelf/shelf.h" + +namespace ash { +namespace test { + +ShelfTestAPI::ShelfTestAPI(Shelf* shelf) + : shelf_(shelf) { +} + +ShelfTestAPI::~ShelfTestAPI() { +} + +internal::ShelfView* ShelfTestAPI::shelf_view() { + return shelf_->shelf_view_; +} + +void ShelfTestAPI::SetShelfDelegate(ShelfDelegate* delegate) { + shelf_->delegate_ = delegate; +} + +} // namespace test +} // namespace ash diff --git a/ash/test/launcher_test_api.h b/ash/test/shelf_test_api.h index d838339..48aafda 100644 --- a/ash/test/launcher_test_api.h +++ b/ash/test/shelf_test_api.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_TEST_LAUNCHER_TEST_API_H_ -#define ASH_TEST_LAUNCHER_TEST_API_H_ +#ifndef ASH_TEST_SHELF_TEST_API_H_ +#define ASH_TEST_SHELF_TEST_API_H_ #include "base/basictypes.h" namespace ash { -class Launcher; +class Shelf; class ShelfDelegate; namespace internal { @@ -18,12 +18,12 @@ class ShelfView; namespace test { -// Use the api in this class to access private members of Launcher. -class LauncherTestAPI { +// Use the api in this class to access private members of Shelf. +class ShelfTestAPI { public: - explicit LauncherTestAPI(Launcher* launcher); + explicit ShelfTestAPI(Shelf* shelf); - ~LauncherTestAPI(); + ~ShelfTestAPI(); // An accessor for |shelf_view|. internal::ShelfView* shelf_view(); @@ -32,12 +32,12 @@ class LauncherTestAPI { void SetShelfDelegate(ShelfDelegate* delegate); private: - Launcher* launcher_; + Shelf* shelf_; - DISALLOW_COPY_AND_ASSIGN(LauncherTestAPI); + DISALLOW_COPY_AND_ASSIGN(ShelfTestAPI); }; } // namespace test } // namespace ash -#endif // ASH_TEST_LAUNCHER_TEST_API_H_ +#endif // ASH_TEST_SHELF_TEST_API_H_ diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc index 5c16807..a0d8f19 100644 --- a/ash/test/test_session_state_delegate.cc +++ b/ash/test/test_session_state_delegate.cc @@ -85,7 +85,7 @@ void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) { if (!has_active_user) active_user_session_started_ = false; else - Shell::GetInstance()->ShowLauncher(); + Shell::GetInstance()->ShowShelf(); } void TestSessionStateDelegate::SetActiveUserSessionStarted( @@ -93,7 +93,7 @@ void TestSessionStateDelegate::SetActiveUserSessionStarted( active_user_session_started_ = active_user_session_started; if (active_user_session_started) { has_active_user_ = true; - Shell::GetInstance()->CreateLauncher(); + Shell::GetInstance()->CreateShelf(); Shell::GetInstance()->UpdateAfterLoginStatusChange( user::LOGGED_IN_USER); } diff --git a/ash/test/test_shelf_delegate.cc b/ash/test/test_shelf_delegate.cc index 1a62cff..97623ca 100644 --- a/ash/test/test_shelf_delegate.cc +++ b/ash/test/test_shelf_delegate.cc @@ -71,15 +71,15 @@ void TestShelfDelegate::OnWindowHierarchyChanging( const HierarchyChangeParams& params) { // The window may be legitimately reparented while staying open if it moves // to another display or container. If the window does not have a new parent - // then remove the launcher item. + // then remove the shelf item. if (!params.new_parent) RemoveLauncherItemForWindow(params.target); } -void TestShelfDelegate::OnLauncherCreated(Launcher* launcher) { +void TestShelfDelegate::OnShelfCreated(Shelf* shelf) { } -void TestShelfDelegate::OnLauncherDestroyed(Launcher* launcher) { +void TestShelfDelegate::OnShelfDestroyed(Shelf* shelf) { } LauncherID TestShelfDelegate::GetLauncherIDForAppID(const std::string& app_id) { diff --git a/ash/test/test_shelf_delegate.h b/ash/test/test_shelf_delegate.h index e475453..263d1aa 100644 --- a/ash/test/test_shelf_delegate.h +++ b/ash/test/test_shelf_delegate.h @@ -37,8 +37,8 @@ class TestShelfDelegate : public ShelfDelegate, public aura::WindowObserver { const HierarchyChangeParams& params) OVERRIDE; // ShelfDelegate implementation. - virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE; - virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE; + virtual void OnShelfCreated(Shelf* shelf) OVERRIDE; + virtual void OnShelfDestroyed(Shelf* shelf) OVERRIDE; virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE; virtual const std::string& GetAppIDForLauncherID(LauncherID id) OVERRIDE; virtual void PinAppWithID(const std::string& app_id) OVERRIDE; diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 2f0ce04..d8c161d 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -5,9 +5,9 @@ #include "ash/wm/app_list_controller.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_delegate.h" @@ -33,7 +33,7 @@ namespace { // Duration for show/hide animation in milliseconds. const int kAnimationDurationMs = 200; -// Offset in pixels to animation away/towards the launcher. +// Offset in pixels to animation away/towards the shelf. const int kAnimationOffset = 8; // The maximum shift in pixels when over-scroll happens. @@ -51,7 +51,7 @@ ui::Layer* GetLayer(views::Widget* widget) { // Gets arrow location based on shelf alignment. views::BubbleBorder::Arrow GetBubbleArrow(aura::Window* window) { DCHECK(Shell::HasInstance()); - return ShelfLayoutManager::ForLauncher(window)-> + return ShelfLayoutManager::ForShelf(window)-> SelectValueForShelfAlignment( views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, @@ -167,7 +167,7 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { aura::Window* container = GetRootWindowController(root_window)-> GetContainer(kShellWindowId_AppListContainer); if (ash::switches::UseAlternateShelfLayout()) { - gfx::Rect applist_button_bounds = Launcher::ForWindow(container)-> + gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> GetAppListButtonView()->GetBoundsInScreen(); // We need the location of the button within the local screen. applist_button_bounds = ash::ScreenAsh::ConvertRectFromScreen( @@ -176,9 +176,9 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { view->InitAsBubbleAttachedToAnchor( container, pagination_model_.get(), - Launcher::ForWindow(container)->GetAppListButtonView(), + Shelf::ForWindow(container)->GetAppListButtonView(), GetAnchorPositionOffsetToShelf(applist_button_bounds, - Launcher::ForWindow(container)->GetAppListButtonView()-> + Shelf::ForWindow(container)->GetAppListButtonView()-> GetWidget()), GetBubbleArrow(container), true /* border_accepts_events */); @@ -187,7 +187,7 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { view->InitAsBubbleAttachedToAnchor( container, pagination_model_.get(), - Launcher::ForWindow(container)->GetAppListButtonView(), + Shelf::ForWindow(container)->GetAppListButtonView(), gfx::Vector2d(), GetBubbleArrow(container), true /* border_accepts_events */); @@ -198,11 +198,11 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { if (!CommandLine::ForCurrentProcess()->HasSwitch( ash::switches::kAshDisableDragAndDropAppListToLauncher)) { SetDragAndDropHostOfCurrentAppList( - Launcher::ForWindow(window)->GetDragAndDropHostForAppList()); + Shelf::ForWindow(window)->GetDragAndDropHostForAppList()); } } // Update applist button status when app list visibility is changed. - Launcher::ForWindow(window)->GetAppListButtonView()->SchedulePaint(); + Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint(); } bool AppListController::IsVisible() const { @@ -230,7 +230,7 @@ void AppListController::SetView(app_list::AppListView* view) { views::Widget* widget = view_->GetWidget(); widget->AddObserver(this); Shell::GetInstance()->AddPreTargetHandler(this); - Launcher::ForWindow(widget->GetNativeWindow())->AddIconObserver(this); + Shelf::ForWindow(widget->GetNativeWindow())->AddIconObserver(this); widget->GetNativeView()->GetRootWindow()->AddObserver(this); aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this); @@ -245,7 +245,7 @@ void AppListController::ResetView() { widget->RemoveObserver(this); GetLayer(widget)->GetAnimator()->RemoveObserver(this); Shell::GetInstance()->RemovePreTargetHandler(this); - Launcher::ForWindow(widget->GetNativeWindow())->RemoveIconObserver(this); + Shelf::ForWindow(widget->GetNativeWindow())->RemoveIconObserver(this); widget->GetNativeView()->GetRootWindow()->RemoveObserver(this); aura::client::GetFocusClient(widget->GetNativeView())->RemoveObserver(this); view_ = NULL; diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index 9f4b9ed..f58c61f 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -289,7 +289,7 @@ TEST_F(BaseLayoutManagerTest, NotResizeWhenScreenIsLocked) { window->Show(); internal::ShelfLayoutManager* shelf = - internal::ShelfLayoutManager::ForLauncher(window.get()); + internal::ShelfLayoutManager::ForShelf(window.get()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); window->SetBounds(ScreenAsh::GetMaximizedWindowBoundsInParent(window.get())); diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc index d59a14df..d540b58 100644 --- a/ash/wm/dock/docked_window_layout_manager.cc +++ b/ash/wm/dock/docked_window_layout_manager.cc @@ -5,8 +5,8 @@ #include "ash/wm/dock/docked_window_layout_manager.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" @@ -98,28 +98,35 @@ class DockedBackgroundWidget : public views::Widget, // views::Widget: virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE { - const gfx::ImageSkia& launcher_background( + const gfx::ImageSkia& shelf_background( alignment_ == DOCKED_ALIGNMENT_LEFT ? - launcher_background_left_ : launcher_background_right_); + shelf_background_left_ : shelf_background_right_); gfx::Rect rect = gfx::Rect(GetWindowBoundsInScreen().size()); SkPaint paint; paint.setAlpha(alpha_); + canvas->DrawImageInt(shelf_background, + 0, + 0, + shelf_background.width(), + shelf_background.height(), + alignment_ == DOCKED_ALIGNMENT_LEFT + ? rect.width() - shelf_background.width() + : 0, + 0, + shelf_background.width(), + rect.height(), + false, + paint); canvas->DrawImageInt( - launcher_background, - 0, 0, launcher_background.width(), launcher_background.height(), - alignment_ == DOCKED_ALIGNMENT_LEFT ? - rect.width() - launcher_background.width() : 0, 0, - launcher_background.width(), rect.height(), - false, - paint); - canvas->DrawImageInt( - launcher_background, - alignment_ == DOCKED_ALIGNMENT_LEFT ? - 0 : launcher_background.width() - 1, 0, - 1, launcher_background.height(), - alignment_ == DOCKED_ALIGNMENT_LEFT ? - 0 : launcher_background.width(), 0, - rect.width() - launcher_background.width(), rect.height(), + shelf_background, + alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width() - 1, + 0, + 1, + shelf_background.height(), + alignment_ == DOCKED_ALIGNMENT_LEFT ? 0 : shelf_background.width(), + 0, + rect.width() - shelf_background.width(), + rect.height(), false, paint); } @@ -150,12 +157,12 @@ class DockedBackgroundWidget : public views::Widget, Hide(); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - gfx::ImageSkia launcher_background = + gfx::ImageSkia shelf_background = *rb.GetImageSkiaNamed(IDR_AURA_LAUNCHER_BACKGROUND); - launcher_background_left_ = gfx::ImageSkiaOperations::CreateRotatedImage( - launcher_background, SkBitmapOperations::ROTATION_90_CW); - launcher_background_right_ = gfx::ImageSkiaOperations::CreateRotatedImage( - launcher_background, SkBitmapOperations::ROTATION_270_CW); + shelf_background_left_ = gfx::ImageSkiaOperations::CreateRotatedImage( + shelf_background, SkBitmapOperations::ROTATION_90_CW); + shelf_background_right_ = gfx::ImageSkiaOperations::CreateRotatedImage( + shelf_background, SkBitmapOperations::ROTATION_270_CW); } DockedAlignment alignment_; @@ -170,8 +177,8 @@ class DockedBackgroundWidget : public views::Widget, ui::Layer opaque_background_; // Backgrounds created from shelf background by 90 or 270 degree rotation. - gfx::ImageSkia launcher_background_left_; - gfx::ImageSkia launcher_background_right_; + gfx::ImageSkia shelf_background_left_; + gfx::ImageSkia shelf_background_right_; DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); }; @@ -320,21 +327,21 @@ struct CompareWindowPos { } // namespace //////////////////////////////////////////////////////////////////////////////// -// A class that observes launcher shelf for bounds changes. +// A class that observes shelf for bounds changes. class DockedWindowLayoutManager::ShelfWindowObserver : public WindowObserver { public: explicit ShelfWindowObserver( DockedWindowLayoutManager* docked_layout_manager) : docked_layout_manager_(docked_layout_manager) { - DCHECK(docked_layout_manager_->launcher()->shelf_widget()); - docked_layout_manager_->launcher()->shelf_widget()->GetNativeView() + DCHECK(docked_layout_manager_->shelf()->shelf_widget()); + docked_layout_manager_->shelf()->shelf_widget()->GetNativeView() ->AddObserver(this); } virtual ~ShelfWindowObserver() { - if (docked_layout_manager_->launcher() && - docked_layout_manager_->launcher()->shelf_widget()) - docked_layout_manager_->launcher()->shelf_widget()->GetNativeView() + if (docked_layout_manager_->shelf() && + docked_layout_manager_->shelf()->shelf_widget()) + docked_layout_manager_->shelf()->shelf_widget()->GetNativeView() ->RemoveObserver(this); } @@ -367,7 +374,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager( dragged_window_(NULL), is_dragged_window_docked_(false), is_dragged_from_dock_(false), - launcher_(NULL), + shelf_(NULL), workspace_controller_(workspace_controller), in_fullscreen_(workspace_controller_->GetWindowState() == WORKSPACE_WINDOW_STATE_FULL_SCREEN), @@ -387,13 +394,13 @@ DockedWindowLayoutManager::~DockedWindowLayoutManager() { } void DockedWindowLayoutManager::Shutdown() { - if (launcher_ && launcher_->shelf_widget()) { - ShelfLayoutManager* shelf_layout_manager = ShelfLayoutManager::ForLauncher( - launcher_->shelf_widget()->GetNativeWindow()); + if (shelf_ && shelf_->shelf_widget()) { + ShelfLayoutManager* shelf_layout_manager = ShelfLayoutManager::ForShelf( + shelf_->shelf_widget()->GetNativeWindow()); shelf_layout_manager->RemoveObserver(this); shelf_observer_.reset(); } - launcher_ = NULL; + shelf_ = NULL; for (size_t i = 0; i < dock_container_->children().size(); ++i) { aura::Window* child = dock_container_->children()[i]; child->RemoveObserver(this); @@ -470,12 +477,12 @@ void DockedWindowLayoutManager::FinishDragging(DockedAction action, RecordUmaAction(action, source); } -void DockedWindowLayoutManager::SetLauncher(ash::Launcher* launcher) { - DCHECK(!launcher_); - launcher_ = launcher; - if (launcher_->shelf_widget()) { - ShelfLayoutManager* shelf_layout_manager = ShelfLayoutManager::ForLauncher( - launcher_->shelf_widget()->GetNativeWindow()); +void DockedWindowLayoutManager::SetShelf(Shelf* shelf) { + DCHECK(!shelf_); + shelf_ = shelf; + if (shelf_->shelf_widget()) { + ShelfLayoutManager* shelf_layout_manager = ShelfLayoutManager::ForShelf( + shelf_->shelf_widget()->GetNativeWindow()); shelf_layout_manager->AddObserver(this); shelf_observer_.reset(new ShelfWindowObserver(this)); } @@ -552,10 +559,10 @@ bool DockedWindowLayoutManager::CanDockWindow(aura::Window* window, (edge == SNAP_RIGHT && alignment == DOCKED_ALIGNMENT_LEFT)) { return false; } - // Do not allow docking on the same side as launcher shelf. + // Do not allow docking on the same side as shelf. ShelfAlignment shelf_alignment = SHELF_ALIGNMENT_BOTTOM; - if (launcher_) - shelf_alignment = launcher_->alignment(); + if (shelf_) + shelf_alignment = shelf_->alignment(); if ((edge == SNAP_LEFT && shelf_alignment == SHELF_ALIGNMENT_LEFT) || (edge == SNAP_RIGHT && shelf_alignment == SHELF_ALIGNMENT_RIGHT)) { return false; @@ -636,7 +643,7 @@ void DockedWindowLayoutManager::SetChildBounds( SetChildBoundsDirect(child, requested_bounds); if (IsPopupOrTransient(child)) return; - ShelfLayoutManager* shelf_layout = internal::ShelfLayoutManager::ForLauncher( + ShelfLayoutManager* shelf_layout = internal::ShelfLayoutManager::ForShelf( dock_container_); if (shelf_layout) shelf_layout->UpdateVisibilityState(); @@ -688,15 +695,15 @@ void DockedWindowLayoutManager::OnShelfAlignmentChanged( if (dock_container_->GetRootWindow() != root_window) return; - if (!launcher_ || !launcher_->shelf_widget()) + if (!shelf_ || !shelf_->shelf_widget()) return; if (alignment_ == DOCKED_ALIGNMENT_NONE) return; - // Do not allow launcher and dock on the same side. Switch side that + // Do not allow shelf and dock on the same side. Switch side that // the dock is attached to and move all dock windows to that new side. - ShelfAlignment shelf_alignment = launcher_->shelf_widget()->GetAlignment(); + ShelfAlignment shelf_alignment = shelf_->shelf_widget()->GetAlignment(); if (alignment_ == DOCKED_ALIGNMENT_LEFT && shelf_alignment == SHELF_ALIGNMENT_LEFT) { alignment_ = DOCKED_ALIGNMENT_RIGHT; diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h index 8894bed..d17e818 100644 --- a/ash/wm/dock/docked_window_layout_manager.h +++ b/ash/wm/dock/docked_window_layout_manager.h @@ -38,7 +38,7 @@ class Widget; } namespace ash { -class Launcher; +class Shelf; namespace internal { class DockedBackgroundWidget; @@ -110,8 +110,8 @@ class ASH_EXPORT DockedWindowLayoutManager // Records |action| by |source| in UMA. void FinishDragging(DockedAction action, DockedActionSource source); - ash::Launcher* launcher() { return launcher_; } - void SetLauncher(ash::Launcher* launcher); + Shelf* shelf() { return shelf_; } + void SetShelf(Shelf* shelf); // Calculates if a window is touching the screen edges and returns edge. DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const; @@ -120,7 +120,7 @@ class ASH_EXPORT DockedWindowLayoutManager DockedAlignment CalculateAlignment() const; // Returns true when a window can be docked. Windows cannot be docked at the - // edge used by the launcher shelf or the edge opposite from existing dock. + // edge used by the shelf or the edge opposite from existing dock. bool CanDockWindow(aura::Window* window, SnapType edge); aura::Window* dock_container() const { return dock_container_; } @@ -134,7 +134,7 @@ class ASH_EXPORT DockedWindowLayoutManager // Returns true if currently dragged window is docked at the screen edge. bool is_dragged_window_docked() const { return is_dragged_window_docked_; } - // Updates docked layout when launcher shelf bounds change. + // Updates docked layout when shelf bounds change. void OnShelfBoundsChanged(); // aura::LayoutManager: @@ -264,8 +264,8 @@ class ASH_EXPORT DockedWindowLayoutManager // that was previously established in Relayout. This allows easier reordering. bool is_dragged_from_dock_; - // The launcher to respond to launcher alignment changes. - Launcher* launcher_; + // The shelf to respond to alignment changes. + Shelf* shelf_; // Workspace controller that can be checked for fullscreen mode. WorkspaceController* workspace_controller_; @@ -291,7 +291,7 @@ class ASH_EXPORT DockedWindowLayoutManager // Used in UMA metrics. base::Time last_action_time_; - // Observes launcher shelf for bounds changes. + // Observes shelf for bounds changes. scoped_ptr<ShelfWindowObserver> shelf_observer_; // Widget used to paint a background for the docked area. diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc index a1284b9..8ac74db 100644 --- a/ash/wm/dock/docked_window_layout_manager_unittest.cc +++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc @@ -5,9 +5,9 @@ #include "ash/wm/dock/docked_window_layout_manager.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" @@ -15,7 +15,7 @@ #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" @@ -53,7 +53,7 @@ class DockedWindowLayoutManagerTest ASSERT_TRUE(test::TestShelfDelegate::instance()); shelf_view_test_.reset(new test::ShelfViewTestAPI( - test::LauncherTestAPI(Launcher::ForPrimaryDisplay()).shelf_view())); + test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).shelf_view())); shelf_view_test_->SetAnimationDuration(1); } diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc index 2b589d2..7cf2081 100644 --- a/ash/wm/dock/docked_window_resizer.cc +++ b/ash/wm/dock/docked_window_resizer.cc @@ -5,9 +5,9 @@ #include "ash/wm/dock/docked_window_resizer.h" #include "ash/display/display_controller.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc index 6b60403..5daad1b 100644 --- a/ash/wm/dock/docked_window_resizer_unittest.cc +++ b/ash/wm/dock/docked_window_resizer_unittest.cc @@ -5,9 +5,9 @@ #include "ash/wm/dock/docked_window_resizer.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" @@ -1271,7 +1271,7 @@ TEST_P(DockedWindowResizerTest, DragToShelf) { EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); // Drag down almost to shelf. A panel will snap, a regular window won't. - ShelfWidget* shelf = Launcher::ForPrimaryDisplay()->shelf_widget(); + ShelfWidget* shelf = Shelf::ForPrimaryDisplay()->shelf_widget(); const int shelf_y = shelf->GetWindowBoundsInScreen().y(); const int kDistanceFromShelf = 10; ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); diff --git a/ash/wm/gestures/system_pinch_handler.cc b/ash/wm/gestures/system_pinch_handler.cc index 2c06616..83511a6 100644 --- a/ash/wm/gestures/system_pinch_handler.cc +++ b/ash/wm/gestures/system_pinch_handler.cc @@ -4,8 +4,8 @@ #include "ash/wm/gestures/system_pinch_handler.h" -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/wm/window_animations.h" diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index e36155a..86c0742 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" @@ -108,7 +108,7 @@ class WindowSelectorTest : public test::AshTestBase { ASSERT_TRUE(test::TestShelfDelegate::instance()); shelf_view_test_.reset(new test::ShelfViewTestAPI( - test::LauncherTestAPI(Launcher::ForPrimaryDisplay()).shelf_view())); + test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).shelf_view())); shelf_view_test_->SetAnimationDuration(1); } diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc index 20678d3..1338133 100644 --- a/ash/wm/panels/panel_layout_manager.cc +++ b/ash/wm/panels/panel_layout_manager.cc @@ -7,8 +7,8 @@ #include <algorithm> #include <map> -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" @@ -49,7 +49,7 @@ const float kMaxWidthFactor = .50f; const int kPanelSlideDurationMilliseconds = 50; const int kCalloutFadeDurationMilliseconds = 50; -// Offset used when sliding panel in/out of the launcher. Used for minimizing, +// Offset used when sliding panel in/out of the shelf. Used for minimizing, // restoring and the initial showing of a panel. const int kPanelSlideInOffset = 20; @@ -259,7 +259,7 @@ PanelLayoutManager::PanelLayoutManager(aura::Window* panel_container) in_add_window_(false), in_layout_(false), dragged_panel_(NULL), - launcher_(NULL), + shelf_(NULL), shelf_layout_manager_(NULL), last_active_panel_(NULL), weak_factory_(this) { @@ -283,9 +283,9 @@ void PanelLayoutManager::Shutdown() { delete iter->callout_widget; } panel_windows_.clear(); - if (launcher_) - launcher_->RemoveIconObserver(this); - launcher_ = NULL; + if (shelf_) + shelf_->RemoveIconObserver(this); + shelf_ = NULL; aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> RemoveObserver(this); Shell::GetInstance()->display_controller()->RemoveObserver(this); @@ -303,14 +303,14 @@ void PanelLayoutManager::FinishDragging() { Relayout(); } -void PanelLayoutManager::SetLauncher(ash::Launcher* launcher) { - DCHECK(!launcher_); +void PanelLayoutManager::SetShelf(Shelf* shelf) { + DCHECK(!shelf_); DCHECK(!shelf_layout_manager_); - launcher_ = launcher; - launcher_->AddIconObserver(this); - if (launcher_->shelf_widget()) { - shelf_layout_manager_ = ash::internal::ShelfLayoutManager::ForLauncher( - launcher_->shelf_widget()->GetNativeWindow()); + shelf_ = shelf; + shelf_->AddIconObserver(this); + if (shelf_->shelf_widget()) { + shelf_layout_manager_ = ash::internal::ShelfLayoutManager::ForShelf( + shelf_->shelf_widget()->GetNativeWindow()); WillChangeVisibilityState(shelf_layout_manager_->visibility_state()); shelf_layout_manager_->AddObserver(this); } @@ -555,7 +555,7 @@ void PanelLayoutManager::MinimizePanel(aura::Window* panel) { base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds)); gfx::Rect bounds(panel->bounds()); bounds.Offset(GetSlideInAnimationOffset( - launcher_->shelf_widget()->GetAlignment())); + shelf_->shelf_widget()->GetAlignment())); SetChildBoundsDirect(panel, bounds); panel->Hide(); PanelList::iterator found = @@ -576,18 +576,18 @@ void PanelLayoutManager::RestorePanel(aura::Window* panel) { } void PanelLayoutManager::Relayout() { - if (!launcher_ || !launcher_->shelf_widget()) + if (!shelf_ || !shelf_->shelf_widget()) return; if (in_layout_) return; base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true); - ShelfAlignment alignment = launcher_->shelf_widget()->GetAlignment(); + ShelfAlignment alignment = shelf_->shelf_widget()->GetAlignment(); bool horizontal = alignment == SHELF_ALIGNMENT_TOP || alignment == SHELF_ALIGNMENT_BOTTOM; - gfx::Rect launcher_bounds = ash::ScreenAsh::ConvertRectFromScreen( - panel_container_, launcher_->shelf_widget()->GetWindowBoundsInScreen()); + gfx::Rect shelf_bounds = ash::ScreenAsh::ConvertRectFromScreen( + panel_container_, shelf_->shelf_widget()->GetWindowBoundsInScreen()); int panel_start_bounds = kPanelIdealSpacing; int panel_end_bounds = horizontal ? panel_container_->bounds().width() - kPanelIdealSpacing : @@ -600,10 +600,10 @@ void PanelLayoutManager::Relayout() { iter->callout_widget->SetAlignment(alignment); // Consider the dragged panel as part of the layout as long as it is - // touching the launcher. + // touching the shelf. if (!panel->IsVisible() || (panel == dragged_panel_ && - !BoundsAdjacent(panel->bounds(), launcher_bounds))) { + !BoundsAdjacent(panel->bounds(), shelf_bounds))) { continue; } @@ -615,12 +615,11 @@ void PanelLayoutManager::Relayout() { continue; } - gfx::Rect icon_bounds = - launcher_->GetScreenBoundsOfItemIconForWindow(panel); + gfx::Rect icon_bounds = shelf_->GetScreenBoundsOfItemIconForWindow(panel); // If both the icon width and height are 0 then there is no icon in the - // launcher. If the launcher is hidden, one of the height or width will be - // 0 but the position in the launcher and major dimension is still reported + // shelf. If the shelf is hidden, one of the height or width will be + // 0 but the position in the shelf and major dimension is still reported // correctly and the panel can be aligned above where the hidden icon is. if (icon_bounds.width() == 0 && icon_bounds.height() == 0) continue; @@ -679,19 +678,19 @@ void PanelLayoutManager::Relayout() { gfx::Rect bounds = visible_panels[i].window->GetTargetBounds(); switch (alignment) { case SHELF_ALIGNMENT_BOTTOM: - bounds.set_y(launcher_bounds.y() - bounds.height()); + bounds.set_y(shelf_bounds.y() - bounds.height()); break; case SHELF_ALIGNMENT_LEFT: - bounds.set_x(launcher_bounds.right()); + bounds.set_x(shelf_bounds.right()); break; case SHELF_ALIGNMENT_RIGHT: - bounds.set_x(launcher_bounds.x() - bounds.width()); + bounds.set_x(shelf_bounds.x() - bounds.width()); break; case SHELF_ALIGNMENT_TOP: - bounds.set_y(launcher_bounds.bottom()); + bounds.set_y(shelf_bounds.bottom()); break; } - bool on_launcher = visible_panels[i].window->GetTargetBounds() == bounds; + bool on_shelf = visible_panels[i].window->GetTargetBounds() == bounds; if (horizontal) { bounds.set_x(visible_panels[i].major_pos - @@ -703,15 +702,15 @@ void PanelLayoutManager::Relayout() { ui::Layer* layer = visible_panels[i].window->layer(); if (slide_in) { - // New windows shift up from the launcher into position. + // New windows shift up from the shelf into position. gfx::Rect initial_bounds(bounds); initial_bounds.Offset(GetSlideInAnimationOffset(alignment)); SetChildBoundsDirect(visible_panels[i].window, initial_bounds); - // Set on launcher so that the panel animates into its target position. - on_launcher = true; + // Set on shelf so that the panel animates into its target position. + on_shelf = true; } - if (on_launcher) { + if (on_shelf) { ui::ScopedLayerAnimationSettings panel_slide_settings( layer->GetAnimator()); panel_slide_settings.SetPreemptionStrategy( @@ -722,7 +721,7 @@ void PanelLayoutManager::Relayout() { if (slide_in) layer->SetOpacity(1); } else { - // If the launcher moved don't animate, move immediately to the new + // If the shelf moved don't animate, move immediately to the new // target location. SetChildBoundsDirect(visible_panels[i].window, bounds); } @@ -739,7 +738,7 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) { active_panel = last_active_panel_; } - ShelfAlignment alignment = launcher_->alignment(); + ShelfAlignment alignment = shelf_->alignment(); bool horizontal = alignment == SHELF_ALIGNMENT_TOP || alignment == SHELF_ALIGNMENT_BOTTOM; @@ -750,7 +749,7 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) { // // We use the middle of each panel to figure out how to stack the panels. This // allows us to update the stacking when a panel is being dragged around by - // the titlebar--even though it doesn't update the launcher icon positions, we + // the titlebar--even though it doesn't update the shelf icon positions, we // still want the visual effect. std::map<int, aura::Window*> window_ordering; for (PanelList::const_iterator it = panel_windows_.begin(); @@ -787,7 +786,7 @@ void PanelLayoutManager::UpdateStacking(aura::Window* active_panel) { } void PanelLayoutManager::UpdateCallouts() { - ShelfAlignment alignment = launcher_->alignment(); + ShelfAlignment alignment = shelf_->alignment(); bool horizontal = alignment == SHELF_ALIGNMENT_TOP || alignment == SHELF_ALIGNMENT_BOTTOM; @@ -799,8 +798,7 @@ void PanelLayoutManager::UpdateCallouts() { gfx::Rect current_bounds = panel->GetBoundsInScreen(); gfx::Rect bounds = ScreenAsh::ConvertRectToScreen(panel->parent(), panel->GetTargetBounds()); - gfx::Rect icon_bounds = - launcher_->GetScreenBoundsOfItemIconForWindow(panel); + gfx::Rect icon_bounds = shelf_->GetScreenBoundsOfItemIconForWindow(panel); if (icon_bounds.IsEmpty() || !panel->layer()->GetTargetVisibility() || panel == dragged_panel_) { callout_widget->Hide(); diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h index 042d285..71d22d2 100644 --- a/ash/wm/panels/panel_layout_manager.h +++ b/ash/wm/panels/panel_layout_manager.h @@ -37,7 +37,7 @@ class Widget; } namespace ash { -class Launcher; +class Shelf; namespace internal { class PanelCalloutWidget; @@ -77,8 +77,8 @@ class ASH_EXPORT PanelLayoutManager // Returns the callout widget (arrow) for |panel|. views::Widget* GetCalloutWidgetForPanel(aura::Window* panel); - ash::Launcher* launcher() { return launcher_; } - void SetLauncher(ash::Launcher* launcher); + Shelf* shelf() { return shelf_; } + void SetShelf(Shelf* shelf); // Overridden from aura::LayoutManager: virtual void OnWindowResized() OVERRIDE; @@ -172,8 +172,8 @@ class ASH_EXPORT PanelLayoutManager PanelList panel_windows_; // The panel being dragged. aura::Window* dragged_panel_; - // The launcher we are observing for launcher icon changes. - Launcher* launcher_; + // The shelf we are observing for shelf icon changes. + Shelf* shelf_; // The shelf layout manager being observed for visibility changes. ShelfLayoutManager* shelf_layout_manager_; diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc index e0ec0c5..e573f0c 100644 --- a/ash/wm/panels/panel_layout_manager_unittest.cc +++ b/ash/wm/panels/panel_layout_manager_unittest.cc @@ -5,9 +5,9 @@ #include "ash/wm/panels/panel_layout_manager.h" #include "ash/ash_switches.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_button.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_model.h" @@ -18,7 +18,7 @@ #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" -#include "ash/test/launcher_test_api.h" +#include "ash/test/shelf_test_api.h" #include "ash/test/shelf_view_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_shelf_delegate.h" @@ -53,7 +53,7 @@ class PanelLayoutManagerTest : public test::AshTestBase { ASSERT_TRUE(test::TestShelfDelegate::instance()); shelf_view_test_.reset(new test::ShelfViewTestAPI( - GetShelfView(Launcher::ForPrimaryDisplay()))); + GetShelfView(Shelf::ForPrimaryDisplay()))); shelf_view_test_->SetAnimationDuration(1); } @@ -121,42 +121,40 @@ class PanelLayoutManagerTest : public test::AshTestBase { // Waits until all shelf view animations are done. shelf_view_test()->RunMessageLoopUntilAnimationsDone(); - Launcher* launcher = - RootWindowController::ForLauncher(panel)->shelf()->launcher(); - gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); + Shelf* shelf = RootWindowController::ForShelf(panel)->shelf()->shelf(); + gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel); ASSERT_FALSE(icon_bounds.width() == 0 && icon_bounds.height() == 0); gfx::Rect window_bounds = panel->GetBoundsInScreen(); ASSERT_LT(icon_bounds.width(), window_bounds.width()); ASSERT_LT(icon_bounds.height(), window_bounds.height()); - gfx::Rect launcher_bounds = launcher->shelf_widget()-> - GetWindowBoundsInScreen(); + gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); ShelfAlignment alignment = GetAlignment(panel->GetRootWindow()); if (IsHorizontal(alignment)) { // The horizontal bounds of the panel window should contain the bounds of - // the launcher icon. + // the shelf icon. EXPECT_LE(window_bounds.x(), icon_bounds.x()); EXPECT_GE(window_bounds.right(), icon_bounds.right()); } else { // The vertical bounds of the panel window should contain the bounds of - // the launcher icon. + // the shelf icon. EXPECT_LE(window_bounds.y(), icon_bounds.y()); EXPECT_GE(window_bounds.bottom(), icon_bounds.bottom()); } switch (alignment) { case SHELF_ALIGNMENT_BOTTOM: - EXPECT_EQ(launcher_bounds.y(), window_bounds.bottom()); + EXPECT_EQ(shelf_bounds.y(), window_bounds.bottom()); break; case SHELF_ALIGNMENT_LEFT: - EXPECT_EQ(launcher_bounds.right(), window_bounds.x()); + EXPECT_EQ(shelf_bounds.right(), window_bounds.x()); break; case SHELF_ALIGNMENT_RIGHT: - EXPECT_EQ(launcher_bounds.x(), window_bounds.right()); + EXPECT_EQ(shelf_bounds.x(), window_bounds.right()); break; case SHELF_ALIGNMENT_TOP: - EXPECT_EQ(launcher_bounds.bottom(), window_bounds.y()); + EXPECT_EQ(shelf_bounds.bottom(), window_bounds.y()); break; } } @@ -166,9 +164,8 @@ class PanelLayoutManagerTest : public test::AshTestBase { base::RunLoop().RunUntilIdle(); views::Widget* widget = GetCalloutWidgetForPanel(panel); - Launcher* launcher = - RootWindowController::ForLauncher(panel)->shelf()->launcher(); - gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); + Shelf* shelf = RootWindowController::ForShelf(panel)->shelf()->shelf(); + gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel); ASSERT_FALSE(icon_bounds.IsEmpty()); gfx::Rect panel_bounds = panel->GetBoundsInScreen(); @@ -213,8 +210,8 @@ class PanelLayoutManagerTest : public test::AshTestBase { return shelf_view_test_.get(); } - // Clicks the launcher items on |shelf_view| that is - /// associated with given |window|. + // Clicks the shelf items on |shelf_view| that is associated with given + // |window|. void ClickLauncherItemForWindow(ShelfView* shelf_view, aura::Window* window) { test::ShelfViewTestAPI test_api(shelf_view); @@ -247,7 +244,7 @@ class PanelLayoutManagerTest : public test::AshTestBase { RootWindowController::ForWindow(window)->shelf()-> shelf_layout_manager(); shelf->SetAutoHideBehavior(behavior); - ShelfView* shelf_view = GetShelfView(Launcher::ForWindow(window)); + ShelfView* shelf_view = GetShelfView(Shelf::ForWindow(window)); test::ShelfViewTestAPI test_api(shelf_view); test_api.RunMessageLoopUntilAnimationsDone(); } @@ -260,8 +257,8 @@ class PanelLayoutManagerTest : public test::AshTestBase { shelf->SetState(visibility_state); } - internal::ShelfView* GetShelfView(Launcher* launcher) { - return test::LauncherTestAPI(launcher).shelf_view(); + internal::ShelfView* GetShelfView(Shelf* shelf) { + return test::ShelfTestAPI(shelf).shelf_view(); } private: @@ -303,7 +300,7 @@ class PanelLayoutManagerTextDirectionTest DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTextDirectionTest); }; -// Tests that a created panel window is above the launcher icon in LTR and RTL. +// Tests that a created panel window is above the shelf icon in LTR and RTL. TEST_P(PanelLayoutManagerTextDirectionTest, AddOnePanel) { gfx::Rect bounds(0, 0, 201, 201); scoped_ptr<aura::Window> window(CreatePanelWindow(bounds)); @@ -313,7 +310,7 @@ TEST_P(PanelLayoutManagerTextDirectionTest, AddOnePanel) { } // Tests that a created panel window is successfully aligned over a hidden -// launcher icon. +// shelf icon. TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIcon) { gfx::Rect bounds(0, 0, 201, 201); SetShelfAutoHideBehavior(Shell::GetPrimaryRootWindow(), @@ -328,8 +325,8 @@ TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIconSecondDisplay) { if (!SupportsMultipleDisplays()) return; - // Keep the displays wide so that launchers have enough - // space for launcher buttons. + // Keep the displays wide so that shelves have enough space for shelves + // buttons. UpdateDisplay("400x400,600x400"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -395,7 +392,7 @@ TEST_F(PanelLayoutManagerTest, MultiplePanelStacking) { } TEST_F(PanelLayoutManagerTest, MultiplePanelStackingVertical) { - // set launcher shelf to be aligned on the right + // Set shelf to be aligned on the right. SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT); // Size panels in such a way that ordering them by X coordinate would cause @@ -544,9 +541,9 @@ TEST_F(PanelLayoutManagerTest, FanWindows) { int window_x1 = w1->GetBoundsInRootWindow().CenterPoint().x(); int window_x2 = w2->GetBoundsInRootWindow().CenterPoint().x(); int window_x3 = w3->GetBoundsInRootWindow().CenterPoint().x(); - Launcher* launcher = Launcher::ForPrimaryDisplay(); - int icon_x1 = launcher->GetScreenBoundsOfItemIconForWindow(w1.get()).x(); - int icon_x2 = launcher->GetScreenBoundsOfItemIconForWindow(w2.get()).x(); + Shelf* shelf = Shelf::ForPrimaryDisplay(); + int icon_x1 = shelf->GetScreenBoundsOfItemIconForWindow(w1.get()).x(); + int icon_x2 = shelf->GetScreenBoundsOfItemIconForWindow(w2.get()).x(); EXPECT_EQ(window_x2 - window_x1, window_x3 - window_x2); int spacing = window_x2 - window_x1; EXPECT_GT(spacing, icon_x2 - icon_x1); @@ -595,8 +592,8 @@ TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) { if (!SupportsMultipleDisplays()) return; - // Keep the displays wide so that launchers have enough - // space for launcher buttons. + // Keep the displays wide so that shelves have enough space for launcher + // buttons. UpdateDisplay("600x400,600x400"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -605,9 +602,9 @@ TEST_F(PanelLayoutManagerTest, PanelMoveBetweenMultipleDisplays) { scoped_ptr<aura::Window> p1_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); scoped_ptr<aura::Window> p2_d2(CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); - ShelfView* shelf_view_1st = GetShelfView(Launcher::ForPrimaryDisplay()); + ShelfView* shelf_view_1st = GetShelfView(Shelf::ForPrimaryDisplay()); ShelfView* shelf_view_2nd = - GetShelfView(Launcher::ForWindow(root_windows[1])); + GetShelfView(Shelf::ForWindow(root_windows[1])); EXPECT_EQ(root_windows[0], p1_d1->GetRootWindow()); EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); @@ -674,8 +671,8 @@ TEST_F(PanelLayoutManagerTest, PanelAttachPositionMultipleDisplays) { if (!SupportsMultipleDisplays()) return; - // Keep the displays wide so that launchers have enough space for launcher - // buttons. Use differently sized displays so the launcher is in a different + // Keep the displays wide so that shelves have enough space for shelf buttons. + // Use differently sized displays so the shelf is in a different // position on second display. UpdateDisplay("600x400,600x600"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc index 739544f..689f635 100644 --- a/ash/wm/panels/panel_window_resizer.cc +++ b/ash/wm/panels/panel_window_resizer.cc @@ -5,8 +5,8 @@ #include "ash/wm/panels/panel_window_resizer.h" #include "ash/display/display_controller.h" -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -149,9 +149,9 @@ bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, GetPanelLayoutManager(panel_container_); gfx::Rect launcher_bounds = ScreenAsh::ConvertRectFromScreen( GetTarget()->parent(), - panel_layout_manager->launcher()-> + panel_layout_manager->shelf()-> shelf_widget()->GetWindowBoundsInScreen()); - switch (panel_layout_manager->launcher()->alignment()) { + switch (panel_layout_manager->shelf()->alignment()) { case SHELF_ALIGNMENT_BOTTOM: if (bounds.bottom() >= (launcher_bounds.y() - kPanelSnapToLauncherDistance)) { @@ -233,7 +233,7 @@ void PanelWindowResizer::FinishDragging() { void PanelWindowResizer::UpdateLauncherPosition() { if (panel_container_) { - GetPanelLayoutManager(panel_container_)->launcher()-> + GetPanelLayoutManager(panel_container_)->shelf()-> UpdateIconPositionForWindow(GetTarget()); } } diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc index 6d0b927..4c70c83 100644 --- a/ash/wm/panels/panel_window_resizer_unittest.cc +++ b/ash/wm/panels/panel_window_resizer_unittest.cc @@ -4,8 +4,8 @@ #include "ash/wm/panels/panel_window_resizer.h" -#include "ash/launcher/launcher.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_model.h" #include "ash/shelf/shelf_types.h" diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 7a26277..a07953c 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -7,7 +7,7 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/ash_switches.h" #include "ash/display/display_manager.h" -#include "ash/launcher/launcher.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_model.h" #include "ash/shell.h" #include "ash/system/brightness_control_delegate.h" diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index 894e11b..71d73f3 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -9,8 +9,8 @@ #include <algorithm> #include <vector> -#include "ash/launcher/launcher.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" @@ -501,11 +501,11 @@ void SetTransformForScaleAnimation(ui::Layer* layer, } gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { - Launcher* launcher = Launcher::ForWindow(window); + Shelf* shelf = Shelf::ForWindow(window); // Shelf is created lazily and can be NULL. - if (!launcher) + if (!shelf) return gfx::Rect(); - gfx::Rect item_rect = launcher->GetScreenBoundsOfItemIconForWindow(window); + gfx::Rect item_rect = shelf->GetScreenBoundsOfItemIconForWindow(window); // The launcher item is visible and has an icon. if (!item_rect.IsEmpty()) @@ -519,10 +519,9 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { // bar. if (item_rect.width() != 0 || item_rect.height() != 0) { internal::ShelfLayoutManager* layout_manager = - internal::ShelfLayoutManager::ForLauncher(window); + internal::ShelfLayoutManager::ForShelf(window); if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { - gfx::Rect shelf_bounds = - launcher->shelf_widget()->GetWindowBoundsInScreen(); + gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); switch (layout_manager->GetAlignment()) { case SHELF_ALIGNMENT_BOTTOM: item_rect.set_y(shelf_bounds.y()); @@ -541,7 +540,7 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { } } - // Assume the launcher is overflowed, zoom off to the bottom right of the + // Assume the shelf is overflowed, zoom off to the bottom right of the // work area. gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |