Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / ash / ash_util.cc
blob8d51b019d1d984cb023b97db8df534436689a47b
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/ash/ash_util.h"
7 #include "ash/shell.h"
8 #include "chrome/browser/ui/ash/ash_init.h"
9 #include "chrome/browser/ui/host_desktop.h"
10 #include "ui/aura/root_window.h"
12 namespace chrome {
14 bool IsNativeViewInAsh(gfx::NativeView native_view) {
15 #if defined(OS_CHROMEOS)
16 // Optimization. There is only ash on ChromeOS.
17 return true;
18 #endif
20 if (!ash::Shell::HasInstance())
21 return false;
23 aura::Window::Windows root_windows =
24 ash::Shell::GetInstance()->GetAllRootWindows();
26 for (aura::Window::Windows::const_iterator it = root_windows.begin();
27 it != root_windows.end(); ++it) {
28 if ((*it)->Contains(native_view))
29 return true;
32 return false;
35 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) {
36 return IsNativeViewInAsh(native_window);
39 void ToggleAshDesktop() {
40 if (chrome::HOST_DESKTOP_TYPE_ASH == chrome::HOST_DESKTOP_TYPE_NATIVE)
41 return;
43 if (!ash::Shell::HasInstance())
44 OpenAsh();
45 else
46 CloseAsh();
49 } // namespace chrome