OLD | NEW |
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 "ui/native_theme/native_theme.h" | 5 #include "ui/native_theme/native_theme.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" |
8 #include "ui/base/ui_base_switches.h" | 9 #include "ui/base/ui_base_switches.h" |
9 | 10 |
| 11 // Constants for the new menu style field trial. |
| 12 const char kNewMenuStyleFieldTrialName[] = "NewMenuStyle"; |
| 13 const char kNewMenuStyleFieldTrialGroupName[] = "OldStyle"; |
| 14 |
10 namespace ui { | 15 namespace ui { |
11 | 16 |
12 void NativeTheme::SetScrollbarColors(unsigned inactive_color, | 17 void NativeTheme::SetScrollbarColors(unsigned inactive_color, |
13 unsigned active_color, | 18 unsigned active_color, |
14 unsigned track_color) { | 19 unsigned track_color) { |
15 thumb_inactive_color_ = inactive_color; | 20 thumb_inactive_color_ = inactive_color; |
16 thumb_active_color_ = active_color; | 21 thumb_active_color_ = active_color; |
17 track_color_ = track_color; | 22 track_color_ = track_color; |
18 } | 23 } |
19 | 24 |
20 // NativeTheme::instance() is implemented in the platform specific source files, | 25 // NativeTheme::instance() is implemented in the platform specific source files, |
21 // such as native_theme_win.cc or native_theme_linux.cc | 26 // such as native_theme_win.cc or native_theme_linux.cc |
22 | 27 |
23 // static | 28 // static |
24 bool NativeTheme::IsNewMenuStyleEnabled() { | 29 bool NativeTheme::IsNewMenuStyleEnabled() { |
25 static bool enable_new_menu_style = | 30 static bool enable_new_menu_style = |
26 !CommandLine::ForCurrentProcess()->HasSwitch( | 31 !CommandLine::ForCurrentProcess()->HasSwitch( |
27 switches::kDisableNewMenuStyle); | 32 switches::kDisableNewMenuStyle); |
| 33 // Run experiment only if there is no kDisableNewMenuStyle flag. |
| 34 if (enable_new_menu_style) { |
| 35 enable_new_menu_style = |
| 36 base::FieldTrialList::FindFullName(kNewMenuStyleFieldTrialName) != |
| 37 kNewMenuStyleFieldTrialGroupName; |
| 38 } |
28 return enable_new_menu_style; | 39 return enable_new_menu_style; |
29 } | 40 } |
30 | 41 |
31 NativeTheme::NativeTheme() | 42 NativeTheme::NativeTheme() |
32 : thumb_inactive_color_(0xeaeaea), | 43 : thumb_inactive_color_(0xeaeaea), |
33 thumb_active_color_(0xf4f4f4), | 44 thumb_active_color_(0xf4f4f4), |
34 track_color_(0xd3d3d3) { | 45 track_color_(0xd3d3d3) { |
35 } | 46 } |
36 | 47 |
37 NativeTheme::~NativeTheme() {} | 48 NativeTheme::~NativeTheme() {} |
38 | 49 |
39 } // namespace ui | 50 } // namespace ui |
OLD | NEW |