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/mojo_interface_factory.h" | 8 #include "ash/common/mojo_interface_factory.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "chrome/browser/ui/ash/ash_init.h" | 13 #include "chrome/browser/ui/ash/ash_init.h" |
| 14 #include "chrome/common/chrome_switches.h" |
13 #include "content/public/common/service_names.mojom.h" | 15 #include "content/public/common/service_names.mojom.h" |
14 #include "services/service_manager/public/cpp/interface_registry.h" | 16 #include "services/service_manager/public/cpp/interface_registry.h" |
15 #include "services/service_manager/public/cpp/service.h" | 17 #include "services/service_manager/public/cpp/service.h" |
16 #include "services/service_manager/public/interfaces/interface_provider_spec.moj
om.h" | 18 #include "services/service_manager/public/interfaces/interface_provider_spec.moj
om.h" |
17 #include "services/service_manager/runner/common/client_util.h" | 19 #include "services/service_manager/runner/common/client_util.h" |
18 #include "ui/aura/window_event_dispatcher.h" | 20 #include "ui/aura/window_event_dispatcher.h" |
19 | 21 |
20 namespace ash_util { | 22 namespace ash_util { |
21 | 23 |
22 namespace { | 24 namespace { |
(...skipping 29 matching lines...) Expand all Loading... |
52 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService( | 54 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService( |
53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
54 return base::MakeUnique<EmbeddedAshService>(task_runner); | 56 return base::MakeUnique<EmbeddedAshService>(task_runner); |
55 } | 57 } |
56 | 58 |
57 bool ShouldOpenAshOnStartup() { | 59 bool ShouldOpenAshOnStartup() { |
58 return !IsRunningInMash(); | 60 return !IsRunningInMash(); |
59 } | 61 } |
60 | 62 |
61 bool IsRunningInMash() { | 63 bool IsRunningInMash() { |
62 return service_manager::ServiceManagerIsRemote(); | 64 return GetConfig() == Config::MASH; |
| 65 } |
| 66 |
| 67 Config GetConfig() { |
| 68 if (!service_manager::ServiceManagerIsRemote()) |
| 69 return Config::CLASSIC; |
| 70 |
| 71 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 72 switches::kMusConfig) == switches::kMash |
| 73 ? Config::MASH |
| 74 : Config::MUS; |
63 } | 75 } |
64 | 76 |
65 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { | 77 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { |
66 // When running in mash the browser doesn't handle ash accelerators. | 78 // When running in mash the browser doesn't handle ash accelerators. |
67 if (IsRunningInMash()) | 79 if (IsRunningInMash()) |
68 return false; | 80 return false; |
69 | 81 |
70 return ash::Shell::Get()->accelerator_controller()->IsDeprecated(accelerator); | 82 return ash::Shell::Get()->accelerator_controller()->IsDeprecated(accelerator); |
71 } | 83 } |
72 | 84 |
73 } // namespace ash_util | 85 } // namespace ash_util |
OLD | NEW |