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

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

Issue 2777223002: Gets chrome --mus some what working (Closed)
Patch Set: fix mac Created 3 years, 8 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_shell_delegate.cc » ('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/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/public/cpp/config.h"
9 #include "ash/public/interfaces/event_properties.mojom.h" 10 #include "ash/public/interfaces/event_properties.mojom.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/chromeos/ash_config.h"
14 #include "chrome/browser/ui/ash/ash_init.h" 16 #include "chrome/browser/ui/ash/ash_init.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "content/public/common/service_names.mojom.h" 17 #include "content/public/common/service_names.mojom.h"
17 #include "services/service_manager/public/cpp/interface_registry.h" 18 #include "services/service_manager/public/cpp/interface_registry.h"
18 #include "services/service_manager/public/cpp/service.h" 19 #include "services/service_manager/public/cpp/service.h"
19 #include "services/service_manager/public/interfaces/interface_provider_spec.moj om.h" 20 #include "services/service_manager/public/interfaces/interface_provider_spec.moj om.h"
20 #include "services/service_manager/runner/common/client_util.h"
21 #include "ui/aura/window_event_dispatcher.h" 21 #include "ui/aura/window_event_dispatcher.h"
22 22
23 namespace ash_util { 23 namespace ash_util {
24 24
25 namespace { 25 namespace {
26 26
27 class EmbeddedAshService : public service_manager::Service { 27 class EmbeddedAshService : public service_manager::Service {
28 public: 28 public:
29 explicit EmbeddedAshService( 29 explicit EmbeddedAshService(
30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) 30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
(...skipping 24 matching lines...) Expand all
55 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService( 55 std::unique_ptr<service_manager::Service> CreateEmbeddedAshService(
56 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 56 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
57 return base::MakeUnique<EmbeddedAshService>(task_runner); 57 return base::MakeUnique<EmbeddedAshService>(task_runner);
58 } 58 }
59 59
60 bool ShouldOpenAshOnStartup() { 60 bool ShouldOpenAshOnStartup() {
61 return !IsRunningInMash(); 61 return !IsRunningInMash();
62 } 62 }
63 63
64 bool IsRunningInMash() { 64 bool IsRunningInMash() {
65 return GetConfig() == Config::MASH; 65 return chromeos::GetConfig() == ash::Config::MASH;
66 }
67
68 Config GetConfig() {
69 if (!service_manager::ServiceManagerIsRemote())
70 return Config::CLASSIC;
71
72 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
73 switches::kMusConfig) == switches::kMash
74 ? Config::MASH
75 : Config::MUS;
76 } 66 }
77 67
78 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) { 68 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) {
79 // When running in mash the browser doesn't handle ash accelerators. 69 // When running in mash the browser doesn't handle ash accelerators.
80 if (IsRunningInMash()) 70 if (IsRunningInMash())
81 return false; 71 return false;
82 72
83 return ash::Shell::Get()->accelerator_controller()->IsDeprecated(accelerator); 73 return ash::Shell::Get()->accelerator_controller()->IsDeprecated(accelerator);
84 } 74 }
85 75
86 bool WillAshProcessAcceleratorForEvent(const ui::KeyEvent& key_event) { 76 bool WillAshProcessAcceleratorForEvent(const ui::KeyEvent& key_event) {
87 return key_event.properties() && 77 return key_event.properties() &&
88 key_event.properties()->count( 78 key_event.properties()->count(
89 ash::mojom::kWillProcessAccelerator_KeyEventProperty); 79 ash::mojom::kWillProcessAccelerator_KeyEventProperty);
90 } 80 }
91 81
92 } // namespace ash_util 82 } // namespace ash_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/ash_util.h ('k') | chrome/browser/ui/ash/chrome_shell_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698