| 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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/ui/ash/ash_init.h" | 10 #include "chrome/browser/ui/ash/ash_init.h" |
| 11 #include "ui/aura/window_event_dispatcher.h" | 11 #include "ui/aura/window_event_dispatcher.h" |
| 12 | 12 |
| 13 #if defined(MOJO_SHELL_CLIENT) | 13 #if defined(MOJO_SHELL_CLIENT) |
| 14 #include "content/public/common/mojo_shell_connection.h" | 14 #include "content/public/common/mojo_shell_connection.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace chrome { |
| 18 | 18 |
| 19 bool ShouldOpenAshOnStartup() { | 19 bool ShouldOpenAshOnStartup() { |
| 20 #if defined(OS_CHROMEOS) && defined(MOJO_SHELL_CLIENT) | 20 #if defined(OS_CHROMEOS) |
| 21 return !content::MojoShellConnection::Get() || | 21 return !IsRunningInMash(); |
| 22 !content::MojoShellConnection::Get()->UsingExternalShell(); | |
| 23 #elif defined(OS_CHROMEOS) | |
| 24 return true; | |
| 25 #else | 22 #else |
| 26 return false; | 23 return false; |
| 27 #endif | 24 #endif |
| 25 } |
| 26 |
| 27 bool IsRunningInMash() { |
| 28 #if defined(OS_CHROMEOS) && defined(MOJO_SHELL_CLIENT) |
| 29 return content::MojoShellConnection::Get() && |
| 30 content::MojoShellConnection::Get()->UsingExternalShell(); |
| 31 #else |
| 32 return false; |
| 33 #endif |
| 28 } | 34 } |
| 29 | 35 |
| 30 bool IsNativeViewInAsh(gfx::NativeView native_view) { | 36 bool IsNativeViewInAsh(gfx::NativeView native_view) { |
| 31 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 32 // Optimization. There is only ash on ChromeOS. | 38 // Optimization. There is only ash on ChromeOS. |
| 33 return true; | 39 return true; |
| 34 #endif | 40 #endif |
| 35 | 41 |
| 36 if (!ash::Shell::HasInstance()) | 42 if (!ash::Shell::HasInstance()) |
| 37 return false; | 43 return false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 return IsNativeViewInAsh(native_window); | 58 return IsNativeViewInAsh(native_window); |
| 53 } | 59 } |
| 54 | 60 |
| 55 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { | 61 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { |
| 56 ash::AcceleratorController* controller = | 62 ash::AcceleratorController* controller = |
| 57 ash::Shell::GetInstance()->accelerator_controller(); | 63 ash::Shell::GetInstance()->accelerator_controller(); |
| 58 return controller->IsDeprecated(accelerator); | 64 return controller->IsDeprecated(accelerator); |
| 59 } | 65 } |
| 60 | 66 |
| 61 } // namespace chrome | 67 } // namespace chrome |
| OLD | NEW |