OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/platform_selection.h" | 5 #include "ui/ozone/platform_selection.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/ozone/platform_list.h" | 9 #include "ui/ozone/platform_list.h" |
10 #include "ui/ozone/public/ozone_switches.h" | 10 #include "ui/ozone/public/ozone_switches.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Returns the name of the platform to use (value of --ozone-platform flag). | 16 // Returns the name of the platform to use (value of --ozone-platform flag). |
17 std::string GetPlatformName() { | 17 std::string GetPlatformName() { |
18 // The first platform is the default. | 18 // The first platform is the default. |
19 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kOzonePlatform) && | 19 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 20 switches::kOzonePlatform) && |
20 kPlatformCount > 0) | 21 kPlatformCount > 0) |
21 return kPlatformNames[0]; | 22 return kPlatformNames[0]; |
22 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 23 return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
23 switches::kOzonePlatform); | 24 switches::kOzonePlatform); |
24 } | 25 } |
25 | 26 |
26 int g_selected_platform = -1; | 27 int g_selected_platform = -1; |
27 | 28 |
28 } // namespace | 29 } // namespace |
29 | 30 |
30 int GetOzonePlatformId() { | 31 int GetOzonePlatformId() { |
31 if (g_selected_platform >= 0) | 32 if (g_selected_platform >= 0) |
32 return g_selected_platform; | 33 return g_selected_platform; |
(...skipping 10 matching lines...) Expand all Loading... |
43 | 44 |
44 LOG(FATAL) << "Invalid ozone platform: " << platform_name; | 45 LOG(FATAL) << "Invalid ozone platform: " << platform_name; |
45 return -1; // not reached | 46 return -1; // not reached |
46 } | 47 } |
47 | 48 |
48 const char* GetOzonePlatformName() { | 49 const char* GetOzonePlatformName() { |
49 return kPlatformNames[GetOzonePlatformId()]; | 50 return kPlatformNames[GetOzonePlatformId()]; |
50 } | 51 } |
51 | 52 |
52 } // namespace ui | 53 } // namespace ui |
OLD | NEW |