Chromium Code Reviews| Index: ash/material_design/material_design_controller.h |
| diff --git a/ash/material_design/material_design_controller.h b/ash/material_design/material_design_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c66842c80e4b67881c6617818075af9bdefca199 |
| --- /dev/null |
| +++ b/ash/material_design/material_design_controller.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
|
oshima
2016/04/25 23:01:43
2016
same for other files.
varkha
2016/04/25 23:16:05
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| +#define ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/macros.h" |
| + |
| +namespace ash { |
| + |
| +namespace test { |
| +class MaterialDesignControllerTestAPI; |
| +} // namespace test |
| + |
| +// Central controller to handle material design modes. |
| +class ASH_EXPORT MaterialDesignController { |
| + public: |
| + // Initializes |mode_|. Must be called before calling IsModeMaterial(). |
| + static void Initialize(); |
| + |
| + // Returns true if Material Design is enabled in Chrome OS system UI. |
| + static bool IsMaterial(); |
| + |
| + private: |
| + friend class test::MaterialDesignControllerTestAPI; |
| + |
| + // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| + // reset the state back to a clean state during tear down. |
| + static bool is_mode_initialized_; |
| + |
| + // True if Material Design is enabled in Chrome OS system UI. |
| + static bool mode_; |
|
oshima
2016/04/25 23:01:43
move private static to anonymous namespace in .cc
varkha
2016/04/25 23:16:05
It is used by a friend MaterialDesignControllerTes
oshima
2016/04/26 05:56:37
In that case, how about defiing enum
enum class M
varkha
2016/04/26 15:06:02
I think this doesn't do what I want to accomplish:
oshima
2016/04/26 16:06:57
mode_(NONE) will do it.
|
| + |
| + // Declarations only. Do not allow construction of an object. |
| + MaterialDesignController(); |
| + ~MaterialDesignController(); |
| + |
| + // Returns the per-platform default material design variant. |
| + static bool DefaultMode(); |
| + |
| + // Sets |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| + // used by tests to directly set the mode. |
| + static void SetMode(bool mode); |
| + |
| + // Resets the initialization state to uninitialized. To be used by tests to |
| + // allow calling Initialize() more than once. |
| + static void Uninitialize(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |