OLD | NEW |
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 Loading... |
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 | |
43 const std::string switch_value = | 40 const std::string switch_value = |
44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 41 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
45 switches::kTopChromeMD); | 42 switches::kTopChromeMD); |
46 | 43 |
47 if (switch_value == switches::kTopChromeMDMaterial) { | 44 if (switch_value == switches::kTopChromeMDMaterial) { |
48 SetMode(MATERIAL_NORMAL); | 45 SetMode(MATERIAL_NORMAL); |
49 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { | 46 } else if (switch_value == switches::kTopChromeMDMaterialHybrid) { |
50 SetMode(MATERIAL_HYBRID); | 47 SetMode(MATERIAL_HYBRID); |
51 } else if (switch_value == switches::kTopChromeMDNonMaterial) { | 48 } else if (switch_value == switches::kTopChromeMDNonMaterial) { |
52 SetMode(NON_MATERIAL); | 49 SetMode(NON_MATERIAL); |
53 } else { | 50 } else { |
54 if (!switch_value.empty()) { | 51 if (!switch_value.empty()) { |
55 LOG(ERROR) << "Invalid value='" << switch_value | 52 LOG(ERROR) << "Invalid value='" << switch_value |
56 << "' for command line switch '" << switches::kTopChromeMD | 53 << "' for command line switch '" << switches::kTopChromeMD |
57 << "'."; | 54 << "'."; |
58 } | 55 } |
59 SetMode(DefaultMode()); | 56 SetMode(DefaultMode()); |
60 } | 57 } |
61 | 58 |
62 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch( | 59 include_secondary_ui_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
63 switches::kExtendMdToSecondaryUi); | 60 switches::kExtendMdToSecondaryUi); |
64 #endif // !defined(ENABLE_TOPCHROME_MD) | |
65 } | 61 } |
66 | 62 |
67 // static | 63 // static |
68 MaterialDesignController::Mode MaterialDesignController::GetMode() { | 64 MaterialDesignController::Mode MaterialDesignController::GetMode() { |
69 CHECK(is_mode_initialized_); | 65 CHECK(is_mode_initialized_); |
70 return mode_; | 66 return mode_; |
71 } | 67 } |
72 | 68 |
73 // static | 69 // static |
74 bool MaterialDesignController::IsModeMaterial() { | 70 bool MaterialDesignController::IsModeMaterial() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 is_mode_initialized_ = false; | 121 is_mode_initialized_ = false; |
126 } | 122 } |
127 | 123 |
128 // static | 124 // static |
129 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { | 125 void MaterialDesignController::SetMode(MaterialDesignController::Mode mode) { |
130 mode_ = mode; | 126 mode_ = mode; |
131 is_mode_initialized_ = true; | 127 is_mode_initialized_ = true; |
132 } | 128 } |
133 | 129 |
134 } // namespace ui | 130 } // namespace ui |
OLD | NEW |