OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 6 #define ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "base/macros.h" |
| 10 |
| 11 namespace ash { |
| 12 |
| 13 namespace test { |
| 14 class MaterialDesignControllerTestAPI; |
| 15 } // namespace test |
| 16 |
| 17 // Central controller to handle material design modes. |
| 18 class ASH_EXPORT MaterialDesignController { |
| 19 public: |
| 20 // Initializes |mode_|. Must be called before calling IsModeMaterial(). |
| 21 static void Initialize(); |
| 22 |
| 23 // Returns true if Material Design is enabled in Chrome OS system UI. |
| 24 static bool IsMaterial(); |
| 25 |
| 26 private: |
| 27 friend class test::MaterialDesignControllerTestAPI; |
| 28 |
| 29 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 30 // reset the state back to a clean state during tear down. |
| 31 static bool is_mode_initialized_; |
| 32 |
| 33 // True if Material Design is enabled in Chrome OS system UI. |
| 34 static bool mode_; |
| 35 |
| 36 // Declarations only. Do not allow construction of an object. |
| 37 MaterialDesignController(); |
| 38 ~MaterialDesignController(); |
| 39 |
| 40 // Returns the per-platform default material design variant. |
| 41 static bool DefaultMode(); |
| 42 |
| 43 // Sets |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 44 // used by tests to directly set the mode. |
| 45 static void SetMode(bool mode); |
| 46 |
| 47 // Resets the initialization state to uninitialized. To be used by tests to |
| 48 // allow calling Initialize() more than once. |
| 49 static void Uninitialize(); |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 52 }; |
| 53 |
| 54 } // namespace ash |
| 55 |
| 56 #endif // ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
OLD | NEW |