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/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_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 "content/public/common/service_names.mojom.h" |
11 #include "services/service_manager/runner/common/client_util.h" | 12 #include "services/service_manager/runner/common/client_util.h" |
12 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
13 | 14 |
| 15 namespace ash_util { |
| 16 |
| 17 const char* GetAshServiceName() { |
| 18 // Under mash the ash process provides the service. |
| 19 if (chrome::IsRunningInMash()) |
| 20 return "ash"; |
| 21 |
| 22 // Under classic ash the browser process provides the service. |
| 23 return content::mojom::kBrowserServiceName; |
| 24 } |
| 25 |
| 26 } // namespace ash_util |
| 27 |
14 namespace chrome { | 28 namespace chrome { |
15 | 29 |
16 bool ShouldOpenAshOnStartup() { | 30 bool ShouldOpenAshOnStartup() { |
17 return !IsRunningInMash(); | 31 return !IsRunningInMash(); |
18 } | 32 } |
19 | 33 |
20 bool IsRunningInMash() { | 34 bool IsRunningInMash() { |
21 return service_manager::ServiceManagerIsRemote(); | 35 return service_manager::ServiceManagerIsRemote(); |
22 } | 36 } |
23 | 37 |
24 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { | 38 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { |
25 // When running in mash the browser doesn't handle ash accelerators. | 39 // When running in mash the browser doesn't handle ash accelerators. |
26 if (chrome::IsRunningInMash()) | 40 if (chrome::IsRunningInMash()) |
27 return false; | 41 return false; |
28 | 42 |
29 return ash::WmShell::Get()->accelerator_controller()->IsDeprecated( | 43 return ash::WmShell::Get()->accelerator_controller()->IsDeprecated( |
30 accelerator); | 44 accelerator); |
31 } | 45 } |
32 | 46 |
33 } // namespace chrome | 47 } // namespace chrome |
OLD | NEW |