Chromium Code Reviews| 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..e9f672978d668c3c4d07ba65b7b35437d51a31c6 |
| --- /dev/null |
| +++ b/ash/material_design/material_design_controller.cc |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 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)) { |
|
oshima
2016/04/26 05:56:37
By the way, I personally prefer not to have two fl
varkha
2016/04/26 15:06:02
oshima@, how strongly do you feel about it? I can
oshima
2016/04/26 16:06:57
I don't have strong feeling about this. This is ju
|
| + 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 |