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

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

Issue 1633733004: Use browser top chrome material design by default on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/base/ui_base_switches.h" 10 #include "ui/base/ui_base_switches.h"
(...skipping 10 matching lines...) Expand all
21 InitializeMode(); 21 InitializeMode();
22 CHECK(is_mode_initialized_); 22 CHECK(is_mode_initialized_);
23 return mode_; 23 return mode_;
24 } 24 }
25 25
26 bool MaterialDesignController::IsModeMaterial() { 26 bool MaterialDesignController::IsModeMaterial() {
27 return GetMode() == Mode::MATERIAL_NORMAL || 27 return GetMode() == Mode::MATERIAL_NORMAL ||
28 GetMode() == Mode::MATERIAL_HYBRID; 28 GetMode() == Mode::MATERIAL_HYBRID;
29 } 29 }
30 30
31 MaterialDesignController::Mode MaterialDesignController::DefaultMode() {
32 #if defined(OS_CHROMEOS)
33 return Mode::MATERIAL_NORMAL;
34 #else
35 return Mode::NON_MATERIAL;
36 #endif // defined(OS_CHROMEOS)
37 }
38
31 void MaterialDesignController::InitializeMode() { 39 void MaterialDesignController::InitializeMode() {
32 #if !defined(ENABLE_TOPCHROME_MD) 40 #if !defined(ENABLE_TOPCHROME_MD)
33 SetMode(Mode::NON_MATERIAL); 41 SetMode(Mode::NON_MATERIAL);
34 #else 42 #else
35 const std::string switch_value = 43 const std::string switch_value =
36 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
37 switches::kTopChromeMD); 45 switches::kTopChromeMD);
38 46
39 if (switch_value == switches::kTopChromeMDMaterial) { 47 if (switch_value == switches::kTopChromeMDMaterial) {
40 SetMode(Mode::MATERIAL_NORMAL); 48 SetMode(Mode::MATERIAL_NORMAL);
41 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { 49 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) {
42 SetMode(Mode::MATERIAL_HYBRID); 50 SetMode(Mode::MATERIAL_HYBRID);
43 } else if (switch_value == switches::kTopChromeMDNonMaterial) { 51 } else if (switch_value == switches::kTopChromeMDNonMaterial) {
44 SetMode(Mode::NON_MATERIAL); 52 SetMode(Mode::NON_MATERIAL);
45 } else { 53 } else {
46 LOG(ERROR) << "Invalid value='" << switch_value 54 if (!switch_value.empty()) {
47 << "' for command line switch '" << switches::kTopChromeMD 55 LOG(ERROR) << "Invalid value='" << switch_value
48 << "'."; 56 << "' for command line switch '" << switches::kTopChromeMD
49 SetMode(Mode::NON_MATERIAL); 57 << "'.";
58 }
59 SetMode(DefaultMode());
50 } 60 }
51 #endif // !defined(ENABLE_TOPCHROME_MD) 61 #endif // !defined(ENABLE_TOPCHROME_MD)
52 } 62 }
53 63
54 void MaterialDesignController::UninitializeMode() { 64 void MaterialDesignController::UninitializeMode() {
55 MaterialDesignController::SetMode( 65 MaterialDesignController::SetMode(
56 MaterialDesignController::Mode::NON_MATERIAL); 66 MaterialDesignController::Mode::NON_MATERIAL);
57 is_mode_initialized_ = false; 67 is_mode_initialized_ = false;
58 } 68 }
59 69
60 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { 70 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) {
61 mode_ = mode; 71 mode_ = mode;
62 is_mode_initialized_ = true; 72 is_mode_initialized_ = true;
63 } 73 }
64 74
65 } // namespace ui 75 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/material_design/material_design_controller.h ('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