diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-15 18:32:23 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-15 18:32:23 +0000 |
commit | 1b4c747749bc8cc46ed2b9006d2f82b6c511e7c4 (patch) | |
tree | dadc320dc0f37c5dd756aaee193a72b8697c09b8 /chrome/browser | |
parent | 9eab79b4434f1f4346767257af80f066116706f5 (diff) | |
download | chromium_src-1b4c747749bc8cc46ed2b9006d2f82b6c511e7c4.zip chromium_src-1b4c747749bc8cc46ed2b9006d2f82b6c511e7c4.tar.gz chromium_src-1b4c747749bc8cc46ed2b9006d2f82b6c511e7c4.tar.bz2 |
Makes construction of (ash)RemoteWindowTreeHostWin explicit
I need to do this as I need to pass in state to the constructor and I
can't do that with lazy construction. This makes creation a little
saner anyway.
I'm not happy about the static setting the HWND. I'll see if I can
clean that up later.
BUG=none
TEST=none
R=ananta@chromium.org
Review URL: https://codereview.chromium.org/277753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_init.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_init.h | 7 | ||||
-rw-r--r-- | chrome/browser/ui/ash/ash_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc | 2 |
5 files changed, 20 insertions, 14 deletions
diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc index 374f300..277a5aa 100644 --- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc +++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc @@ -120,14 +120,10 @@ void ChromeMetroViewerProcessHost::OnSetTargetSurface( float device_scale) { HWND hwnd = reinterpret_cast<HWND>(target_surface); - // Make hwnd available as early as possible for proper InputMethod - // initialization. - ash::AshRemoteWindowTreeHostWin::Init(); - aura::RemoteWindowTreeHostWin::Instance()-> - InitializeRemoteWindowAndScaleFactor(hwnd, device_scale); - - // Now start the Ash shell environment. - chrome::OpenAsh(); + gfx::InitDeviceScaleFactor(device_scale); + chrome::OpenAsh(hwnd); + DCHECK(aura::RemoteWindowTreeHostWin::Instance()); + DCHECK_EQ(hwnd, aura::RemoteWindowTreeHostWin::Instance()->remote_window()); ash::Shell::GetInstance()->CreateShelf(); ash::Shell::GetInstance()->ShowShelf(); diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc index c3a8b51..06ab94e 100644 --- a/chrome/browser/ui/ash/ash_init.cc +++ b/chrome/browser/ui/ash/ash_init.cc @@ -11,6 +11,7 @@ #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" #include "ash/shell.h" +#include "ash/shell_init_params.h" #include "base/command_line.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/lifetime/application_lifetime.h" @@ -42,7 +43,7 @@ bool ShouldOpenAshOnStartup() { return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); } -void OpenAsh() { +void OpenAsh(gfx::AcceleratedWidget remote_window) { #if defined(OS_CHROMEOS) #if defined(USE_X11) if (base::SysInfo::IsRunningOnChromeOS()) { @@ -58,8 +59,14 @@ void OpenAsh() { ash::Shell::set_initially_hide_cursor(true); #endif + ash::ShellInitParams shell_init_params; // Shell takes ownership of ChromeShellDelegate. - ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); + shell_init_params.delegate = new ChromeShellDelegate; +#if defined(OS_WIN) + shell_init_params.remote_hwnd = remote_window; +#endif + + ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); shell->accelerator_controller()->SetScreenshotDelegate( scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. diff --git a/chrome/browser/ui/ash/ash_init.h b/chrome/browser/ui/ash/ash_init.h index 6ed1a0f..b1141bd 100644 --- a/chrome/browser/ui/ash/ash_init.h +++ b/chrome/browser/ui/ash/ash_init.h @@ -5,13 +5,16 @@ #ifndef CHROME_BROWSER_UI_ASH_ASH_INIT_H_ #define CHROME_BROWSER_UI_ASH_ASH_INIT_H_ +#include "ui/gfx/native_widget_types.h" + namespace chrome { // Returns true if Ash should be run at startup. bool ShouldOpenAshOnStartup(); -// Creates the Ash Shell and opens the Ash window. -void OpenAsh(); +// Creates the Ash Shell and opens the Ash window. |remote_window| is only used +// on windows. It provides the HWND to the remote window. +void OpenAsh(gfx::AcceleratedWidget remote_window); // Closes the Ash window and destroys the Ash Shell. void CloseAsh(); diff --git a/chrome/browser/ui/ash/ash_util.cc b/chrome/browser/ui/ash/ash_util.cc index 0b3bdcc..f2670de 100644 --- a/chrome/browser/ui/ash/ash_util.cc +++ b/chrome/browser/ui/ash/ash_util.cc @@ -41,7 +41,7 @@ void ToggleAshDesktop() { return; if (!ash::Shell::HasInstance()) - OpenAsh(); + OpenAsh(gfx::kNullAcceleratedWidget); else CloseAsh(); } diff --git a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc index 6b858b7..f1c3b62 100644 --- a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc +++ b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc @@ -67,7 +67,7 @@ ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { if (chrome::ShouldOpenAshOnStartup()) { - chrome::OpenAsh(); + chrome::OpenAsh(gfx::kNullAcceleratedWidget); } else { #if !defined(OS_CHROMEOS) gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); |