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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "ui/native_theme/native_theme_switches.h" | 6 #include "ui/native_theme/native_theme_switches.h" |
7 | 7 |
8 namespace switches { | 8 namespace switches { |
9 | 9 |
10 // Enables overlay scrollbars on Aura or Linux. Does nothing on Mac. | 10 // Enables overlay scrollbars on Aura or Linux. Does nothing on Mac. |
11 const char kEnableOverlayScrollbar[] = "enable-overlay-scrollbar"; | 11 const char kEnableOverlayScrollbar[] = "enable-overlay-scrollbar"; |
12 | 12 |
13 // Disables overlay scrollbars on Aura or Linux. Does nothing on Mac. | 13 // Disables overlay scrollbars on Aura or Linux. Does nothing on Mac. |
14 const char kDisableOverlayScrollbar[] = "disable-overlay-scrollbar"; | 14 const char kDisableOverlayScrollbar[] = "disable-overlay-scrollbar"; |
15 | 15 |
16 // Hides scrollbars on Aura, Linux, Android, ChromeOS, MacOS (MacOS | |
17 // support is experimental). | |
18 const char kHideScrollbars[] = "hide-scrollbars"; | |
19 | |
20 } // namespace switches | 16 } // namespace switches |
21 | 17 |
22 namespace ui { | 18 namespace ui { |
23 | 19 |
24 bool IsOverlayScrollbarEnabled() { | 20 bool IsOverlayScrollbarEnabled() { |
25 const base::CommandLine& command_line = | 21 const base::CommandLine& command_line = |
26 *base::CommandLine::ForCurrentProcess(); | 22 *base::CommandLine::ForCurrentProcess(); |
27 | 23 |
28 // Hidden scrollbars are realized through never-showing overlay scrollbars. | |
29 if (ShouldHideScrollbars()) | |
30 return true; | |
31 | |
32 if (command_line.HasSwitch(switches::kDisableOverlayScrollbar)) | 24 if (command_line.HasSwitch(switches::kDisableOverlayScrollbar)) |
33 return false; | 25 return false; |
34 else if (command_line.HasSwitch(switches::kEnableOverlayScrollbar)) | 26 else if (command_line.HasSwitch(switches::kEnableOverlayScrollbar)) |
35 return true; | 27 return true; |
36 | 28 |
37 return false; | 29 return false; |
38 } | 30 } |
39 | 31 |
40 bool ShouldHideScrollbars() { | |
41 const base::CommandLine& command_line = | |
42 *base::CommandLine::ForCurrentProcess(); | |
43 return command_line.HasSwitch(switches::kHideScrollbars); | |
44 } | |
45 | |
46 } // namespace ui | 32 } // namespace ui |
OLD | NEW |