summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 18:32:23 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 18:32:23 +0000
commit1b4c747749bc8cc46ed2b9006d2f82b6c511e7c4 (patch)
treedadc320dc0f37c5dd756aaee193a72b8697c09b8 /chrome
parent9eab79b4434f1f4346767257af80f066116706f5 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc12
-rw-r--r--chrome/browser/ui/ash/ash_init.cc11
-rw-r--r--chrome/browser/ui/ash/ash_init.h7
-rw-r--r--chrome/browser/ui/ash/ash_util.cc2
-rw-r--r--chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc2
-rw-r--r--chrome/test/base/view_event_test_base.cc5
6 files changed, 24 insertions, 15 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);
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc
index bdba76a..2d64c5d 100644
--- a/chrome/test/base/view_event_test_base.cc
+++ b/chrome/test/base/view_event_test_base.cc
@@ -29,6 +29,7 @@
#if defined(USE_ASH)
#include "ash/shell.h"
+#include "ash/shell_init_params.h"
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
#endif
@@ -128,7 +129,9 @@ void ViewEventTestBase::SetUp() {
#endif // OS_CHROMEOS
ash::test::TestShellDelegate* shell_delegate =
new ash::test::TestShellDelegate();
- ash::Shell::CreateInstance(shell_delegate);
+ ash::ShellInitParams init_params;
+ init_params.delegate = shell_delegate;
+ ash::Shell::CreateInstance(init_params);
shell_delegate->test_session_state_delegate()
->SetActiveUserSessionStarted(true);
context = ash::Shell::GetPrimaryRootWindow();