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

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

Issue 1845343005: Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added UpdatewithLocalState call to update colors after MD flag is added to the command line Created 4 years, 8 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 "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/base/ui_base_switches.h" 11 #include "ui/base/ui_base_switches.h"
11 12
12 #if defined(OS_CHROMEOS) 13 #if defined(OS_CHROMEOS)
13 #include "ui/base/touch/touch_device.h" 14 #include "ui/base/touch/touch_device.h"
14 #include "ui/events/devices/device_data_manager.h" 15 #include "ui/events/devices/device_data_manager.h"
15 16
16 #if defined(USE_OZONE) 17 #if defined(USE_OZONE)
17 #include <fcntl.h> 18 #include <fcntl.h>
18 19
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #endif // defined(USE_OZONE) 69 #endif // defined(USE_OZONE)
69 return Mode::MATERIAL_NORMAL; 70 return Mode::MATERIAL_NORMAL;
70 #elif defined(OS_LINUX) 71 #elif defined(OS_LINUX)
71 return Mode::MATERIAL_NORMAL; 72 return Mode::MATERIAL_NORMAL;
72 #else 73 #else
73 return Mode::NON_MATERIAL; 74 return Mode::NON_MATERIAL;
74 #endif // defined(OS_CHROMEOS) 75 #endif // defined(OS_CHROMEOS)
75 } 76 }
76 77
77 void MaterialDesignController::InitializeMode() { 78 void MaterialDesignController::InitializeMode() {
79 TRACE_EVENT0("startup", "MaterialDesignController::InitializeMode");
78 #if !defined(ENABLE_TOPCHROME_MD) 80 #if !defined(ENABLE_TOPCHROME_MD)
79 SetMode(Mode::NON_MATERIAL); 81 SetMode(Mode::NON_MATERIAL);
80 #else 82 #else
81 const std::string switch_value = 83 const std::string switch_value =
82 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 84 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
83 switches::kTopChromeMD); 85 switches::kTopChromeMD);
84 86
85 if (switch_value == switches::kTopChromeMDMaterial) { 87 if (switch_value == switches::kTopChromeMDMaterial) {
86 SetMode(Mode::MATERIAL_NORMAL); 88 SetMode(Mode::MATERIAL_NORMAL);
87 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { 89 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) {
(...skipping 16 matching lines...) Expand all
104 MaterialDesignController::Mode::NON_MATERIAL); 106 MaterialDesignController::Mode::NON_MATERIAL);
105 is_mode_initialized_ = false; 107 is_mode_initialized_ = false;
106 } 108 }
107 109
108 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { 110 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) {
109 mode_ = mode; 111 mode_ = mode;
110 is_mode_initialized_ = true; 112 is_mode_initialized_ = true;
111 } 113 }
112 114
113 } // namespace ui 115 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698