OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/ash_init.h" | 5 #include "chrome/browser/ui/ash/ash_init.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerometer/accelerometer_controller.h" | 8 #include "ash/accelerometer/accelerometer_controller.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/high_contrast/high_contrast_controller.h" | 10 #include "ash/high_contrast/high_contrast_controller.h" |
11 #include "ash/magnifier/magnification_controller.h" | 11 #include "ash/magnifier/magnification_controller.h" |
12 #include "ash/magnifier/partial_magnification_controller.h" | 12 #include "ash/magnifier/partial_magnification_controller.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/shell_init_params.h" |
14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
15 #include "chrome/browser/browser_shutdown.h" | 16 #include "chrome/browser/browser_shutdown.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
17 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 18 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
18 #include "chrome/browser/ui/ash/screenshot_taker.h" | 19 #include "chrome/browser/ui/ash/screenshot_taker.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
22 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
23 | 24 |
(...skipping 11 matching lines...) Expand all Loading... |
35 namespace chrome { | 36 namespace chrome { |
36 | 37 |
37 bool ShouldOpenAshOnStartup() { | 38 bool ShouldOpenAshOnStartup() { |
38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
39 return true; | 40 return true; |
40 #endif | 41 #endif |
41 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. | 42 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. |
42 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); | 43 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); |
43 } | 44 } |
44 | 45 |
45 void OpenAsh() { | 46 void OpenAsh(gfx::AcceleratedWidget remote_window) { |
46 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
47 #if defined(USE_X11) | 48 #if defined(USE_X11) |
48 if (base::SysInfo::IsRunningOnChromeOS()) { | 49 if (base::SysInfo::IsRunningOnChromeOS()) { |
49 // Hides the cursor outside of the Aura root window. The cursor will be | 50 // Hides the cursor outside of the Aura root window. The cursor will be |
50 // drawn within the Aura root window, and it'll remain hidden after the | 51 // drawn within the Aura root window, and it'll remain hidden after the |
51 // Aura window is closed. | 52 // Aura window is closed. |
52 ui::HideHostCursor(); | 53 ui::HideHostCursor(); |
53 } | 54 } |
54 #endif | 55 #endif |
55 | 56 |
56 // Hide the mouse cursor completely at boot. | 57 // Hide the mouse cursor completely at boot. |
57 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) | 58 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) |
58 ash::Shell::set_initially_hide_cursor(true); | 59 ash::Shell::set_initially_hide_cursor(true); |
59 #endif | 60 #endif |
60 | 61 |
| 62 ash::ShellInitParams shell_init_params; |
61 // Shell takes ownership of ChromeShellDelegate. | 63 // Shell takes ownership of ChromeShellDelegate. |
62 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | 64 shell_init_params.delegate = new ChromeShellDelegate; |
| 65 #if defined(OS_WIN) |
| 66 shell_init_params.remote_hwnd = remote_window; |
| 67 #endif |
| 68 |
| 69 ash::Shell* shell = ash::Shell::CreateInstance(shell_init_params); |
63 shell->accelerator_controller()->SetScreenshotDelegate( | 70 shell->accelerator_controller()->SetScreenshotDelegate( |
64 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); | 71 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); |
65 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. | 72 // TODO(flackr): Investigate exposing a blocking pool task runner to chromeos. |
66 shell->accelerometer_controller()->Initialize( | 73 shell->accelerometer_controller()->Initialize( |
67 content::BrowserThread::GetBlockingPool()-> | 74 content::BrowserThread::GetBlockingPool()-> |
68 GetTaskRunnerWithShutdownBehavior( | 75 GetTaskRunnerWithShutdownBehavior( |
69 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 76 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
70 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
71 shell->accelerator_controller()->SetImeControlDelegate( | 78 shell->accelerator_controller()->SetImeControlDelegate( |
72 scoped_ptr<ash::ImeControlDelegate>(new ImeController).Pass()); | 79 scoped_ptr<ash::ImeControlDelegate>(new ImeController).Pass()); |
(...skipping 17 matching lines...) Expand all Loading... |
90 #endif | 97 #endif |
91 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 98 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
92 } | 99 } |
93 | 100 |
94 void CloseAsh() { | 101 void CloseAsh() { |
95 if (ash::Shell::HasInstance()) | 102 if (ash::Shell::HasInstance()) |
96 ash::Shell::DeleteInstance(); | 103 ash::Shell::DeleteInstance(); |
97 } | 104 } |
98 | 105 |
99 } // namespace chrome | 106 } // namespace chrome |
OLD | NEW |