diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 17:55:00 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 17:55:00 +0000 |
commit | ef663fa86cfec242f72cee7bd4b62e8bd52dc14e (patch) | |
tree | 453ba5a130f8d6729b3f5da4df6cd753b0dc67ae /ash | |
parent | c0914a598aa7e0d3d959820f6cb041398e46b6a4 (diff) | |
download | chromium_src-ef663fa86cfec242f72cee7bd4b62e8bd52dc14e.zip chromium_src-ef663fa86cfec242f72cee7bd4b62e8bd52dc14e.tar.gz chromium_src-ef663fa86cfec242f72cee7bd4b62e8bd52dc14e.tar.bz2 |
Adds views::corewm::WMState to install common state
I'm going to need to install a another singleton client for
transients. Rather than touch all places to explicitly set n clients
I'm creating Environment to centralize common setup and teardown.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/105813013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.cc | 5 | ||||
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.h | 8 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 13 | ||||
-rw-r--r-- | ash/test/ash_test_helper.cc | 10 | ||||
-rw-r--r-- | ash/test/ash_test_helper.h | 8 |
5 files changed, 25 insertions, 19 deletions
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index 70d523e..2e4a4c4 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -29,6 +29,7 @@ #include "ui/compositor/compositor.h" #include "ui/gfx/screen.h" #include "ui/message_center/message_center.h" +#include "ui/views/corewm/wm_state.h" #include "ui/views/focus/accelerator_handler.h" #include "ui/views/test/test_views_delegate.h" @@ -97,6 +98,10 @@ void ShellBrowserMainParts::PostMainMessageLoopStart() { #endif } +void ShellBrowserMainParts::ToolkitInitialized() { + wm_state_.reset(new views::corewm::WMState); +} + void ShellBrowserMainParts::PreMainMessageLoopRun() { net_log_.reset(new content::ShellNetLog()); browser_context_.reset(new content::ShellBrowserContext( diff --git a/ash/shell/content_client/shell_browser_main_parts.h b/ash/shell/content_client/shell_browser_main_parts.h index 768ee5e..229c868 100644 --- a/ash/shell/content_client/shell_browser_main_parts.h +++ b/ash/shell/content_client/shell_browser_main_parts.h @@ -22,6 +22,12 @@ namespace net { class NetLog; } +namespace views { +namespace corewm { +class WMState; +} +} + namespace ash { namespace shell { @@ -37,6 +43,7 @@ class ShellBrowserMainParts : public content::BrowserMainParts { // Overridden from content::BrowserMainParts: virtual void PreMainMessageLoopStart() OVERRIDE; virtual void PostMainMessageLoopStart() OVERRIDE; + virtual void ToolkitInitialized() OVERRIDE; virtual void PreMainMessageLoopRun() OVERRIDE; virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; virtual void PostMainMessageLoopRun() OVERRIDE; @@ -50,6 +57,7 @@ class ShellBrowserMainParts : public content::BrowserMainParts { scoped_ptr<content::ShellBrowserContext> browser_context_; scoped_ptr<ash::shell::WindowWatcher> window_watcher_; ShellDelegateImpl* delegate_; // owned by Shell + scoped_ptr<views::corewm::WMState> wm_state_; DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); }; diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index b45ca5e..3c477a4 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -5,34 +5,21 @@ #include "ash/shell/content_client/shell_main_delegate.h" #include "content/public/app/content_main.h" #include "sandbox/win/src/sandbox_types.h" -#include "ui/views/corewm/transient_window_stacking_client.h" #if defined(OS_WIN) #include "content/public/app/startup_helper_win.h" #endif -namespace { - -void CommonInit() { - // SetWindowStackingClient() takes ownership of TransientWindowStackingClient. - aura::client::SetWindowStackingClient( - new views::corewm::TransientWindowStackingClient); -} - -} // namespace - #if defined(OS_WIN) int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { sandbox::SandboxInterfaceInfo sandbox_info = {0}; content::InitializeSandboxInfo(&sandbox_info); ash::shell::ShellMainDelegate delegate; - CommonInit(); return content::ContentMain(instance, &sandbox_info, &delegate); } #else int main(int argc, const char** argv) { ash::shell::ShellMainDelegate delegate; - CommonInit(); return content::ContentMain(argc, argv, &delegate); } #endif diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index 2c2f2f7..e544874 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -22,7 +22,7 @@ #include "ui/compositor/test/context_factories_for_test.h" #include "ui/message_center/message_center.h" #include "ui/views/corewm/capture_controller.h" -#include "ui/views/corewm/transient_window_stacking_client.h" +#include "ui/views/corewm/wm_state.h" #if defined(OS_CHROMEOS) #include "chromeos/audio/cras_audio_handler.h" @@ -51,6 +51,8 @@ AshTestHelper::~AshTestHelper() { } void AshTestHelper::SetUp(bool start_session) { + wm_state_.reset(new views::corewm::WMState); + // Disable animations during tests. zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); @@ -95,10 +97,6 @@ void AshTestHelper::SetUp(bool start_session) { test_screenshot_delegate_ = new TestScreenshotDelegate(); shell->accelerator_controller()->SetScreenshotDelegate( scoped_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); - - // SetWindowStackingClient() takes ownership of TransientWindowStackingClient. - aura::client::SetWindowStackingClient( - new views::corewm::TransientWindowStackingClient); } void AshTestHelper::TearDown() { @@ -128,7 +126,7 @@ void AshTestHelper::TearDown() { CHECK(!views::corewm::ScopedCaptureClient::IsActive()); - aura::client::SetWindowStackingClient(NULL); + wm_state_.reset(); } void AshTestHelper::RunAllPendingInMessageLoop() { diff --git a/ash/test/ash_test_helper.h b/ash/test/ash_test_helper.h index ab0b8a2..706cfeb 100644 --- a/ash/test/ash_test_helper.h +++ b/ash/test/ash_test_helper.h @@ -20,6 +20,12 @@ namespace ui { class ScopedAnimationDurationScaleMode; } // namespace ui +namespace views { +namespace corewm { +class WMState; +} +} + namespace ash { namespace test { @@ -62,6 +68,8 @@ class AshTestHelper { // Owned by ash::AcceleratorController TestScreenshotDelegate* test_screenshot_delegate_; + scoped_ptr<views::corewm::WMState> wm_state_; + // Check if DBus Thread Manager was initialized here. bool dbus_thread_manager_initialized_; |