summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 20:07:20 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 20:07:20 +0000
commit79b0ef5a6c9fdd84b4df1a321d3cf20c3a892088 (patch)
tree744ed9193496e287e86c6ca5eec0815da65336bb /ash
parentf6bf2dab069eadd776799a3f28922418b079489e (diff)
downloadchromium_src-79b0ef5a6c9fdd84b4df1a321d3cf20c3a892088.zip
chromium_src-79b0ef5a6c9fdd84b4df1a321d3cf20c3a892088.tar.gz
chromium_src-79b0ef5a6c9fdd84b4df1a321d3cf20c3a892088.tar.bz2
Remove the singleton instance get/delete methods from RootWindow (yay)
http://crbug.com/112131 TEST=none Review URL: https://chromiumcodereview.appspot.com/9535025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell.cc21
-rw-r--r--ash/shell.h2
-rw-r--r--ash/shell/shell_main.cc1
-rw-r--r--ash/test/ash_test_base.cc13
4 files changed, 20 insertions, 17 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 52e25d1..651068f 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -270,11 +270,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() {
// Shell, public:
Shell::Shell(ShellDelegate* delegate)
- : root_filter_(new internal::RootWindowEventFilter),
-#if !defined(OS_MACOSX)
- nested_dispatcher_controller_(new NestedDispatcherController),
- accelerator_controller_(new AcceleratorController),
-#endif
+ : root_window_(new aura::RootWindow),
delegate_(delegate),
audio_controller_(NULL),
brightness_controller_(NULL),
@@ -283,8 +279,6 @@ Shell::Shell(ShellDelegate* delegate)
desktop_background_mode_(BACKGROUND_IMAGE),
root_window_layout_(NULL),
status_widget_(NULL) {
- // Pass ownership of the filter to the root window.
- GetRootWindow()->SetEventFilter(root_filter_);
}
Shell::~Shell() {
@@ -320,7 +314,10 @@ Shell::~Shell() {
// These need a valid Shell instance to clean up properly, so explicitly
// delete them before invalidating the instance.
+ // Alphabetical.
+ activation_controller_.reset();
drag_drop_controller_.reset();
+ shadow_controller_.reset();
window_cycle_controller_.reset();
// Launcher widget has a InputMethodBridge that references to
@@ -356,10 +353,18 @@ void Shell::DeleteInstance() {
// static
aura::RootWindow* Shell::GetRootWindow() {
- return aura::RootWindow::GetInstance();
+ return GetInstance()->root_window_.get();
}
void Shell::Init() {
+ root_filter_ = new internal::RootWindowEventFilter;
+#if !defined(OS_MACOSX)
+ nested_dispatcher_controller_.reset(new NestedDispatcherController);
+ accelerator_controller_.reset(new AcceleratorController);
+#endif
+ // Pass ownership of the filter to the root window.
+ GetRootWindow()->SetEventFilter(root_filter_);
+
DCHECK(!GetRootWindowEventFilterCount());
// PartialScreenshotEventFilter must be the first one to capture key
diff --git a/ash/shell.h b/ash/shell.h
index 2413c4b..40d5e20 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -252,6 +252,8 @@ class ASH_EXPORT Shell {
// when the screen is initially created.
static bool initially_hide_cursor_;
+ scoped_ptr<aura::RootWindow> root_window_;
+
internal::RootWindowEventFilter* root_filter_; // not owned
std::vector<WindowAndBoundsPair> to_restore_;
diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc
index 34611d3..a5dbccf 100644
--- a/ash/shell/shell_main.cc
+++ b/ash/shell/shell_main.cc
@@ -268,7 +268,6 @@ int main(int argc, char** argv) {
ash::Shell::DeleteInstance();
- aura::RootWindow::DeleteInstance();
aura::Env::DeleteInstance();
ui::CompositorTestSupport::Terminate();
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 8b0f23e..be7fd5e 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -13,18 +13,12 @@ namespace ash {
namespace test {
AshTestBase::AshTestBase() {
- helper_.InitRootWindow(Shell::GetRootWindow());
}
AshTestBase::~AshTestBase() {
- // Ensure that we don't use the previously-allocated static RootWindow object
- // later -- on Linux, it holds a reference to our message loop's X connection.
- aura::RootWindow::DeleteInstance();
}
void AshTestBase::SetUp() {
- helper_.SetUp();
-
// Creates Shell and hook with Desktop.
TestShellDelegate* delegate = new TestShellDelegate;
Shell::WindowMode window_mode = Shell::MODE_OVERLAPPING;
@@ -32,6 +26,9 @@ void AshTestBase::SetUp() {
delegate->SetOverrideWindowMode(window_mode);
ash::Shell::CreateInstance(delegate);
+ helper_.SetUp();
+ helper_.InitRootWindow(Shell::GetRootWindow());
+
// Disable animations during tests.
ui::LayerAnimator::set_disable_animations_for_test(true);
}
@@ -40,10 +37,10 @@ void AshTestBase::TearDown() {
// Flush the message loop to finish pending release tasks.
RunAllPendingInMessageLoop();
+ helper_.TearDown();
+
// Tear down the shell.
Shell::DeleteInstance();
-
- helper_.TearDown();
}
bool AshTestBase::GetOverrideWindowMode(Shell::WindowMode* window_mode) {