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

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

Issue 2001093002: Revert of Remove enable_topchrome_md build flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 <string> 5 #include <string>
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 "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
(...skipping 19 matching lines...) Expand all
30 30
31 MaterialDesignController::Mode MaterialDesignController::mode_ = 31 MaterialDesignController::Mode MaterialDesignController::mode_ =
32 MaterialDesignController::NON_MATERIAL; 32 MaterialDesignController::NON_MATERIAL;
33 33
34 bool MaterialDesignController::include_secondary_ui_ = false; 34 bool MaterialDesignController::include_secondary_ui_ = false;
35 35
36 // static 36 // static
37 void MaterialDesignController::Initialize() { 37 void MaterialDesignController::Initialize() {
38 TRACE_EVENT0("startup", "MaterialDesignController::InitializeMode"); 38 TRACE_EVENT0("startup", "MaterialDesignController::InitializeMode");
39 CHECK(!is_mode_initialized_); 39 CHECK(!is_mode_initialized_);
40 #if !defined(ENABLE_TOPCHROME_MD)
41 SetMode(NON_MATERIAL);
42 #else
40 const std::string switch_value = 43 const std::string switch_value =
41 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
42 switches::kTopChromeMD); 45 switches::kTopChromeMD);
43 46
44 if (switch_value == switches::kTopChromeMDMaterial) { 47 if (switch_value == switches::kTopChromeMDMaterial) {
45 SetMode(MATERIAL_NORMAL); 48 SetMode(MATERIAL_NORMAL);
46 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { 49 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) {
47 SetMode(MATERIAL_HYBRID); 50 SetMode(MATERIAL_HYBRID);
48 } else if (switch_value == switches::kTopChromeMDNonMaterial) { 51 } else if (switch_value == switches::kTopChromeMDNonMaterial) {
49 SetMode(NON_MATERIAL); 52 SetMode(NON_MATERIAL);
50 } else { 53 } else {
51 if (!switch_value.empty()) { 54 if (!switch_value.empty()) {
52 LOG(ERROR) << "Invalid value='" << switch_value 55 LOG(ERROR) << "Invalid value='" << switch_value
53 << "' for command line switch '" << switches::kTopChromeMD 56 << "' for command line switch '" << switches::kTopChromeMD
54 << "'."; 57 << "'.";
55 } 58 }
56 SetMode(DefaultMode()); 59 SetMode(DefaultMode());
57 } 60 }
58 61
59 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 62 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
60 switches::kExtendMdToSecondaryUi); 63 switches::kExtendMdToSecondaryUi);
64 #endif // !defined(ENABLE_TOPCHROME_MD)
61 } 65 }
62 66
63 // static 67 // static
64 MaterialDesignController::Mode MaterialDesignController::GetMode() { 68 MaterialDesignController::Mode MaterialDesignController::GetMode() {
65 CHECK(is_mode_initialized_); 69 CHECK(is_mode_initialized_);
66 return mode_; 70 return mode_;
67 } 71 }
68 72
69 // static 73 // static
70 bool MaterialDesignController::IsModeMaterial() { 74 bool MaterialDesignController::IsModeMaterial() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 is_mode_initialized_ = false; 125 is_mode_initialized_ = false;
122 } 126 }
123 127
124 // static 128 // static
125 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { 129 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) {
126 mode_ = mode; 130 mode_ = mode;
127 is_mode_initialized_ = true; 131 is_mode_initialized_ = true;
128 } 132 }
129 133
130 } // namespace ui 134 } // namespace ui
OLDNEW
« no previous file with comments | « tools/grit/grit_rule.gni ('k') | ui/base/material_design/material_design_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698