From da56a47ab4279016cd690e576bee1d81d414aac5 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Wed, 14 Dec 2011 06:02:34 +0000 Subject: Store StackingClient on RootWindow in a property. BUG=none TEST=existing unit tests. Review URL: http://codereview.chromium.org/8926008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114369 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/aura_shell/root_window_event_filter_unittest.cc | 7 ++----- ui/aura_shell/shell.cc | 8 ++------ ui/aura_shell/shell.h | 2 ++ ui/aura_shell/stacking_controller.cc | 11 ++++------- ui/aura_shell/stacking_controller.h | 3 --- ui/aura_shell/toplevel_window_event_filter_unittest.cc | 9 +++------ ui/aura_shell/workspace/workspace_manager_unittest.cc | 7 ++----- 7 files changed, 15 insertions(+), 32 deletions(-) (limited to 'ui/aura_shell') diff --git a/ui/aura_shell/root_window_event_filter_unittest.cc b/ui/aura_shell/root_window_event_filter_unittest.cc index d53cdc8..80ff962 100644 --- a/ui/aura_shell/root_window_event_filter_unittest.cc +++ b/ui/aura_shell/root_window_event_filter_unittest.cc @@ -31,14 +31,11 @@ class RootWindowEventFilterTest : public aura::test::AuraTestBase { aura::RootWindow::GetInstance()->SetEventFilter( new internal::RootWindowEventFilter); - aura::test::TestStackingClient* stacking_client = - static_cast( - aura::RootWindow::GetInstance()->stacking_client()); - stacking_client->default_container()->set_id( + GetTestStackingClient()->default_container()->set_id( internal::kShellWindowId_DefaultContainer); activation_controller_.reset(new internal::ActivationController); activation_controller_->set_default_container_for_test( - stacking_client->default_container()); + GetTestStackingClient()->default_container()); } virtual ~RootWindowEventFilterTest() { aura::RootWindow::GetInstance()->SetEventFilter(NULL); diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc index 51c1b99..b9aaca5 100644 --- a/ui/aura_shell/shell.cc +++ b/ui/aura_shell/shell.cc @@ -120,8 +120,6 @@ Shell::Shell(ShellDelegate* delegate) delegate_(delegate) { aura::RootWindow::GetInstance()->SetEventFilter( new internal::RootWindowEventFilter); - aura::RootWindow::GetInstance()->SetStackingClient( - new internal::StackingController); } Shell::~Shell() { @@ -192,10 +190,8 @@ void Shell::Init() { (*i)->Show(); } - internal::StackingController* stacking_controller = - static_cast( - root_window->stacking_client()); - stacking_controller->Init(); + // This is created after the special containers, since it expects them. + stacking_controller_.reset(new internal::StackingController); internal::RootWindowLayoutManager* root_window_layout = new internal::RootWindowLayoutManager(root_window); diff --git a/ui/aura_shell/shell.h b/ui/aura_shell/shell.h index 80f5060..6006340 100644 --- a/ui/aura_shell/shell.h +++ b/ui/aura_shell/shell.h @@ -37,6 +37,7 @@ class AppList; class DragDropController; class ShadowController; class ShellAcceleratorFilter; +class StackingController; class WorkspaceController; } @@ -113,6 +114,7 @@ class AURA_SHELL_EXPORT Shell { scoped_ptr app_list_; + scoped_ptr stacking_controller_; scoped_ptr activation_controller_; scoped_ptr drag_drop_controller_; scoped_ptr workspace_controller_; diff --git a/ui/aura_shell/stacking_controller.cc b/ui/aura_shell/stacking_controller.cc index dba6da1..dedf726 100644 --- a/ui/aura_shell/stacking_controller.cc +++ b/ui/aura_shell/stacking_controller.cc @@ -29,19 +29,16 @@ bool IsWindowModal(aura::Window* window) { // StackingController, public: StackingController::StackingController() { - aura::RootWindow::GetInstance()->SetStackingClient(this); -} - -StackingController::~StackingController() { -} - -void StackingController::Init() { + aura::StackingClient::SetStackingClient(this); always_on_top_controller_.reset(new internal::AlwaysOnTopController); always_on_top_controller_->SetContainers( GetContainer(internal::kShellWindowId_DefaultContainer), GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); } +StackingController::~StackingController() { +} + //////////////////////////////////////////////////////////////////////////////// // StackingController, aura::StackingClient implementation: diff --git a/ui/aura_shell/stacking_controller.h b/ui/aura_shell/stacking_controller.h index d7b2edd..bd6430f 100644 --- a/ui/aura_shell/stacking_controller.h +++ b/ui/aura_shell/stacking_controller.h @@ -21,9 +21,6 @@ class StackingController : public aura::StackingClient { StackingController(); virtual ~StackingController(); - // Initializes this controller. - void Init(); - // Overridden from aura::StackingClient: virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE; diff --git a/ui/aura_shell/toplevel_window_event_filter_unittest.cc b/ui/aura_shell/toplevel_window_event_filter_unittest.cc index f4cc00e..c366693 100644 --- a/ui/aura_shell/toplevel_window_event_filter_unittest.cc +++ b/ui/aura_shell/toplevel_window_event_filter_unittest.cc @@ -67,12 +67,9 @@ class ToplevelWindowEventFilterTest : public aura::test::AuraTestBase { virtual void SetUp() OVERRIDE { aura::test::AuraTestBase::SetUp(); - aura::Window* default_container = - static_cast( - aura::RootWindow::GetInstance()->stacking_client())-> - default_container(); - default_container->SetEventFilter( - new ToplevelWindowEventFilter(default_container)); + GetTestStackingClient()->default_container()->SetEventFilter( + new ToplevelWindowEventFilter( + GetTestStackingClient()->default_container())); } protected: diff --git a/ui/aura_shell/workspace/workspace_manager_unittest.cc b/ui/aura_shell/workspace/workspace_manager_unittest.cc index 91e72b5..77b9d19 100644 --- a/ui/aura_shell/workspace/workspace_manager_unittest.cc +++ b/ui/aura_shell/workspace/workspace_manager_unittest.cc @@ -80,14 +80,11 @@ namespace internal { class WorkspaceManagerTestBase : public aura::test::AuraTestBase { public: WorkspaceManagerTestBase() { - aura::test::TestStackingClient* stacking_client = - static_cast( - aura::RootWindow::GetInstance()->stacking_client()); - stacking_client->default_container()->set_id( + GetTestStackingClient()->default_container()->set_id( internal::kShellWindowId_DefaultContainer); activation_controller_.reset(new internal::ActivationController); activation_controller_->set_default_container_for_test( - stacking_client->default_container()); + GetTestStackingClient()->default_container()); } virtual ~WorkspaceManagerTestBase() {} -- cgit v1.1