OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chromeos/ash_config.h" | 5 #include "chrome/browser/chromeos/ash_config.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "services/service_manager/runner/common/client_util.h" | 9 #include "services/service_manager/runner/common/client_util.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
| 13 namespace { |
| 14 |
| 15 ash::Config ComputeAshConfig() { |
| 16 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 17 std::string flag = command_line->GetSwitchValueASCII(switches::kMusConfig); |
| 18 ash::Config config = ash::Config::CLASSIC; |
| 19 if (command_line->HasSwitch("mash") || flag == switches::kMash) |
| 20 config = ash::Config::MASH; |
| 21 else if (command_line->HasSwitch("mus") || flag == switches::kMus) |
| 22 config = ash::Config::MUS; |
| 23 VLOG_IF(1, config != ash::Config::CLASSIC && |
| 24 !service_manager::ServiceManagerIsRemote()) |
| 25 << " Running with a simulated ash config (likely for testing)."; |
| 26 return config; |
| 27 } |
| 28 |
| 29 } // namespace |
| 30 |
13 ash::Config GetAshConfig() { | 31 ash::Config GetAshConfig() { |
14 if (!service_manager::ServiceManagerIsRemote()) | 32 static const ash::Config config = ComputeAshConfig(); |
15 return ash::Config::CLASSIC; | 33 return config; |
16 | |
17 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
18 switches::kMusConfig) == switches::kMash | |
19 ? ash::Config::MASH | |
20 : ash::Config::MUS; | |
21 } | 34 } |
22 | 35 |
23 } // namespace chromeos | 36 } // namespace chromeos |
OLD | NEW |