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

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

Issue 1188713007: Moved --top-chrome-md command line switch from chrome_switches to ui_base_switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <string>
6
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/base/ui_base_switches.h"
11
12 namespace ui {
13
14 bool MaterialDesignController::is_look_and_feel_initialized_ = false;
15
16 MaterialDesignController::LookAndFeel MaterialDesignController::look_and_feel_ =
17 MaterialDesignController::LookAndFeel::CLASSIC;
18
19 MaterialDesignController::LookAndFeel
20 MaterialDesignController::GetLookAndFeel() {
21 if (!is_look_and_feel_initialized_)
22 InitializeLookAndFeel();
23 CHECK(is_look_and_feel_initialized_);
24 return look_and_feel_;
25 }
26
27 void MaterialDesignController::InitializeLookAndFeel() {
28 #if !defined(ENABLE_TOPCHROME_MD)
29 SetLookAndFeel(LookAndFeel::CLASSIC);
30 #else
31 const std::string switch_value =
32 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
33 switches::kTopChromeMD);
34
35 if (switch_value == switches::kTopChromeMDEnabled) {
36 SetLookAndFeel(LookAndFeel::MATERIAL);
37 } else if (switch_value == switches::kTopChromeMDHybridEnabled) {
38 SetLookAndFeel(LookAndFeel::HYBRID);
39 } else if (switch_value == switches::kTopChromeMDDisabled ||
40 switch_value == switches::kTopChromeMDDefault) {
41 SetLookAndFeel(LookAndFeel::CLASSIC);
42 } else {
43 NOTREACHED();
tdanderson 2015/06/18 20:54:23 Consider including a message here (NOTREACHED() <<
bruthig 2015/06/22 18:51:11 Done.
44 SetLookAndFeel(LookAndFeel::CLASSIC);
45 }
46 #endif // !defined(ENABLE_TOPCHROME_MD)
47 }
48
49 void MaterialDesignController::UninitializeLookAndFeel() {
50 MaterialDesignController::SetLookAndFeel(
51 MaterialDesignController::LookAndFeel::CLASSIC);
52 is_look_and_feel_initialized_ = false;
53 }
54
55 void MaterialDesignController::SetLookAndFeel(
56 MaterialDesignController::LookAndFeel look_and_feel) {
57 look_and_feel_ = look_and_feel;
58 is_look_and_feel_initialized_ = true;
59 }
60
61 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698