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/accelerators/accelerator_controller.h"
9 #include "chrome/browser/ui/ash/ash_init.h"
10 #include "chrome/browser/ui/host_desktop.h"
11 #include "ui/aura/window_event_dispatcher.h"
13 #if !defined(OS_CHROMEOS)
14 #include "base/command_line.h"
15 #include "chrome/common/chrome_switches.h"
20 bool ShouldOpenAshOnStartup() {
21 #if defined(OS_CHROMEOS)
24 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too.
25 return base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh
);
29 bool IsNativeViewInAsh(gfx::NativeView native_view
) {
30 #if defined(OS_CHROMEOS)
31 // Optimization. There is only ash on ChromeOS.
35 if (!ash::Shell::HasInstance())
38 aura::Window::Windows root_windows
=
39 ash::Shell::GetInstance()->GetAllRootWindows();
41 for (aura::Window::Windows::const_iterator it
= root_windows
.begin();
42 it
!= root_windows
.end(); ++it
) {
43 if ((*it
)->Contains(native_view
))
50 bool IsNativeWindowInAsh(gfx::NativeWindow native_window
) {
51 return IsNativeViewInAsh(native_window
);
54 bool IsAcceleratorDeprecated(const ui::Accelerator
& accelerator
) {
55 ash::AcceleratorController
* controller
=
56 ash::Shell::GetInstance()->accelerator_controller();
57 return controller
->IsDeprecated(accelerator
);