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"
8 #include "chrome/browser/ui/ash/ash_init.h"
9 #include "chrome/browser/ui/host_desktop.h"
10 #include "ui/aura/window_event_dispatcher.h"
12 #if !defined(OS_CHROMEOS)
13 #include "base/command_line.h"
14 #include "chrome/common/chrome_switches.h"
19 bool ShouldOpenAshOnStartup() {
20 #if defined(OS_CHROMEOS)
23 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too.
24 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh);
28 bool IsNativeViewInAsh(gfx::NativeView native_view) {
29 #if defined(OS_CHROMEOS)
30 // Optimization. There is only ash or only athena on ChromeOS.
31 return ash::Shell::HasInstance();
34 if (!ash::Shell::HasInstance())
37 aura::Window::Windows root_windows =
38 ash::Shell::GetInstance()->GetAllRootWindows();
40 for (aura::Window::Windows::const_iterator it = root_windows.begin();
41 it != root_windows.end(); ++it) {
42 if ((*it)->Contains(native_view))
49 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) {
50 return IsNativeViewInAsh(native_window);