OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/common/config.h" | 5 #include "mash/common/config.h" |
6 | 6 |
7 #if defined(USE_ASH) | |
8 #include "ash/public/interfaces/constants.mojom.h" // nogncheck | |
9 #endif | |
7 #include "base/command_line.h" | 10 #include "base/command_line.h" |
8 | 11 |
9 namespace mash { | 12 namespace mash { |
10 namespace common { | 13 namespace common { |
11 | 14 |
12 const char kWindowManagerSwitch[] = "window-manager"; | 15 const char kWindowManagerSwitch[] = "window-manager"; |
13 | 16 |
14 std::string GetWindowManagerServiceName() { | 17 std::string GetWindowManagerServiceName() { |
15 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kWindowManagerSwitch)) { | 18 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kWindowManagerSwitch)) { |
16 std::string service_name = | 19 std::string service_name = |
17 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 20 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
18 kWindowManagerSwitch); | 21 kWindowManagerSwitch); |
19 return service_name; | 22 return service_name; |
20 } | 23 } |
21 // TODO(beng): move this constant to a mojom file in //ash. | 24 #if defined(USE_ASH) |
22 return "ash"; | 25 return ash::mojom::kServiceName; |
26 #else | |
27 LOG(FATAL) | |
28 << "You must specify a window manager e.g. --window-manager=simple_wm"; | |
29 return ""; | |
dcheng
2017/02/22 18:01:07
Nit: std::string() is more efficient than an impli
| |
30 #endif | |
23 } | 31 } |
24 | 32 |
25 } // namespace common | 33 } // namespace common |
26 } // namespace mash | 34 } // namespace mash |
OLD | NEW |