Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Side by Side Diff: chrome/browser/ui/ash/ash_util.cc

Issue 1960293003: Remove OS_CHROMEOS from ui/ash code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/ash_util.h ('k') | chrome/browser/ui/ash/chrome_new_window_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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)
21 return !IsRunningInMash(); 20 return !IsRunningInMash();
22 #else
23 return false;
24 #endif
25 } 21 }
26 22
27 bool IsRunningInMash() { 23 bool IsRunningInMash() {
28 #if defined(OS_CHROMEOS) && defined(MOJO_SHELL_CLIENT) 24 #if defined(MOJO_SHELL_CLIENT)
29 return content::MojoShellConnection::Get() && 25 return content::MojoShellConnection::Get() &&
30 content::MojoShellConnection::Get()->UsingExternalShell(); 26 content::MojoShellConnection::Get()->UsingExternalShell();
31 #else 27 #else
32 return false; 28 return false;
33 #endif 29 #endif
34 } 30 }
35 31
36 bool IsNativeViewInAsh(gfx::NativeView native_view) {
37 #if defined(OS_CHROMEOS)
38 // Optimization. There is only ash on ChromeOS.
39 return true;
40 #endif
41
42 if (!ash::Shell::HasInstance())
43 return false;
44
45 aura::Window::Windows root_windows =
46 ash::Shell::GetInstance()->GetAllRootWindows();
47
48 for (aura::Window::Windows::const_iterator it = root_windows.begin();
49 it != root_windows.end(); ++it) {
50 if ((*it)->Contains(native_view))
51 return true;
52 }
53
54 return false;
55 }
56
57 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) {
58 return IsNativeViewInAsh(native_window);
59 }
60
61 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { 32 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) {
62 // When running in mash the browser doesn't handle ash accelerators. 33 // When running in mash the browser doesn't handle ash accelerators.
63 if (chrome::IsRunningInMash()) 34 if (chrome::IsRunningInMash())
64 return false; 35 return false;
65 36
66 ash::AcceleratorController* controller = 37 ash::AcceleratorController* controller =
67 ash::Shell::GetInstance()->accelerator_controller(); 38 ash::Shell::GetInstance()->accelerator_controller();
68 return controller->IsDeprecated(accelerator); 39 return controller->IsDeprecated(accelerator);
69 } 40 }
70 41
71 } // namespace chrome 42 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/ash_util.h ('k') | chrome/browser/ui/ash/chrome_new_window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698