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 IsMaterial(). |
| 21 static void Initialize(); |
| 22 |
| 23 // Returns true if Material Design is enabled in Chrome OS system UI. |
| 24 // Maps to "ash-enable-md" and "ash-diable-md flags" pair of flags. |
| 25 // Returns false if both flags are specified in command line. |
| 26 static bool IsMaterial(); |
| 27 |
| 28 private: |
| 29 friend class test::MaterialDesignControllerTestAPI; |
| 30 |
| 31 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 32 // reset the state back to a clean state during tear down. |
| 33 static bool is_mode_initialized_; |
| 34 |
| 35 // True if Material Design is enabled in Chrome OS system UI. |
| 36 static bool mode_; |
| 37 |
| 38 // Declarations only. Do not allow construction of an object. |
| 39 MaterialDesignController(); |
| 40 ~MaterialDesignController(); |
| 41 |
| 42 // Returns the per-platform default material design variant. |
| 43 static bool DefaultMode(); |
| 44 |
| 45 // Sets |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 46 // used by tests to directly set the mode. |
| 47 static void SetMode(bool mode); |
| 48 |
| 49 // Resets the initialization state to uninitialized. To be used by tests to |
| 50 // allow calling Initialize() more than once. |
| 51 static void Uninitialize(); |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 54 }; |
| 55 |
| 56 } // namespace ash |
| 57 |
| 58 #endif // ASH_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
OLD | NEW |