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 "chrome/browser/ui/ash/ash_init.h" | 8 #include "chrome/browser/ui/ash/ash_init.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/gfx/screen.h" | |
oshima
2012/10/10 17:58:23
do you need this?
scottmg
2012/10/10 19:04:47
Done.
| |
10 | 11 |
11 namespace chrome { | 12 namespace chrome { |
12 | 13 |
13 bool IsNativeViewInAsh(gfx::NativeView native_view) { | 14 bool IsNativeViewInAsh(gfx::NativeView native_view) { |
14 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
15 // Optimization. There is only ash on ChromeOS. | 16 // Optimization. There is only ash on ChromeOS. |
16 return true; | 17 return true; |
17 #endif | 18 #endif |
18 | 19 |
19 if (!ash::Shell::HasInstance()) | 20 if (!ash::Shell::HasInstance()) |
20 return false; | 21 return false; |
21 | 22 |
22 ash::Shell::RootWindowList root_windows = | 23 ash::Shell::RootWindowList root_windows = |
23 ash::Shell::GetInstance()->GetAllRootWindows(); | 24 ash::Shell::GetInstance()->GetAllRootWindows(); |
24 | 25 |
25 for (ash::Shell::RootWindowList::const_iterator it = root_windows.begin(); | 26 for (ash::Shell::RootWindowList::const_iterator it = root_windows.begin(); |
26 it != root_windows.end(); ++it) { | 27 it != root_windows.end(); ++it) { |
27 if ((*it)->Contains(native_view)) | 28 if ((*it)->Contains(native_view)) |
28 return true; | 29 return true; |
29 } | 30 } |
30 | 31 |
31 return false; | 32 return false; |
32 } | 33 } |
33 | 34 |
34 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { | 35 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { |
35 return IsNativeViewInAsh(native_window); | 36 return IsNativeViewInAsh(native_window); |
36 } | 37 } |
37 | 38 |
38 void ToggleAshDesktop() { | 39 void ToggleAshDesktop() { |
40 // TODO(scottmg): Probably need to force Ash here. http://crbug.com/133312 | |
39 if (!ash::Shell::HasInstance()) | 41 if (!ash::Shell::HasInstance()) |
40 OpenAsh(); | 42 OpenAsh(); |
41 else | 43 else |
42 CloseAsh(); | 44 CloseAsh(); |
43 } | 45 } |
44 | 46 |
45 } // namespace chrome | 47 } // namespace chrome |
OLD | NEW |