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

Side by Side Diff: mash/common/config.cc

Issue 2710673002: Add Mojo constant for "ash" and replace hardcoded strings (Closed)
Patch Set: Only add "ash" Mojo constant and add fatal error when USE_ASH=0 Created 3 years, 10 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 | « mash/common/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « mash/common/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698