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_util.h" | 5 #include "chrome/browser/ui/ash/ash_util.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | |
8 #include "chrome/browser/ui/ash/ash_init.h" | 9 #include "chrome/browser/ui/ash/ash_init.h" |
9 #include "chrome/browser/ui/host_desktop.h" | 10 #include "chrome/browser/ui/host_desktop.h" |
11 #include "chrome/common/chrome_switches.h" | |
10 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
11 | 13 |
12 namespace chrome { | 14 namespace chrome { |
13 | 15 |
16 bool ShouldOpenAshOnStartup() { | |
17 #if defined(OS_CHROMEOS) | |
18 return true; | |
19 #endif | |
oshima
2014/10/11 01:20:36
nit: #else, and include headers only for !cros.
| |
20 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. | |
21 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); | |
22 } | |
23 | |
14 bool IsNativeViewInAsh(gfx::NativeView native_view) { | 24 bool IsNativeViewInAsh(gfx::NativeView native_view) { |
15 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
16 // Optimization. There is only ash or only athena on ChromeOS. | 26 // Optimization. There is only ash or only athena on ChromeOS. |
17 return ash::Shell::HasInstance(); | 27 return ash::Shell::HasInstance(); |
18 #endif | 28 #endif |
19 | 29 |
20 if (!ash::Shell::HasInstance()) | 30 if (!ash::Shell::HasInstance()) |
21 return false; | 31 return false; |
22 | 32 |
23 aura::Window::Windows root_windows = | 33 aura::Window::Windows root_windows = |
24 ash::Shell::GetInstance()->GetAllRootWindows(); | 34 ash::Shell::GetInstance()->GetAllRootWindows(); |
25 | 35 |
26 for (aura::Window::Windows::const_iterator it = root_windows.begin(); | 36 for (aura::Window::Windows::const_iterator it = root_windows.begin(); |
27 it != root_windows.end(); ++it) { | 37 it != root_windows.end(); ++it) { |
28 if ((*it)->Contains(native_view)) | 38 if ((*it)->Contains(native_view)) |
29 return true; | 39 return true; |
30 } | 40 } |
31 | 41 |
32 return false; | 42 return false; |
33 } | 43 } |
34 | 44 |
35 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { | 45 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { |
36 return IsNativeViewInAsh(native_window); | 46 return IsNativeViewInAsh(native_window); |
37 } | 47 } |
38 | 48 |
39 } // namespace chrome | 49 } // namespace chrome |
OLD | NEW |