Index: ash/material_design/material_design_controller.cc |
diff --git a/ash/material_design/material_design_controller.cc b/ash/material_design/material_design_controller.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..39b6438eab35c2e3b69cd340f31c0256d2deaee7 |
--- /dev/null |
+++ b/ash/material_design/material_design_controller.cc |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <string> |
+ |
+#include "ash/ash_switches.h" |
+#include "ash/material_design/material_design_controller.h" |
+#include "base/command_line.h" |
+#include "base/logging.h" |
+#include "base/trace_event/trace_event.h" |
+ |
+namespace ash { |
+ |
+bool MaterialDesignController::is_mode_initialized_ = false; |
+bool MaterialDesignController::mode_ = false; |
+ |
+// static |
+void MaterialDesignController::Initialize() { |
+ TRACE_EVENT0("startup", "ash::MaterialDesignController::InitializeMode"); |
+ CHECK(!is_mode_initialized_); |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kAshDisableMaterialDesign)) { |
+ SetMode(false); |
+ } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kAshEnableMaterialDesign)) { |
+ SetMode(true); |
+ } else { |
+ SetMode(DefaultMode()); |
+ } |
+} |
+ |
+// static |
+bool MaterialDesignController::IsMaterial() { |
+ CHECK(is_mode_initialized_); |
+ return mode_; |
+} |
+ |
+// static |
+bool MaterialDesignController::DefaultMode() { |
+ return false; |
+} |
+ |
+// static |
+void MaterialDesignController::SetMode(bool mode) { |
+ mode_ = mode; |
+ is_mode_initialized_ = true; |
+} |
+ |
+// static |
+void MaterialDesignController::Uninitialize() { |
+ is_mode_initialized_ = false; |
+} |
+ |
+} // namespace ui |