summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 07:11:01 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 07:11:01 +0000
commit88d7112796be37d4e1feb0015cfe95c6f39f303c (patch)
treec623905eddba657b6075acb4644259e07b3ef696
parentfe217945ffdce156b66be335271301555704cdf8 (diff)
downloadchromium_src-88d7112796be37d4e1feb0015cfe95c6f39f303c.zip
chromium_src-88d7112796be37d4e1feb0015cfe95c6f39f303c.tar.gz
chromium_src-88d7112796be37d4e1feb0015cfe95c6f39f303c.tar.bz2
Remove Shell::shelf|status_area_widget|launcher and
updated all clients to use one on RootWindowController and/or Launcher::ForPrimaryDisplay/ForWindow. BUG=145978 Review URL: https://chromiumcodereview.appspot.com/11017079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162664 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/accelerators/accelerator_controller.cc15
-rw-r--r--ash/dip_unittest.cc2
-rw-r--r--ash/display/display_controller_unittest.cc4
-rw-r--r--ash/focus_cycler_unittest.cc16
-rw-r--r--ash/launcher/launcher.cc13
-rw-r--r--ash/launcher/launcher.h9
-rw-r--r--ash/launcher/launcher_tooltip_manager_unittest.cc17
-rw-r--r--ash/launcher/launcher_unittest.cc6
-rw-r--r--ash/launcher/launcher_view_unittest.cc5
-rw-r--r--ash/root_window_controller.cc9
-rw-r--r--ash/root_window_controller.h17
-rw-r--r--ash/screen_ash.cc4
-rw-r--r--ash/shell.cc36
-rw-r--r--ash/shell.h14
-rw-r--r--ash/shell/window_type_launcher.cc3
-rw-r--r--ash/shell/window_watcher.cc10
-rw-r--r--ash/shell_unittest.cc18
-rw-r--r--ash/system/ime/tray_ime.cc4
-rw-r--r--ash/system/status_area_widget.cc2
-rw-r--r--ash/system/tray/system_tray.cc4
-rw-r--r--ash/system/tray/system_tray_unittest.cc4
-rw-r--r--ash/system/tray/tray_background_view.cc6
-rw-r--r--ash/system/tray/tray_background_view.h3
-rw-r--r--ash/system/tray_update.cc8
-rw-r--r--ash/system/web_notification/web_notification_tray.cc4
-rw-r--r--ash/system/web_notification/web_notification_tray_unittest.cc4
-rw-r--r--ash/wm/app_list_controller.cc8
-rw-r--r--ash/wm/gestures/shelf_gesture_handler.cc4
-rw-r--r--ash/wm/gestures/system_pinch_handler.cc2
-rw-r--r--ash/wm/panel_layout_manager_unittest.cc5
-rw-r--r--ash/wm/shelf_layout_manager.cc83
-rw-r--r--ash/wm/shelf_layout_manager.h11
-rw-r--r--ash/wm/shelf_layout_manager_unittest.cc91
-rw-r--r--ash/wm/status_area_layout_manager.cc3
-rw-r--r--ash/wm/window_animations.cc6
-rw-r--r--ash/wm/workspace/frame_maximize_button.cc5
-rw-r--r--ash/wm/workspace/workspace_layout_manager2_unittest.cc4
-rw-r--r--ash/wm/workspace/workspace_manager2_unittest.cc38
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc15
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc13
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc7
-rw-r--r--chrome/browser/ui/ash/shelf_browsertest.cc6
-rw-r--r--chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc4
-rw-r--r--chrome/browser/ui/views/ash/balloon_view_ash.cc9
44 files changed, 318 insertions, 233 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index f4e8f26..08232a2 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -88,7 +88,7 @@ bool HandleCycleWindowMRU(WindowCycleController::Direction direction,
}
void HandleCycleWindowLinear(CycleDirection direction) {
- Shell::GetInstance()->launcher()->CycleWindowLinear(direction);
+ Launcher::ForPrimaryDisplay()->CycleWindowLinear(direction);
}
#if defined(OS_CHROMEOS)
@@ -602,8 +602,8 @@ bool AcceleratorController::PerformAction(int action,
HandleVolumeUp(accelerator);
break;
case FOCUS_LAUNCHER:
- if (shell->launcher())
- return shell->focus_cycler()->FocusWidget(shell->launcher()->widget());
+ return shell->focus_cycler()->FocusWidget(
+ Launcher::ForPrimaryDisplay()->widget());
break;
case FOCUS_NEXT_PANE:
return HandleRotatePaneFocus(Shell::FORWARD);
@@ -851,10 +851,9 @@ bool AcceleratorController::AcceleratorPressed(
}
void AcceleratorController::SwitchToWindow(int window) {
- const LauncherItems& items =
- Shell::GetInstance()->launcher()->model()->items();
- int item_count =
- Shell::GetInstance()->launcher()->model()->item_count();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
+ const LauncherItems& items = launcher->model()->items();
+ int item_count = launcher->model()->item_count();
int indexes_left = window >= 0 ? window : item_count;
int found_index = -1;
@@ -875,7 +874,7 @@ void AcceleratorController::SwitchToWindow(int window) {
(items[found_index].status == ash::STATUS_RUNNING ||
items[found_index].status == ash::STATUS_CLOSED)) {
// Then set this one as active.
- Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index);
+ launcher->ActivateLauncherItem(found_index);
}
}
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc
index 2a311d5..8ac0adb 100644
--- a/ash/dip_unittest.cc
+++ b/ash/dip_unittest.cc
@@ -63,7 +63,7 @@ TEST_F(DIPTest, MAYBE_WorkArea) {
// Sanity check if the workarea's inset hight is same as
// the launcher's height.
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
EXPECT_EQ(
display_2x.bounds().InsetsFrom(work_area).height(),
launcher->widget()->GetNativeView()->layer()->bounds().height());
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 28d7ad8..5d98027 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -205,7 +205,7 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
display_controller->GetRootWindowForDisplayId(secondary_display.id());
EXPECT_NE(primary_root, secondary_root);
aura::Window* launcher_window =
- Shell::GetInstance()->launcher()->widget()->GetNativeView();
+ Launcher::ForPrimaryDisplay()->widget()->GetNativeView();
EXPECT_TRUE(primary_root->Contains(launcher_window));
EXPECT_FALSE(secondary_root->Contains(launcher_window));
EXPECT_EQ(primary_display.id(),
@@ -277,7 +277,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) {
aura::RootWindow* secondary_root =
display_controller->GetRootWindowForDisplayId(secondary_display.id());
aura::Window* launcher_window =
- Shell::GetInstance()->launcher()->widget()->GetNativeView();
+ Launcher::ForPrimaryDisplay()->widget()->GetNativeView();
EXPECT_TRUE(primary_root->Contains(launcher_window));
EXPECT_FALSE(secondary_root->Contains(launcher_window));
EXPECT_NE(primary_root, secondary_root);
diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc
index 19166a0..f694f45 100644
--- a/ash/focus_cycler_unittest.cc
+++ b/ash/focus_cycler_unittest.cc
@@ -68,7 +68,7 @@ TEST_F(FocusCyclerTest, CycleFocusForward) {
focus_cycler.get());
// Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -103,7 +103,7 @@ TEST_F(FocusCyclerTest, CycleFocusBackward) {
focus_cycler.get());
// Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -138,7 +138,7 @@ TEST_F(FocusCyclerTest, CycleFocusForwardBackward) {
focus_cycler.get());
// Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -185,7 +185,7 @@ TEST_F(FocusCyclerTest, CycleFocusNoBrowser) {
focus_cycler.get());
// Add the launcher and focus it
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -222,7 +222,7 @@ class FocusCyclerLauncherTest : public AshTestBase {
AshTestBase::SetUp();
// Hide the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -231,7 +231,7 @@ class FocusCyclerLauncherTest : public AshTestBase {
virtual void TearDown() OVERRIDE {
// Show the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -255,7 +255,7 @@ TEST_F(FocusCyclerLauncherTest, CycleFocusForwardInvisible) {
focus_cycler.get());
// Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
@@ -286,7 +286,7 @@ TEST_F(FocusCyclerLauncherTest, CycleFocusBackwardInvisible) {
focus_cycler.get());
// Add the launcher
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
views::Widget* launcher_widget = launcher->widget();
ASSERT_TRUE(launcher_widget);
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index 338819a..da95159 100644
--- a/ash/launcher/launcher.cc
+++ b/ash/launcher/launcher.cc
@@ -12,12 +12,14 @@
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_navigator.h"
#include "ash/launcher/launcher_view.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_properties.h"
#include "grit/ash_resources.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/base/resource/resource_bundle.h"
@@ -238,6 +240,17 @@ Launcher::Launcher(aura::Window* window_container,
Launcher::~Launcher() {
}
+// static
+Launcher* Launcher::ForPrimaryDisplay() {
+ return internal::RootWindowController::ForLauncher(
+ Shell::GetPrimaryRootWindow())->launcher();
+}
+
+// static
+Launcher* Launcher::ForWindow(aura::Window* window) {
+ return internal::RootWindowController::ForLauncher(window)->launcher();
+}
+
void Launcher::SetFocusCycler(internal::FocusCycler* focus_cycler) {
delegate_view_->set_focus_cycler(focus_cycler);
focus_cycler->AddWidget(widget_.get());
diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h
index 452730f3..64a6a47 100644
--- a/ash/launcher/launcher.h
+++ b/ash/launcher/launcher.h
@@ -44,6 +44,15 @@ class ASH_EXPORT Launcher {
internal::ShelfLayoutManager* shelf_layout_manager);
virtual ~Launcher();
+ // Return the launcher for the primary display. NULL if no user is
+ // logged in yet.
+ static Launcher* 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);
+
// Sets the focus cycler. Also adds the launcher to the cycle.
void SetFocusCycler(internal::FocusCycler* focus_cycler);
internal::FocusCycler* GetFocusCycler();
diff --git a/ash/launcher/launcher_tooltip_manager_unittest.cc b/ash/launcher/launcher_tooltip_manager_unittest.cc
index 17f72da..8d63320 100644
--- a/ash/launcher/launcher_tooltip_manager_unittest.cc
+++ b/ash/launcher/launcher_tooltip_manager_unittest.cc
@@ -4,6 +4,8 @@
#include "ash/launcher/launcher_tooltip_manager.h"
+#include "ash/root_window_controller.h"
+#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_util.h"
@@ -26,11 +28,12 @@ class LauncherTooltipManagerTest : public AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
-
+ internal::RootWindowController* controller =
+ Shell::GetPrimaryRootWindowController();
tooltip_manager_.reset(new internal::LauncherTooltipManager(
SHELF_ALIGNMENT_BOTTOM,
- Shell::GetInstance()->shelf(),
- Shell::GetInstance()->launcher()->GetLauncherViewForTest()));
+ controller->shelf(),
+ controller->launcher()->GetLauncherViewForTest()));
}
virtual void TearDown() OVERRIDE {
@@ -96,8 +99,9 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsHidden) {
widget->Show();
// Once the shelf is hidden, the tooltip should be invisible.
- ASSERT_EQ(internal::ShelfLayoutManager::HIDDEN,
- Shell::GetInstance()->shelf()->visibility_state());
+ ASSERT_EQ(
+ internal::ShelfLayoutManager::HIDDEN,
+ Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
EXPECT_FALSE(TooltipIsVisible());
// Do not show the view if the shelf is hidden.
@@ -113,7 +117,8 @@ TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsAutoHide) {
ShowImmediately();
ASSERT_TRUE(TooltipIsVisible());
- internal::ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ internal::ShelfLayoutManager* shelf =
+ Shell::GetPrimaryRootWindowController()->shelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
shelf->UpdateAutoHideState();
ASSERT_EQ(internal::ShelfLayoutManager::AUTO_HIDE_HIDDEN,
diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc
index 3e21807..cbf8229 100644
--- a/ash/launcher/launcher_unittest.cc
+++ b/ash/launcher/launcher_unittest.cc
@@ -22,7 +22,7 @@ namespace ash {
// Makes sure invoking SetStatusSize on the launcher changes the size of the
// LauncherView.
TEST_F(LauncherTest, SetStatusSize) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
LauncherView* launcher_view = launcher->GetLauncherViewForTest();
gfx::Size launcher_size =
@@ -35,7 +35,7 @@ TEST_F(LauncherTest, SetStatusSize) {
// Tests that the dimmer widget resizes itself as appropriate.
TEST_F(LauncherTest, DimmerSize) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
launcher->SetDimsShelf(true);
gfx::Size launcher_size =
@@ -54,7 +54,7 @@ TEST_F(LauncherTest, DimmerSize) {
// Confirm that launching a browser gets the appropriate state reflected in
// its button.
TEST_F(LauncherTest, OpenBrowser) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
LauncherView* launcher_view = launcher->GetLauncherViewForTest();
test::LauncherViewTestAPI test(launcher_view);
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index 27623b5..5296d8d 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -74,8 +74,7 @@ class LauncherViewIconObserverTest : public ash::test::AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
-
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
observer_.reset(new TestLauncherIconObserver(launcher));
launcher_view_test_.reset(new LauncherViewTestAPI(
@@ -125,7 +124,7 @@ TEST_F(LauncherViewIconObserverTest, AddRemove) {
}
TEST_F(LauncherViewIconObserverTest, BoundsChanged) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
gfx::Size launcher_size =
launcher->widget()->GetWindowBoundsInScreen().size();
int total_width = launcher_size.width() / 2;
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 8640429..800db1d 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -161,6 +161,15 @@ RootWindowController::~RootWindowController() {
root_window_.reset();
}
+// static
+internal::RootWindowController*
+RootWindowController::ForLauncher(aura::Window* window) {
+ if (Shell::IsLauncherPerDisplayEnabled())
+ return GetRootWindowController(window->GetRootWindow());
+ else
+ return Shell::GetPrimaryRootWindowController();
+}
+
void RootWindowController::Shutdown() {
CloseChildWindows();
if (Shell::GetActiveRootWindow() == root_window_.get()) {
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index 07f08b4..27132ac 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -48,6 +48,12 @@ class ASH_EXPORT RootWindowController {
explicit RootWindowController(aura::RootWindow* root_window);
~RootWindowController();
+ // Returns a RootWindowController that has a launcher for given
+ // |window|. This returns the RootWindowController for the |window|'s
+ // root window when multiple launcher mode is enabled, or the primary
+ // RootWindowController otherwise.
+ static RootWindowController* ForLauncher(aura::Window* window);
+
aura::RootWindow* root_window() { return root_window_.get(); }
RootWindowLayoutManager* root_window_layout() { return root_window_layout_; }
@@ -60,10 +66,9 @@ class ASH_EXPORT RootWindowController {
Launcher* launcher() { return launcher_.get(); }
- // TODO(sky): don't expose this!
- internal::ShelfLayoutManager* shelf() const { return shelf_; }
+ ShelfLayoutManager* shelf() const { return shelf_; }
- internal::StatusAreaWidget* status_area_widget() const {
+ StatusAreaWidget* status_area_widget() const {
return status_area_widget_;
}
@@ -131,15 +136,15 @@ private:
RootWindowLayoutManager* root_window_layout_;
// Widget containing system tray.
- internal::StatusAreaWidget* status_area_widget_;
+ StatusAreaWidget* status_area_widget_;
// The shelf for managing the launcher and the status widget.
// RootWindowController does not own the shelf. Instead, it is owned
// by container of the status area.
- internal::ShelfLayoutManager* shelf_;
+ ShelfLayoutManager* shelf_;
// Manages layout of panels. Owned by PanelContainer.
- internal::PanelLayoutManager* panel_layout_manager_;
+ PanelLayoutManager* panel_layout_manager_;
scoped_ptr<Launcher> launcher_;
diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc
index 4c7e1db..41053bd 100644
--- a/ash/screen_ash.cc
+++ b/ash/screen_ash.cc
@@ -6,7 +6,9 @@
#include "ash/display/display_controller.h"
#include "ash/display/multi_display_manager.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
+#include "ash/wm/property_util.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/shelf_layout_manager.h"
#include "base/logging.h"
@@ -39,7 +41,7 @@ gfx::Display ScreenAsh::FindDisplayContainingPoint(const gfx::Point& point) {
// static
gfx::Rect ScreenAsh::GetMaximizedWindowBoundsInParent(aura::Window* window) {
- if (window->GetRootWindow() == Shell::GetPrimaryRootWindow())
+ if (GetRootWindowController(window->GetRootWindow())->launcher())
return GetDisplayWorkAreaBoundsInParent(window);
else
return GetDisplayBoundsInParent(window);
diff --git a/ash/shell.cc b/ash/shell.cc
index 90036a9..836861e 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -35,6 +35,7 @@
#include "ash/wm/app_list_controller.h"
#include "ash/wm/base_layout_manager.h"
#include "ash/wm/capture_controller.h"
+#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/custom_frame_view_ash.h"
#include "ash/wm/dialog_frame_view.h"
#include "ash/wm/event_client_impl.h"
@@ -513,8 +514,9 @@ void Shell::ShowContextMenu(const gfx::Point& location) {
// No context menus when screen is locked.
if (IsScreenLocked())
return;
- if (launcher())
- launcher()->ShowContextMenu(location);
+ aura::RootWindow* root =
+ wm::GetRootWindowMatching(gfx::Rect(location, gfx::Size()));
+ Launcher::ForWindow(root)->ShowContextMenu(location);
}
void Shell::ToggleAppList() {
@@ -580,6 +582,11 @@ void Shell::OnLoginStateChanged(user::LoginStatus status) {
ash::Shell::GetInstance()->UpdateShelfVisibility();
}
+void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) {
+ GetPrimaryRootWindowController()->status_area_widget()->
+ UpdateAfterLoginStatusChange(status);
+}
+
void Shell::OnAppTerminating() {
FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating());
}
@@ -604,11 +611,8 @@ void Shell::RemoveShellObserver(ShellObserver* observer) {
observers_.RemoveObserver(observer);
}
-Launcher* Shell::launcher() {
- return GetPrimaryRootWindowController()->launcher();
-}
-
void Shell::UpdateShelfVisibility() {
+ // TODO(oshima): Update all root windows.
GetPrimaryRootWindowController()->UpdateShelfVisibility();
}
@@ -665,22 +669,22 @@ void Shell::OnModalWindowRemoved(aura::Window* removed) {
}
}
-internal::ShelfLayoutManager* Shell::shelf() const {
- return GetPrimaryRootWindowController()->shelf();
-}
-
-internal::StatusAreaWidget* Shell::status_area_widget() const {
- return GetPrimaryRootWindowController()->status_area_widget();
+WebNotificationTray* Shell::GetWebNotificationTray() {
+ return GetPrimaryRootWindowController()->status_area_widget()->
+ web_notification_tray();
}
SystemTrayDelegate* Shell::tray_delegate() {
- return status_area_widget() ? status_area_widget()->system_tray_delegate() :
- NULL;
+ // TODO(oshima): Decouple system tray and its delegate.
+ internal::StatusAreaWidget* status_area_widget =
+ GetPrimaryRootWindowController()->status_area_widget();
+ return status_area_widget ? status_area_widget->system_tray_delegate() : NULL;
}
SystemTray* Shell::system_tray() {
- return status_area_widget() ? status_area_widget()->system_tray() :
- NULL;
+ internal::StatusAreaWidget* status_area_widget =
+ GetPrimaryRootWindowController()->status_area_widget();
+ return status_area_widget ? status_area_widget->system_tray() : NULL;
}
void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
diff --git a/ash/shell.h b/ash/shell.h
index dbcc2fd..4f4586a 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -75,6 +75,7 @@ class SystemTray;
class UserActivityDetector;
class UserWallpaperDelegate;
class VideoDetector;
+class WebNotificationTray;
class WindowCycleController;
namespace internal {
@@ -237,6 +238,10 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
// Called when the user logs in.
void OnLoginStateChanged(user::LoginStatus status);
+ // Called when the login status changes.
+ // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
+ void UpdateAfterLoginStatusChange(user::LoginStatus status);
+
// Called when the application is exiting.
void OnAppTerminating();
@@ -316,9 +321,6 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
return magnification_controller_.get();
}
- // TODO(oshima): Remove methods that are moved to RootWindowController.
- Launcher* launcher();
-
const ScreenAsh* screen() { return screen_.get(); }
// Force the shelf to query for it's current visibility state.
@@ -343,10 +345,8 @@ class ASH_EXPORT Shell : internal::SystemModalContainerEventFilterDelegate{
// on all displays.
void OnModalWindowRemoved(aura::Window* removed);
- // TODO(sky): don't expose this!
- internal::ShelfLayoutManager* shelf() const;
-
- internal::StatusAreaWidget* status_area_widget() const;
+ // Returns WebNotificationTray on the primary root window.
+ WebNotificationTray* GetWebNotificationTray();
// Convenience accessor for members of StatusAreaWidget.
SystemTrayDelegate* tray_delegate();
diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc
index fa9a7e4..df45d89 100644
--- a/ash/shell/window_type_launcher.cc
+++ b/ash/shell/window_type_launcher.cc
@@ -4,6 +4,7 @@
#include "ash/shell/window_type_launcher.h"
+#include "ash/root_window_controller.h"
#include "ash/screensaver/screensaver_view.h"
#include "ash/shell.h"
#include "ash/shell/example_factory.h"
@@ -327,7 +328,7 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender,
base::TimeDelta::FromSeconds(5));
} else if (sender == show_web_notification_) {
- ash::Shell::GetInstance()->status_area_widget()->
+ ash::Shell::GetPrimaryRootWindowController()->status_area_widget()->
web_notification_tray()->AddNotification(
"id0",
ASCIIToUTF16("Test Shell Web Notification"),
diff --git a/ash/shell/window_watcher.cc b/ash/shell/window_watcher.cc
index a85d8f6..97fee7d 100644
--- a/ash/shell/window_watcher.cc
+++ b/ash/shell/window_watcher.cc
@@ -8,6 +8,7 @@
#include "ash/launcher/launcher_model.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
namespace ash {
@@ -43,9 +44,9 @@ class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver {
};
WindowWatcher::WindowWatcher()
- : window_(ash::Shell::GetInstance()->launcher()->window_container()),
+ : window_(Launcher::ForPrimaryDisplay()->window_container()),
panel_container_(ash::Shell::GetContainer(
- Shell::GetPrimaryRootWindow(),
+ window_->GetRootWindow(),
internal::kShellWindowId_PanelContainer)) {
workspace_window_watcher_.reset(new WorkspaceWindowWatcher(this));
panel_container_->AddObserver(this);
@@ -76,7 +77,7 @@ void WindowWatcher::OnWindowAdded(aura::Window* new_window) {
return;
static int image_count = 0;
- ash::LauncherModel* model = ash::Shell::GetInstance()->launcher()->model();
+ ash::LauncherModel* model = Launcher::ForPrimaryDisplay()->model();
ash::LauncherItem item;
item.type = ash::TYPE_TABBED;
id_to_window_[model->next_id()] = new_window;
@@ -99,8 +100,7 @@ void WindowWatcher::OnWillRemoveWindow(aura::Window* window) {
for (IDToWindow::iterator i = id_to_window_.begin();
i != id_to_window_.end(); ++i) {
if (i->second == window) {
- ash::LauncherModel* model =
- ash::Shell::GetInstance()->launcher()->model();
+ ash::LauncherModel* model = Launcher::ForPrimaryDisplay()->model();
int index = model->ItemIndexByID(i->first);
DCHECK_NE(-1, index);
model->RemoveItemAt(index);
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index 131d500..d939cdb 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/ash_switches.h"
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/launcher/launcher.h"
+#include "ash/root_window_controller.h"
#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
@@ -277,7 +278,7 @@ TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
// We start with the usual window containers.
ExpectAllContainers();
// Launcher is visible.
- views::Widget* launcher_widget = shell->launcher()->widget();
+ views::Widget* launcher_widget = Launcher::ForPrimaryDisplay()->widget();
EXPECT_TRUE(launcher_widget->IsVisible());
// Launcher is at bottom-left of screen.
EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x());
@@ -316,18 +317,21 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) {
EXPECT_FALSE(widget->IsMaximized());
// Shelf defaults to visible.
- EXPECT_EQ(internal::ShelfLayoutManager::VISIBLE,
- Shell::GetInstance()->shelf()->visibility_state());
+ EXPECT_EQ(
+ internal::ShelfLayoutManager::VISIBLE,
+ Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Fullscreen window hides it.
widget->SetFullscreen(true);
- EXPECT_EQ(internal::ShelfLayoutManager::HIDDEN,
- Shell::GetInstance()->shelf()->visibility_state());
+ EXPECT_EQ(
+ internal::ShelfLayoutManager::HIDDEN,
+ Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Restoring the window restores it.
widget->Restore();
- EXPECT_EQ(internal::ShelfLayoutManager::VISIBLE,
- Shell::GetInstance()->shelf()->visibility_state());
+ EXPECT_EQ(
+ internal::ShelfLayoutManager::VISIBLE,
+ Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
// Clean up.
widget->Close();
diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc
index 6abcd81..34682a2 100644
--- a/ash/system/ime/tray_ime.cc
+++ b/ash/system/ime/tray_ime.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
@@ -335,7 +336,8 @@ void TrayIME::OnIMERefresh(bool show_message) {
// refreshed.
if (notification_) {
notification_->UpdateLabel();
- } else if (!Shell::GetInstance()->shelf()->IsVisible() || !message_shown_) {
+ } else if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() ||
+ !message_shown_) {
ShowNotificationView();
message_shown_ = true;
}
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc
index 59f91a7..afb086a 100644
--- a/ash/system/status_area_widget.cc
+++ b/ash/system/status_area_widget.cc
@@ -351,7 +351,7 @@ bool StatusAreaWidget::ShouldShowLauncher() const {
web_notification_tray_->IsMessageCenterBubbleVisible()))
return true;
- if (!Shell::GetInstance()->shelf()->IsVisible())
+ if (!RootWindowController::ForLauncher(GetNativeView())->shelf()->IsVisible())
return false;
// If the launcher is currently visible, don't hide the launcher if the mouse
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 56b7e9c..ecae854 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -345,7 +345,7 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
UpdateNotificationBubble(); // State changed, re-create notifications.
status_area_widget()->SetHideWebNotifications(true);
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
+ GetShelfLayoutManager()->UpdateAutoHideState();
}
void SystemTray::UpdateNotificationBubble() {
@@ -444,7 +444,7 @@ void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) {
if (bubble_.get() && bubble_view == bubble_->bubble_view()) {
DestroyBubble();
UpdateNotificationBubble(); // State changed, re-create notifications.
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
+ GetShelfLayoutManager()->UpdateAutoHideState();
} else if (notification_bubble_.get() &&
bubble_view == notification_bubble_->bubble_view()) {
DestroyNotificationBubble();
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc
index b03c548..54f34b8 100644
--- a/ash/system/tray/system_tray_unittest.cc
+++ b/ash/system/tray/system_tray_unittest.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "ash/root_window_controller.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
@@ -21,7 +22,8 @@ namespace test {
namespace {
SystemTray* GetSystemTray() {
- return Shell::GetInstance()->status_area_widget()->system_tray();
+ return Shell::GetPrimaryRootWindowController()->status_area_widget()->
+ system_tray();
}
// Trivial item implementation that tracks its views for testing.
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index ef360c7..3a4ef7a 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -5,6 +5,7 @@
#include "ash/system/tray/tray_background_view.h"
#include "ash/launcher/background_animator.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/system/status_area_widget.h"
@@ -254,6 +255,11 @@ void TrayBackgroundView::SetPaintsBackground(
hide_background_animator_.SetPaintsBackground(value, change_type);
}
+ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() {
+ return
+ RootWindowController::ForLauncher(GetWidget()->GetNativeView())->shelf();
+}
+
void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
shelf_alignment_ = alignment;
SetBorder();
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h
index 2d496a5..416393a 100644
--- a/ash/system/tray/tray_background_view.h
+++ b/ash/system/tray/tray_background_view.h
@@ -14,6 +14,7 @@
namespace ash {
namespace internal {
+class ShelfLayoutManager;
class StatusAreaWidget;
class TrayBackground;
class TrayLayerAnimationObserver;
@@ -130,6 +131,8 @@ class ASH_EXPORT TrayBackgroundView : public internal::ActionableView,
TrayContainer* tray_container() const { return tray_container_; }
ShelfAlignment shelf_alignment() const { return shelf_alignment_; }
+ ShelfLayoutManager* GetShelfLayoutManager();
+
private:
friend class TrayLayerAnimationObserver;
diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc
index cc39e47..7530a8b 100644
--- a/ash/system/tray_update.cc
+++ b/ash/system/tray_update.cc
@@ -4,6 +4,7 @@
#include "ash/system/tray_update.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
@@ -125,7 +126,9 @@ class UpdateNagger : public ui::LayerAnimationObserver {
// Overridden from ui::LayerAnimationObserver.
virtual void OnLayerAnimationEnded(
ui::LayerAnimationSequence* sequence) OVERRIDE {
- if (Shell::GetInstance()->shelf()->IsVisible())
+ // TODO(oshima): Find out if the updator will be shown on non
+ // primary display.
+ if (Shell::GetPrimaryRootWindowController()->shelf()->IsVisible())
timer_.Stop();
else if (!timer_.IsRunning())
RestartTimer();
@@ -180,7 +183,8 @@ void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) {
severity_ = severity;
SetImageFromResourceId(DecideResource(severity_, false));
tray_view()->SetVisible(true);
- if (!Shell::GetInstance()->shelf()->IsVisible() && !nagger_.get()) {
+ if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() &&
+ !nagger_.get()) {
// The shelf is not visible, and there is no nagger scheduled.
nagger_.reset(new tray::UpdateNagger(this));
}
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index b904c33..baf9f01 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -138,7 +138,7 @@ void WebNotificationTray::ShowMessageCenterBubble() {
HidePopupBubble();
message_center_bubble_.reset(new MessageCenterBubble(this));
status_area_widget()->SetHideSystemNotifications(true);
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
+ GetShelfLayoutManager()->UpdateAutoHideState();
}
void WebNotificationTray::HideMessageCenterBubble() {
@@ -149,7 +149,7 @@ void WebNotificationTray::HideMessageCenterBubble() {
notification_list_->SetMessageCenterVisible(false);
UpdateTray();
status_area_widget()->SetHideSystemNotifications(false);
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
+ GetShelfLayoutManager()->UpdateAutoHideState();
}
void WebNotificationTray::SetHidePopupBubble(bool hide) {
diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc
index 3ac88a8..0de2575 100644
--- a/ash/system/web_notification/web_notification_tray_unittest.cc
+++ b/ash/system/web_notification/web_notification_tray_unittest.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "ash/root_window_controller.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/test/ash_test_base.h"
@@ -21,7 +22,8 @@ namespace ash {
namespace {
WebNotificationTray* GetWebNotificationTray() {
- return Shell::GetInstance()->status_area_widget()->web_notification_tray();
+ return Shell::GetPrimaryRootWindowController()->status_area_widget()->
+ web_notification_tray();
}
class TestDelegate : public WebNotificationTray::Delegate {
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index c3d1840..f7f7390 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -115,7 +115,7 @@ void AppListController::SetVisible(bool visible) {
// App list needs to know the new shelf layout in order to calculate its
// UI layout when AppListView visibility changes.
- Shell::GetInstance()->shelf()->UpdateAutoHideState();
+ Shell::GetPrimaryRootWindowController()->shelf()->UpdateAutoHideState();
if (view_) {
ScheduleAnimation();
@@ -128,7 +128,7 @@ void AppListController::SetVisible(bool visible) {
Shell::GetPrimaryRootWindowController()->GetContainer(
kShellWindowId_AppListContainer),
pagination_model_.get(),
- Shell::GetInstance()->launcher()->GetAppListButtonView(),
+ Launcher::ForWindow(GetWindow())->GetAppListButtonView(),
gfx::Point(),
GetBubbleArrowLocation());
SetView(view);
@@ -154,7 +154,7 @@ void AppListController::SetView(app_list::AppListView* view) {
views::Widget* widget = view_->GetWidget();
widget->AddObserver(this);
Shell::GetInstance()->AddEnvEventFilter(this);
- Shell::GetInstance()->launcher()->AddIconObserver(this);
+ Launcher::ForWindow(GetWindow())->AddIconObserver(this);
widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this);
widget->GetNativeView()->GetFocusManager()->AddObserver(this);
widget->SetOpacity(0);
@@ -174,7 +174,7 @@ void AppListController::ResetView() {
widget->RemoveObserver(this);
GetLayer(widget)->GetAnimator()->RemoveObserver(this);
Shell::GetInstance()->RemoveEnvEventFilter(this);
- Shell::GetInstance()->launcher()->RemoveIconObserver(this);
+ Launcher::ForWindow(GetWindow())->RemoveIconObserver(this);
widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this);
widget->GetNativeView()->GetFocusManager()->RemoveObserver(this);
view_ = NULL;
diff --git a/ash/wm/gestures/shelf_gesture_handler.cc b/ash/wm/gestures/shelf_gesture_handler.cc
index 9ac8f93..4bf4a39 100644
--- a/ash/wm/gestures/shelf_gesture_handler.cc
+++ b/ash/wm/gestures/shelf_gesture_handler.cc
@@ -4,6 +4,7 @@
#include "ash/wm/gestures/shelf_gesture_handler.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/system/status_area_widget.h"
@@ -40,7 +41,8 @@ bool ShelfGestureHandler::ProcessGestureEvent(const ui::GestureEvent& event) {
if (active && wm::IsWindowFullscreen(active))
return false;
- ShelfLayoutManager* shelf = shell->shelf();
+ // TODO(oshima): Find the root window controller from event's location.
+ ShelfLayoutManager* shelf = Shell::GetPrimaryRootWindowController()->shelf();
if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) {
drag_in_progress_ = true;
shelf->StartGestureDrag(event);
diff --git a/ash/wm/gestures/system_pinch_handler.cc b/ash/wm/gestures/system_pinch_handler.cc
index d974add..2f519b0 100644
--- a/ash/wm/gestures/system_pinch_handler.cc
+++ b/ash/wm/gestures/system_pinch_handler.cc
@@ -136,7 +136,7 @@ gfx::Rect SystemPinchHandler::GetPhantomWindowScreenBounds(
return window->bounds();
}
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForWindow(window);
gfx::Rect rect = launcher->GetScreenBoundsOfItemIconForWindow(target_);
if (rect.IsEmpty())
rect = launcher->widget()->GetWindowBoundsInScreen();
diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc
index f38ed9f..bcd9601 100644
--- a/ash/wm/panel_layout_manager_unittest.cc
+++ b/ash/wm/panel_layout_manager_unittest.cc
@@ -33,9 +33,8 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase {
ash::test::AshTestBase::SetUp();
ASSERT_TRUE(ash::test::TestLauncherDelegate::instance());
- Launcher* launcher = Shell::GetInstance()->launcher();
launcher_view_test_.reset(new test::LauncherViewTestAPI(
- launcher->GetLauncherViewForTest()));
+ Launcher::ForPrimaryDisplay()->GetLauncherViewForTest()));
launcher_view_test_->SetAnimationDuration(1);
}
@@ -79,7 +78,7 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase {
// Waits until all launcher view animations are done.
launcher_view_test()->RunMessageLoopUntilAnimationsDone();
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel);
ASSERT_FALSE(icon_bounds.IsEmpty());
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index 31eb4ba..8aff1ae 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -9,6 +9,7 @@
#include "ash/ash_switches.h"
#include "ash/launcher/launcher.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
@@ -172,13 +173,13 @@ class ShelfLayoutManager::UpdateShelfObserver
// ShelfLayoutManager ----------------------------------------------------------
-ShelfLayoutManager::ShelfLayoutManager(views::Widget* status)
- : root_window_(Shell::GetPrimaryRootWindow()),
+ShelfLayoutManager::ShelfLayoutManager(StatusAreaWidget* status_area_widget)
+ : root_window_(status_area_widget->GetNativeView()->GetRootWindow()),
in_layout_(false),
auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
alignment_(SHELF_ALIGNMENT_BOTTOM),
launcher_(NULL),
- status_(status),
+ status_area_widget_(status_area_widget),
workspace_controller_(NULL),
window_overlaps_shelf_(false),
gesture_drag_status_(GESTURE_DRAG_NONE),
@@ -208,9 +209,10 @@ void ShelfLayoutManager::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
}
bool ShelfLayoutManager::IsVisible() const {
- return status_->IsVisible() && (state_.visibility_state == VISIBLE ||
- (state_.visibility_state == AUTO_HIDE &&
- state_.auto_hide_state == AUTO_HIDE_SHOWN));
+ return status_area_widget_->IsVisible() &&
+ (state_.visibility_state == VISIBLE ||
+ (state_.visibility_state == AUTO_HIDE &&
+ state_.auto_hide_state == AUTO_HIDE_SHOWN));
}
void ShelfLayoutManager::SetLauncher(Launcher* launcher) {
@@ -230,10 +232,7 @@ bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) {
alignment_ = alignment;
if (launcher_)
launcher_->SetAlignment(alignment);
- StatusAreaWidget* status_area_widget =
- Shell::GetInstance()->status_area_widget();
- if (status_area_widget)
- Shell::GetInstance()->status_area_widget()->SetShelfAlignment(alignment);
+ status_area_widget_->SetShelfAlignment(alignment);
LayoutShelf();
return true;
}
@@ -242,7 +241,7 @@ gfx::Rect ShelfLayoutManager::GetIdealBounds() {
// TODO(oshima): this is wrong. Figure out what display shelf is on
// and everything should be based on it.
gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(
- status_->GetNativeView()));
+ status_area_widget_->GetNativeView()));
int width = 0, height = 0;
GetShelfSize(&width, &height);
switch (alignment_) {
@@ -272,10 +271,10 @@ void ShelfLayoutManager::LayoutShelf() {
target_bounds.launcher_bounds_in_root));
launcher_->SetStatusSize(target_bounds.status_bounds_in_root.size());
}
- GetLayer(status_)->SetOpacity(target_bounds.opacity);
- status_->SetBounds(
+ GetLayer(status_area_widget_)->SetOpacity(target_bounds.opacity);
+ status_area_widget_->SetBounds(
ScreenAsh::ConvertRectToScreen(
- status_->GetNativeView()->parent(),
+ status_area_widget_->GetNativeView()->parent(),
target_bounds.status_bounds_in_root));
Shell::GetInstance()->SetDisplayWorkAreaInsets(
Shell::GetPrimaryRootWindow(),
@@ -376,7 +375,8 @@ ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag(
GetPreferredSize().height();
if (min_height < launcher_widget()->GetWindowBoundsInScreen().height() &&
- gesture.root_location().x() >= status_->GetWindowBoundsInScreen().x() &&
+ gesture.root_location().x() >=
+ status_area_widget_->GetWindowBoundsInScreen().x() &&
IsDraggingTrayEnabled())
return DRAG_TRAY;
}
@@ -423,7 +423,7 @@ void ShelfLayoutManager::CompleteGestureDrag(const ui::GestureEvent& gesture) {
AUTO_HIDE_SHOWN;
if (launcher_widget())
launcher_widget()->Deactivate();
- status_->Deactivate();
+ status_area_widget_->Deactivate();
if (gesture_drag_auto_hide_state_ == AUTO_HIDE_HIDDEN &&
auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
gesture_drag_status_ = GESTURE_DRAG_NONE;
@@ -443,7 +443,7 @@ void ShelfLayoutManager::CancelGestureDrag() {
gesture_drag_status_ = GESTURE_DRAG_NONE;
ui::ScopedLayerAnimationSettings
launcher_settings(GetLayer(launcher_widget())->GetAnimator()),
- status_settings(GetLayer(status_)->GetAnimator());
+ status_settings(GetLayer(status_area_widget_)->GetAnimator());
LayoutShelf();
UpdateVisibilityState();
UpdateShelfBackground(internal::BackgroundAnimator::CHANGE_ANIMATE);
@@ -476,7 +476,7 @@ void ShelfLayoutManager::SetChildBounds(aura::Window* child,
// effect the layout in anyway.
if (!in_layout_ &&
((launcher_widget() && launcher_widget()->GetNativeView() == child) ||
- (status_->GetNativeView() == child))) {
+ (status_area_widget_->GetNativeView() == child))) {
LayoutShelf();
}
}
@@ -553,7 +553,7 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) {
GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity);
}
ui::ScopedLayerAnimationSettings status_animation_setter(
- GetLayer(status_)->GetAnimator());
+ GetLayer(status_area_widget_)->GetAnimator());
status_animation_setter.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kWorkspaceSwitchTimeMS));
status_animation_setter.SetTweenType(ui::Tween::EASE_OUT);
@@ -580,8 +580,9 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) {
update_shelf_observer_ = new UpdateShelfObserver(this);
status_animation_setter.AddObserver(update_shelf_observer_);
}
- GetLayer(status_)->SetBounds(target_bounds.status_bounds_in_root);
- GetLayer(status_)->SetOpacity(target_bounds.opacity);
+ ui::Layer* layer = GetLayer(status_area_widget_);
+ layer->SetBounds(target_bounds.status_bounds_in_root);
+ layer->SetOpacity(target_bounds.opacity);
Shell::GetInstance()->SetDisplayWorkAreaInsets(
Shell::GetPrimaryRootWindow(),
target_bounds.work_area_insets);
@@ -591,14 +592,15 @@ void ShelfLayoutManager::SetState(VisibilityState visibility_state) {
}
void ShelfLayoutManager::StopAnimating() {
+ ui::Layer* layer = GetLayer(status_area_widget_);
if (launcher_widget())
- GetLayer(launcher_widget())->GetAnimator()->StopAnimating();
- GetLayer(status_)->GetAnimator()->StopAnimating();
+ layer->GetAnimator()->StopAnimating();
+ layer->GetAnimator()->StopAnimating();
}
void ShelfLayoutManager::GetShelfSize(int* width, int* height) {
*width = *height = 0;
- gfx::Size status_size(status_->GetWindowBoundsInScreen().size());
+ gfx::Size status_size(status_area_widget_->GetWindowBoundsInScreen().size());
gfx::Size launcher_size = launcher_ ?
launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size();
if (alignment_ == SHELF_ALIGNMENT_BOTTOM)
@@ -625,9 +627,8 @@ void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset,
void ShelfLayoutManager::CalculateTargetBounds(
const State& state,
TargetBounds* target_bounds) {
- const gfx::Rect& available_bounds(
- status_->GetNativeView()->GetRootWindow()->bounds());
- gfx::Rect status_size(status_->GetWindowBoundsInScreen().size());
+ const gfx::Rect& available_bounds(root_window_->bounds());
+ gfx::Rect status_size(status_area_widget_->GetWindowBoundsInScreen().size());
gfx::Size launcher_size = launcher_ ?
launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size();
int shelf_size = 0;
@@ -787,15 +788,11 @@ void ShelfLayoutManager::UpdateShelfBackground(
launcher_->SetPaintsBackground(launcher_paints, type);
// The status area normally draws a background, but we don't want it to draw a
// background when the launcher does or when we're at login/lock screen.
- StatusAreaWidget* status_area_widget =
- Shell::GetInstance()->status_area_widget();
- if (status_area_widget) {
- ShellDelegate* delegate = Shell::GetInstance()->delegate();
- bool delegate_allows_tray_bg = !delegate ||
- (delegate->IsUserLoggedIn() && !delegate->IsScreenLocked());
- bool status_area_paints = !launcher_paints && delegate_allows_tray_bg;
- status_area_widget->SetPaintsBackground(status_area_paints, type);
- }
+ ShellDelegate* delegate = Shell::GetInstance()->delegate();
+ bool delegate_allows_tray_bg = !delegate ||
+ (delegate->IsUserLoggedIn() && !delegate->IsScreenLocked());
+ bool status_area_paints = !launcher_paints && delegate_allows_tray_bg;
+ status_area_widget_->SetPaintsBackground(status_area_paints, type);
}
bool ShelfLayoutManager::GetLauncherPaintsBackground() const {
@@ -820,8 +817,7 @@ ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState(
if (shell->GetAppListTargetVisibility())
return AUTO_HIDE_SHOWN;
- if (shell->status_area_widget() &&
- shell->status_area_widget()->ShouldShowLauncher())
+ if (status_area_widget_ && status_area_widget_->ShouldShowLauncher())
return AUTO_HIDE_SHOWN;
if (launcher_ && launcher_->IsShowingMenu())
@@ -830,7 +826,7 @@ ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState(
if (launcher_ && launcher_->IsShowingOverflowBubble())
return AUTO_HIDE_SHOWN;
- if (launcher_widget()->IsActive() || status_->IsActive())
+ if (launcher_widget()->IsActive() || status_area_widget_->IsActive())
return AUTO_HIDE_SHOWN;
// Don't show if the user is dragging the mouse.
@@ -838,8 +834,8 @@ ShelfLayoutManager::AutoHideState ShelfLayoutManager::CalculateAutoHideState(
return AUTO_HIDE_HIDDEN;
gfx::Rect shelf_region = launcher_widget()->GetWindowBoundsInScreen();
- if (shell->status_area_widget() &&
- shell->status_area_widget()->IsMessageBubbleShown() &&
+ if (status_area_widget_ &&
+ status_area_widget_->IsMessageBubbleShown() &&
IsVisible()) {
// Increase the the hit test area to prevent the shelf from disappearing
// when the mouse is over the bubble gap.
@@ -878,7 +874,8 @@ void ShelfLayoutManager::UpdateHitTestBounds() {
launcher_widget()->GetNativeWindow()->SetHitTestBoundsOverrideOuter(
insets, 1);
}
- status_->GetNativeWindow()->SetHitTestBoundsOverrideOuter( insets, 1);
+ status_area_widget_->GetNativeWindow()->
+ SetHitTestBoundsOverrideOuter(insets, 1);
}
bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) {
@@ -886,7 +883,7 @@ bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) {
return false;
return (launcher_widget() &&
launcher_widget()->GetNativeWindow()->Contains(window)) ||
- (status_ && status_->GetNativeWindow()->Contains(window));
+ (status_area_widget_->GetNativeWindow()->Contains(window));
}
int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const {
diff --git a/ash/wm/shelf_layout_manager.h b/ash/wm/shelf_layout_manager.h
index c0b57f8..6b9eb08 100644
--- a/ash/wm/shelf_layout_manager.h
+++ b/ash/wm/shelf_layout_manager.h
@@ -27,15 +27,12 @@ namespace ui {
class GestureEvent;
}
-namespace views {
-class Widget;
-}
-
namespace ash {
class ScreenAsh;
namespace internal {
class ShelfLayoutManagerTest;
+class StatusAreaWidget;
class WorkspaceController;
// ShelfLayoutManager is the layout manager responsible for the launcher and
@@ -88,7 +85,7 @@ class ASH_EXPORT ShelfLayoutManager :
// Size of the shelf when auto-hidden.
static const int kAutoHideSize;
- explicit ShelfLayoutManager(views::Widget* status);
+ explicit ShelfLayoutManager(StatusAreaWidget* status);
virtual ~ShelfLayoutManager();
// Sets the ShelfAutoHideBehavior. See enum description for details.
@@ -112,7 +109,7 @@ class ASH_EXPORT ShelfLayoutManager :
const views::Widget* launcher_widget() const {
return launcher_ ? launcher_->widget() : NULL;
}
- views::Widget* status() { return status_; }
+ StatusAreaWidget* status_area_widget() { return status_area_widget_; }
bool in_layout() const { return in_layout_; }
@@ -277,7 +274,7 @@ class ASH_EXPORT ShelfLayoutManager :
State state_;
Launcher* launcher_;
- views::Widget* status_;
+ StatusAreaWidget* status_area_widget_;
WorkspaceController* workspace_controller_;
diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc
index 54e1075..dff6dc5 100644
--- a/ash/wm/shelf_layout_manager_unittest.cc
+++ b/ash/wm/shelf_layout_manager_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/ash_switches.h"
#include "ash/focus_cycler.h"
#include "ash/launcher/launcher.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
@@ -152,6 +153,10 @@ class ShelfLayoutManagerTest : public ash::test::AshTestBase {
public:
ShelfLayoutManagerTest() {}
+ ShelfLayoutManager* shelf_layout_manager() {
+ return Shell::GetPrimaryRootWindowController()->shelf();
+ }
+
void SetState(ShelfLayoutManager* shelf,
ShelfLayoutManager::VisibilityState state) {
shelf->SetState(state);
@@ -193,7 +198,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
shelf->LayoutShelf();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
- gfx::Rect status_bounds(shelf->status()->GetWindowBoundsInScreen());
+ gfx::Rect status_bounds(
+ shelf->status_area_widget()->GetWindowBoundsInScreen());
gfx::Rect launcher_bounds(
shelf->launcher_widget()->GetWindowBoundsInScreen());
int shelf_height = shelf->GetIdealBounds().height();
@@ -211,7 +217,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
SetState(shelf, ShelfLayoutManager::HIDDEN);
// Run the animation to completion.
StepWidgetLayerAnimatorToEnd(shelf->launcher_widget());
- StepWidgetLayerAnimatorToEnd(shelf->status());
+ StepWidgetLayerAnimatorToEnd(shelf->status_area_widget());
EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
EXPECT_EQ(0,
display.bounds().bottom() - display.work_area().bottom());
@@ -219,14 +225,14 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
// Make sure the bounds of the two widgets changed.
EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
- EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
+ EXPECT_GE(shelf->status_area_widget()->GetNativeView()->bounds().y(),
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
// And show it again.
SetState(shelf, ShelfLayoutManager::VISIBLE);
// Run the animation to completion.
StepWidgetLayerAnimatorToEnd(shelf->launcher_widget());
- StepWidgetLayerAnimatorToEnd(shelf->status());
+ StepWidgetLayerAnimatorToEnd(shelf->status_area_widget());
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
EXPECT_EQ(shelf_height,
display.bounds().bottom() - display.work_area().bottom());
@@ -238,7 +244,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
EXPECT_EQ(launcher_bounds.y(),
bottom + (shelf->GetIdealBounds().height() -
launcher_bounds.height()) / 2);
- status_bounds = shelf->status()->GetNativeView()->bounds();
+ status_bounds = shelf->status_area_widget()->GetNativeView()->bounds();
EXPECT_EQ(status_bounds.y(),
bottom + shelf_height - status_bounds.height());
}
@@ -264,19 +270,19 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
// Make sure the bounds of the two widgets changed.
EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
- EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
+ EXPECT_GE(shelf->status_area_widget()->GetNativeView()->bounds().y(),
Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom());
}
// Makes sure the launcher is initially sized correctly.
TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
ASSERT_TRUE(shelf_layout_manager);
- ASSERT_TRUE(shelf_layout_manager->status());
- int status_width =
- shelf_layout_manager->status()->GetWindowBoundsInScreen().width();
+ ASSERT_TRUE(shelf_layout_manager->status_area_widget());
+ int status_width = shelf_layout_manager->status_area_widget()->
+ GetWindowBoundsInScreen().width();
// Test only makes sense if the status is > 0, which is better be.
EXPECT_GT(status_width, 0);
EXPECT_EQ(status_width, launcher->status_size().width());
@@ -284,12 +290,13 @@ TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) {
// Makes sure the launcher is sized when the status area changes size.
TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
ASSERT_TRUE(launcher);
ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
ASSERT_TRUE(shelf_layout_manager);
- ASSERT_TRUE(shelf_layout_manager->status());
- shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200));
+ ASSERT_TRUE(shelf_layout_manager->status_area_widget());
+ shelf_layout_manager->status_area_widget()->SetBounds(
+ gfx::Rect(0, 0, 200, 200));
EXPECT_EQ(200, launcher->status_size().width());
}
@@ -493,7 +500,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
// Trying to activate the status should fail, since we only allow activating
// it when the user is using the keyboard (i.e. through FocusCycler).
- shelf->status()->Activate();
+ shelf->status_area_widget()->Activate();
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
shelf->launcher()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD);
@@ -504,7 +511,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
// state,and toggling app list won't change shelf visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->LayoutShelf();
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
@@ -531,7 +538,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) {
// visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->LayoutShelf();
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
@@ -565,7 +572,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) {
// state, and toggling app list won't change shelf visibility state.
TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) {
Shell* shell = Shell::GetInstance();
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
// For shelf to be visible, app list is not open in initial state.
shelf->LayoutShelf();
@@ -593,7 +600,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) {
// Tests SHELF_ALIGNMENT_LEFT and SHELF_ALIGNMENT_RIGHT.
TEST_F(ShelfLayoutManagerTest, SetAlignment) {
- ShelfLayoutManager* shelf = GetShelfLayoutManager();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
// Force an initial layout.
shelf->LayoutShelf();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
@@ -614,9 +621,10 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) {
shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(SHELF_ALIGNMENT_LEFT,
Shell::GetInstance()->system_tray()->shelf_alignment());
- gfx::Rect status_bounds(shelf->status()->GetWindowBoundsInScreen());
+ StatusAreaWidget* status_area_widget = shelf->status_area_widget();
+ gfx::Rect status_bounds(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.width(),
- shelf->status()->GetContentsView()->GetPreferredSize().width());
+ status_area_widget->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(shelf->GetIdealBounds().width(),
display.GetWorkAreaInsets().left());
EXPECT_EQ(0, display.GetWorkAreaInsets().top());
@@ -637,9 +645,9 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) {
shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(SHELF_ALIGNMENT_RIGHT,
Shell::GetInstance()->system_tray()->shelf_alignment());
- status_bounds = gfx::Rect(shelf->status()->GetWindowBoundsInScreen());
+ status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.width(),
- shelf->status()->GetContentsView()->GetPreferredSize().width());
+ status_area_widget->GetContentsView()->GetPreferredSize().width());
EXPECT_EQ(shelf->GetIdealBounds().width(),
display.GetWorkAreaInsets().right());
EXPECT_EQ(0, display.GetWorkAreaInsets().top());
@@ -763,7 +771,8 @@ TEST_F(ShelfLayoutManagerTest, GestureRevealsTrayBubble) {
EXPECT_FALSE(tray->HasSystemBubble());
// Now, drag up on the tray to show the bubble.
- gfx::Point start = shelf->status()->GetWindowBoundsInScreen().CenterPoint();
+ gfx::Point start =
+ shelf->status_area_widget()->GetWindowBoundsInScreen().CenterPoint();
gfx::Point end(start.x(), start.y() - 100);
generator.GestureScrollSequence(start, end,
base::TimeDelta::FromMilliseconds(10), 1);
@@ -879,39 +888,39 @@ TEST_F(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) {
// Confirm that the shelf is dimmed only when content is maximized and
// shelf is not autohidden.
TEST_F(ShelfLayoutManagerTest, Dimming) {
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+ shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
scoped_ptr<aura::Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
// Normal window doesn't dim shelf.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
+ EXPECT_FALSE(launcher->GetDimsShelf());
// Maximized window does.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_TRUE(launcher->GetDimsShelf());
// Change back to normal stops dimming.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_FALSE(launcher->GetDimsShelf());
// Changing back to maximized dims again.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_TRUE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ EXPECT_TRUE(launcher->GetDimsShelf());
// Changing shelf to autohide stops dimming.
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
- SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- EXPECT_FALSE(Shell::GetInstance()->launcher()->GetDimsShelf());
+ shelf_layout_manager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
+ EXPECT_FALSE(launcher->GetDimsShelf());
}
// Make sure that the shelf will not hide if the mouse is between a bubble and
// the shelf.
TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) {
ShelfLayoutManager* shelf = GetShelfLayoutManager();
- StatusAreaWidget* status_area = Shell::GetInstance()->status_area_widget();
+ StatusAreaWidget* status_area_widget =
+ Shell::GetPrimaryRootWindowController()->status_area_widget();
SystemTray* tray = Shell::GetInstance()->system_tray();
shelf->LayoutShelf();
@@ -924,33 +933,33 @@ TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) {
// Make sure the shelf is visible and position the mouse over it. Then
// allow auto hide.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- EXPECT_FALSE(status_area->IsMessageBubbleShown());
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
gfx::Point center =
- shelf->status()->GetWindowBoundsInScreen().CenterPoint();
+ status_area_widget->GetWindowBoundsInScreen().CenterPoint();
generator.MoveMouseTo(center.x(), center.y());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_TRUE(shelf->IsVisible());
if (!i) {
// In our first iteration we make sure there is no bubble.
tray->CloseBubbleForTest();
- EXPECT_FALSE(status_area->IsMessageBubbleShown());
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
} else {
// In our second iteration we show a bubble.
TestItem *item = new TestItem;
tray->AddTrayItem(item);
tray->ShowNotificationView(item);
- EXPECT_TRUE(status_area->IsMessageBubbleShown());
+ EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
}
// Move the pointer over the edge of the shelf.
- generator.MoveMouseTo(center.x(),
- shelf->status()->GetWindowBoundsInScreen().y() - 7);
+ generator.MoveMouseTo(
+ center.x(), status_area_widget->GetWindowBoundsInScreen().y() - 7);
shelf->UpdateVisibilityState();
if (i) {
EXPECT_TRUE(shelf->IsVisible());
- EXPECT_TRUE(status_area->IsMessageBubbleShown());
+ EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
} else {
EXPECT_FALSE(shelf->IsVisible());
- EXPECT_FALSE(status_area->IsMessageBubbleShown());
+ EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
}
}
}
diff --git a/ash/wm/status_area_layout_manager.cc b/ash/wm/status_area_layout_manager.cc
index 84b4aa3..b971d79 100644
--- a/ash/wm/status_area_layout_manager.cc
+++ b/ash/wm/status_area_layout_manager.cc
@@ -4,6 +4,7 @@
#include "ash/wm/status_area_layout_manager.h"
+#include "ash/system/status_area_widget.h"
#include "ash/wm/shelf_layout_manager.h"
#include "base/auto_reset.h"
#include "ui/aura/window.h"
@@ -49,7 +50,7 @@ void StatusAreaLayoutManager::SetChildBounds(
const gfx::Rect& requested_bounds) {
// Only need to have the shelf do a layout if the child changing is the status
// area and the shelf isn't in the process of doing a layout.
- if (child != shelf_->status()->GetNativeView() || in_layout_) {
+ if (child != shelf_->status_area_widget()->GetNativeView() || in_layout_) {
SetChildBoundsDirect(child, requested_bounds);
return;
}
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index bd56fa0..133f095 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -319,7 +319,11 @@ void AnimateHideWindow_Fade(aura::Window* window) {
}
gfx::Rect GetMinimizeRectForWindow(aura::Window* window) {
- gfx::Rect target_bounds = Shell::GetInstance()->launcher()->
+ Launcher* launcher = Launcher::ForWindow(window);
+ // Launcher is created lazily and can be NULL.
+ if (!launcher)
+ return gfx::Rect();
+ gfx::Rect target_bounds = Launcher::ForWindow(window)->
GetScreenBoundsOfItemIconForWindow(window);
if (target_bounds.IsEmpty()) {
// Assume the launcher is overflowed, zoom off to the bottom right of the
diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc
index 76415d0..2319240 100644
--- a/ash/wm/workspace/frame_maximize_button.cc
+++ b/ash/wm/workspace/frame_maximize_button.cc
@@ -477,7 +477,10 @@ gfx::Rect FrameMaximizeButton::ScreenBoundsForType(
window->parent(),
ScreenAsh::GetMaximizedWindowBoundsInParent(window));
case SNAP_MINIMIZE: {
- Launcher* launcher = Shell::GetInstance()->launcher();
+ Launcher* launcher = Launcher::ForWindow(window);
+ // Launcher is created lazily and can be NULL.
+ if (!launcher)
+ return gfx::Rect();
gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow(
window));
if (!item_rect.IsEmpty()) {
diff --git a/ash/wm/workspace/workspace_layout_manager2_unittest.cc b/ash/wm/workspace/workspace_layout_manager2_unittest.cc
index b5b8abd..799e013 100644
--- a/ash/wm/workspace/workspace_layout_manager2_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager2_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/wm/workspace/workspace_layout_manager2.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/property_util.h"
@@ -65,7 +66,8 @@ class DontClobberRestoreBoundsWindowObserver : public aura::WindowObserver {
aura::Window* w = window_;
window_ = NULL;
- gfx::Rect shelf_bounds(Shell::GetInstance()->shelf()->GetIdealBounds());
+ gfx::Rect shelf_bounds(
+ Shell::GetPrimaryRootWindowController()->shelf()->GetIdealBounds());
const gfx::Rect& window_bounds(w->bounds());
w->SetBounds(gfx::Rect(window_bounds.x(), shelf_bounds.y() - 1,
window_bounds.width(), window_bounds.height()));
diff --git a/ash/wm/workspace/workspace_manager2_unittest.cc b/ash/wm/workspace/workspace_manager2_unittest.cc
index 4956a7d..70a39e6 100644
--- a/ash/wm/workspace/workspace_manager2_unittest.cc
+++ b/ash/wm/workspace/workspace_manager2_unittest.cc
@@ -5,9 +5,11 @@
#include "ash/wm/workspace/workspace_manager2.h"
#include "ash/ash_switches.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "ash/system/status_area_widget.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/activation_controller.h"
#include "ash/wm/property_util.h"
@@ -34,14 +36,6 @@ using aura::Window;
namespace ash {
namespace internal {
-namespace {
-
-bool GetWindowOverlapsShelf() {
- return Shell::GetInstance()->shelf()->window_overlaps_shelf();
-}
-
-} // namespace
-
class WorkspaceManager2Test : public test::AshTestBase {
public:
WorkspaceManager2Test() : manager_(NULL) {}
@@ -81,6 +75,14 @@ class WorkspaceManager2Test : public test::AshTestBase {
return manager_->active_workspace_;
}
+ ShelfLayoutManager* shelf_layout_manager() {
+ return Shell::GetPrimaryRootWindowController()->shelf();
+ }
+
+ bool GetWindowOverlapsShelf() {
+ return shelf_layout_manager()->window_overlaps_shelf();
+ }
+
Workspace2* FindBy(aura::Window* window) const {
return manager_->FindBy(window);
}
@@ -460,7 +462,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
scoped_ptr<Window> w1(CreateTestWindow());
const gfx::Rect w1_bounds(0, 1, 101, 102);
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
const gfx::Rect touches_shelf_bounds(
0, shelf->GetIdealBounds().y() - 10, 101, 102);
@@ -675,7 +677,7 @@ TEST_F(WorkspaceManager2Test, ShowMinimizedPersistWindow) {
// Test that we report we're in the fullscreen state even if the fullscreen
// window isn't being managed by us (http://crbug.com/123931).
TEST_F(WorkspaceManager2Test, GetWindowStateWithUnmanagedFullscreenWindow) {
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
// We need to create a regular window first so there's an active workspace.
scoped_ptr<Window> w1(CreateTestWindow());
@@ -718,7 +720,7 @@ TEST_F(WorkspaceManager2Test, GetWindowStateWithUnmanagedFullscreenWindow) {
// window rather than a normal window.
TEST_F(WorkspaceManager2Test,
GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) {
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
// Make the first window maximized.
@@ -783,8 +785,8 @@ TEST_F(WorkspaceManager2Test, MinimizeResetsVisibility) {
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
EXPECT_EQ(ShelfLayoutManager::VISIBLE,
- Shell::GetInstance()->shelf()->visibility_state());
- EXPECT_FALSE(Shell::GetInstance()->launcher()->paints_background());
+ shelf_layout_manager()->visibility_state());
+ EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background());
}
// Verifies transients are moved when maximizing.
@@ -884,7 +886,7 @@ TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) {
generator.MoveMouseTo(0, 0);
scoped_ptr<Window> w1(CreateTestWindow());
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
const gfx::Rect touches_shelf_bounds(
0, shelf->GetIdealBounds().y() - 10, 101, 102);
// Move |w1| to overlap the shelf.
@@ -912,7 +914,7 @@ TEST_F(WorkspaceManager2Test, MoveOnSwitch) {
generator.MoveMouseTo(0, 0);
scoped_ptr<Window> w1(CreateTestWindow());
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
const gfx::Rect w1_bounds(0, shelf->GetIdealBounds().y(), 100, 200);
// Move |w1| so that the top edge is the same as the top edge of the shelf.
w1->SetBounds(w1_bounds);
@@ -929,9 +931,9 @@ TEST_F(WorkspaceManager2Test, MoveOnSwitch) {
// Increase the size of the shelf. This would make |w1| fall completely out of
// the display work area.
- gfx::Size size = shelf->status()->GetWindowBoundsInScreen().size();
+ gfx::Size size(shelf->status_area_widget()->GetWindowBoundsInScreen().size());
size.Enlarge(0, 30);
- shelf->status()->SetSize(size);
+ shelf->status_area_widget()->SetSize(size);
// Switch to w1. The window should have moved.
wm::ActivateWindow(w1.get());
@@ -992,7 +994,7 @@ class DontCrashOnChangeAndActivateDelegate
// . show the window and during the bounds change activate it.
TEST_F(WorkspaceManager2Test, DontCrashOnChangeAndActivate) {
// Force the shelf
- ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
+ ShelfLayoutManager* shelf = shelf_layout_manager();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
DontCrashOnChangeAndActivateDelegate delegate;
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index f151f62..9affd2a 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -6,6 +6,7 @@
#include "ash/display/display_controller.h"
#include "ash/display/mouse_cursor_event_filter.h"
+#include "ash/root_window_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -126,6 +127,10 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
return std::vector<aura::Window*>();
}
+ internal::ShelfLayoutManager* shelf_layout_manager() {
+ return Shell::GetPrimaryRootWindowController()->shelf();
+ }
+
TestWindowDelegate delegate_;
TestWindowDelegate delegate2_;
TestWindowDelegate delegate3_;
@@ -485,7 +490,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
// The secondary display is logically on the right, but on the system (e.g. X)
// layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
UpdateDisplay("800x600,800x600");
- Shell::GetInstance()->shelf()->LayoutShelf();
+ shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -546,7 +551,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
TEST_F(WorkspaceWindowResizerTest,
MAYBE_WindowDragWithMultiDisplaysRightToLeft) {
UpdateDisplay("800x600,800x600");
- Shell::GetInstance()->shelf()->LayoutShelf();
+ shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -1004,7 +1009,7 @@ TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
scoped_ptr<SnapSizer> resizer(new SnapSizer(
window_.get(), gfx::Point(), SnapSizer::LEFT_EDGE));
ASSERT_TRUE(resizer.get());
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
+ shelf_layout_manager()->SetAutoHideBehavior(
SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
gfx::Rect rect = resizer->GetTargetBoundsForSize(0);
EXPECT_EQ("0,0 720x597", rect.ToString());
@@ -1014,7 +1019,7 @@ TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
EXPECT_EQ("0,0 720x597", rect.ToString());
rect = resizer->GetTargetBoundsForSize(3);
EXPECT_EQ("0,0 640x597", rect.ToString());
- Shell::GetInstance()->shelf()->SetAutoHideBehavior(
+ shelf_layout_manager()->SetAutoHideBehavior(
SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
rect = resizer->GetTargetBoundsForSize(0);
EXPECT_EQ("0,0 720x552", rect.ToString());
@@ -1093,7 +1098,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_CursorDeviceScaleFactor) {
// The secondary display is logically on the right, but on the system (e.g. X)
// layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
UpdateDisplay("400x400,800x800*2");
- Shell::GetInstance()->shelf()->LayoutShelf();
+ shelf_layout_manager()->LayoutShelf();
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 287ccca..be01d4c 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -14,7 +14,6 @@
#include "ash/system/ime/ime_observer.h"
#include "ash/system/network/network_observer.h"
#include "ash/system/power/power_status_observer.h"
-#include "ash/system/status_area_widget.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray_accessibility.h"
@@ -944,14 +943,14 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// Overridden from SessionManagerClient::Observer.
virtual void LockScreen() OVERRIDE {
screen_locked_ = true;
- ash::Shell::GetInstance()->status_area_widget()->
- UpdateAfterLoginStatusChange(GetUserLoginStatus());
+ ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ GetUserLoginStatus());
}
virtual void UnlockScreen() OVERRIDE {
screen_locked_ = false;
- ash::Shell::GetInstance()->status_area_widget()->
- UpdateAfterLoginStatusChange(GetUserLoginStatus());
+ ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ GetUserLoginStatus());
}
// TODO(sad): Override more from PowerManagerClient::Observer here (e.g.
@@ -1075,8 +1074,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
break;
}
case chrome::NOTIFICATION_SESSION_STARTED: {
- ash::Shell::GetInstance()->status_area_widget()->
- UpdateAfterLoginStatusChange(GetUserLoginStatus());
+ ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ GetUserLoginStatus());
SetProfile(ProfileManager::GetDefaultProfile());
break;
}
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index 8b0f8f3..7181886 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -6,7 +6,6 @@
#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_model.h"
-#include "ash/shell.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
@@ -50,7 +49,7 @@ class LauncherPlatformAppBrowserTest
virtual ~LauncherPlatformAppBrowserTest() {}
virtual void RunTestOnMainThreadLoop() {
- launcher_ = ash::Shell::GetInstance()->launcher();
+ launcher_ = ash::Launcher::ForPrimaryDisplay();
controller_ = static_cast<ChromeLauncherController*>(launcher_->delegate());
return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop();
}
@@ -74,7 +73,7 @@ class LauncherAppBrowserTest : public ExtensionBrowserTest {
virtual ~LauncherAppBrowserTest() {}
virtual void RunTestOnMainThreadLoop() {
- launcher_ = ash::Shell::GetInstance()->launcher();
+ launcher_ = ash::Launcher::ForPrimaryDisplay();
model_ = launcher_->model();
return ExtensionBrowserTest::RunTestOnMainThreadLoop();
}
@@ -123,7 +122,7 @@ class LauncherAppBrowserTest : public ExtensionBrowserTest {
// Test that we can launch a platform app and get a running item.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
- ash::Launcher* launcher = ash::Shell::GetInstance()->launcher();
+ ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay();
int item_count = launcher->model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
ShellWindow* window = CreateShellWindow(extension);
diff --git a/chrome/browser/ui/ash/shelf_browsertest.cc b/chrome/browser/ui/ash/shelf_browsertest.cc
index 2df3dba..36cd047 100644
--- a/chrome/browser/ui/ash/shelf_browsertest.cc
+++ b/chrome/browser/ui/ash/shelf_browsertest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/workspace_controller.h"
@@ -15,8 +16,9 @@ typedef InProcessBrowserTest ShelfBrowserTest;
// Confirm that a status bubble doesn't cause the shelf to darken.
IN_PROC_BROWSER_TEST_F(ShelfBrowserTest, StatusBubble) {
- ash::Shell* shell = ash::Shell::GetInstance();
- ash::internal::ShelfLayoutManager* shelf = shell->shelf();
+ ash::internal::ShelfLayoutManager* shelf =
+ ash::internal::RootWindowController::ForLauncher(
+ browser()->window()->GetNativeWindow())->shelf();
EXPECT_TRUE(shelf->IsVisible());
// Ensure that the browser abuts the shelf.
diff --git a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc b/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
index 504b680..66b2a01 100644
--- a/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
+++ b/chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/ash/balloon_collection_impl_ash.h"
#include "ash/shell.h"
-#include "ash/system/status_area_widget.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
@@ -19,8 +18,7 @@
#include "chrome/browser/ui/views/notifications/balloon_view_views.h"
BalloonCollectionImplAsh::BalloonCollectionImplAsh() {
- ash::Shell::GetInstance()->status_area_widget()->
- web_notification_tray()->SetDelegate(this);
+ ash::Shell::GetInstance()->GetWebNotificationTray()->SetDelegate(this);
}
BalloonCollectionImplAsh::~BalloonCollectionImplAsh() {
diff --git a/chrome/browser/ui/views/ash/balloon_view_ash.cc b/chrome/browser/ui/views/ash/balloon_view_ash.cc
index 9bc53fe..cccddf5 100644
--- a/chrome/browser/ui/views/ash/balloon_view_ash.cc
+++ b/chrome/browser/ui/views/ash/balloon_view_ash.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/ash/balloon_view_ash.h"
#include "ash/shell.h"
-#include "ash/system/status_area_widget.h"
#include "ash/system/web_notification/web_notification_tray.h"
#include "base/logging.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -30,8 +29,7 @@ namespace {
const int kNotificationIconImageSize = 32;
ash::WebNotificationTray* GetWebNotificationTray() {
- return ash::Shell::GetInstance()->
- status_area_widget()->web_notification_tray();
+ return ash::Shell::GetInstance()->GetWebNotificationTray();
}
} // namespace
@@ -134,9 +132,8 @@ BalloonHost* BalloonViewAsh::GetHost() const {
void BalloonViewAsh::FetchIcon(const Notification& notification) {
if (!notification.icon().isNull()) {
- ash::Shell::GetInstance()->status_area_widget()->
- web_notification_tray()->SetNotificationImage(
- notification.notification_id(), notification.icon());
+ ash::Shell::GetInstance()->GetWebNotificationTray()->SetNotificationImage(
+ notification.notification_id(), notification.icon());
return;
}
if (notification.icon_url().is_empty())