summaryrefslogtreecommitdiffstats
path: root/ash/launcher
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 /ash/launcher
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
Diffstat (limited to 'ash/launcher')
-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
5 files changed, 38 insertions, 12 deletions
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;