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

Unified Diff: ash/material_design/material_design_controller.cc

Issue 1921133002: Adds ash::MaterialDesignController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds ash::MaterialDesignController (doc) 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698