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

Side by Side Diff: ui/base/material_design/material_design_controller.cc

Issue 2355513002: Remove ability to switch to pre-MD UI from about:flags. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/base/material_design/material_design_controller.h" 5 #include "ui/base/material_design/material_design_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "ui/events/ozone/evdev/event_device_info.h" 23 #include "ui/events/ozone/evdev/event_device_info.h"
24 #endif // defined(USE_OZONE) 24 #endif // defined(USE_OZONE)
25 25
26 #endif // defined(OS_CHROMEOS) 26 #endif // defined(OS_CHROMEOS)
27 27
28 namespace ui { 28 namespace ui {
29 29
30 bool MaterialDesignController::is_mode_initialized_ = false; 30 bool MaterialDesignController::is_mode_initialized_ = false;
31 31
32 MaterialDesignController::Mode MaterialDesignController::mode_ = 32 MaterialDesignController::Mode MaterialDesignController::mode_ =
33 MaterialDesignController::NON_MATERIAL; 33 MaterialDesignController::MATERIAL_NORMAL;
34 34
35 bool MaterialDesignController::include_secondary_ui_ = false; 35 bool MaterialDesignController::include_secondary_ui_ = false;
36 36
37 // static 37 // static
38 void MaterialDesignController::Initialize() { 38 void MaterialDesignController::Initialize() {
39 TRACE_EVENT0("startup", "MaterialDesignController::InitializeMode"); 39 TRACE_EVENT0("startup", "MaterialDesignController::InitializeMode");
40 CHECK(!is_mode_initialized_); 40 CHECK(!is_mode_initialized_);
41 const std::string switch_value = 41 const std::string switch_value =
42 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 42 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
43 switches::kTopChromeMD); 43 switches::kTopChromeMD);
44 44
45 if (switch_value == switches::kTopChromeMDMaterial) { 45 if (switch_value == switches::kTopChromeMDMaterial) {
46 SetMode(MATERIAL_NORMAL); 46 SetMode(MATERIAL_NORMAL);
47 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { 47 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) {
48 SetMode(MATERIAL_HYBRID); 48 SetMode(MATERIAL_HYBRID);
49 } else if (switch_value == switches::kTopChromeMDNonMaterial) {
50 SetMode(NON_MATERIAL);
51 } else { 49 } else {
52 if (!switch_value.empty()) { 50 if (!switch_value.empty()) {
53 LOG(ERROR) << "Invalid value='" << switch_value 51 LOG(ERROR) << "Invalid value='" << switch_value
54 << "' for command line switch '" << switches::kTopChromeMD 52 << "' for command line switch '" << switches::kTopChromeMD
55 << "'."; 53 << "'.";
56 } 54 }
57 SetMode(DefaultMode()); 55 SetMode(DefaultMode());
58 } 56 }
59 57
60 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 58 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
61 switches::kExtendMdToSecondaryUi); 59 switches::kExtendMdToSecondaryUi);
62 } 60 }
63 61
64 // static 62 // static
65 MaterialDesignController::Mode MaterialDesignController::GetMode() { 63 MaterialDesignController::Mode MaterialDesignController::GetMode() {
66 CHECK(is_mode_initialized_); 64 CHECK(is_mode_initialized_);
67 return mode_; 65 return mode_;
68 } 66 }
69 67
70 // static 68 // static
71 bool MaterialDesignController::IsModeMaterial() { 69 bool MaterialDesignController::IsModeMaterial() {
72 return GetMode() == MATERIAL_NORMAL || GetMode() == MATERIAL_HYBRID; 70 return true;
73 } 71 }
74 72
75 // static 73 // static
76 bool MaterialDesignController::IsSecondaryUiMaterial() { 74 bool MaterialDesignController::IsSecondaryUiMaterial() {
77 return IsModeMaterial() && include_secondary_ui_; 75 return IsModeMaterial() && include_secondary_ui_;
78 } 76 }
79 77
80 // static 78 // static
81 MaterialDesignController::Mode MaterialDesignController::DefaultMode() { 79 MaterialDesignController::Mode MaterialDesignController::DefaultMode() {
82 #if defined(OS_CHROMEOS) 80 #if defined(OS_CHROMEOS)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 is_mode_initialized_ = false; 117 is_mode_initialized_ = false;
120 } 118 }
121 119
122 // static 120 // static
123 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { 121 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) {
124 mode_ = mode; 122 mode_ = mode;
125 is_mode_initialized_ = true; 123 is_mode_initialized_ = true;
126 } 124 }
127 125
128 } // namespace ui 126 } // namespace ui
OLDNEW
« chrome/app/generated_resources.grd ('K') | « ui/base/material_design/material_design_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698