OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 UI_BASE_RESOURCE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 6 #define UI_BASE_RESOURCE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "ui/base/ui_base_export.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 namespace test { |
| 14 class MaterialDesignControllerTestAPI; |
| 15 } // namespace test |
| 16 |
| 17 // Central controller to handle material design modes. |
| 18 class UI_BASE_EXPORT MaterialDesignController { |
| 19 public: |
| 20 // The different material design modes. |
| 21 enum class Mode { |
| 22 // Basic material design. |
| 23 MATERIAL, |
| 24 // Material design targeted at mouse/touch hybrid devices. |
| 25 MATERIAL_HYBRID, |
| 26 // Classic, non-material design. |
| 27 NON_MATERIAL |
| 28 }; |
| 29 |
| 30 // Get the current Mode that should be used by the system. |
| 31 static Mode GetMode(); |
| 32 |
| 33 private: |
| 34 friend class test::MaterialDesignControllerTestAPI; |
| 35 |
| 36 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 37 // reset the state back to a clean state during tear down. |
| 38 static bool is_mode_initialized_; |
| 39 |
| 40 // The current Mode to be used by the system. |
| 41 static Mode mode_; |
| 42 |
| 43 // Declarations only. Do not allow construction of an object. |
| 44 MaterialDesignController(); |
| 45 ~MaterialDesignController(); |
| 46 |
| 47 // Initializes |mode_|. |
| 48 static void InitializeMode(); |
| 49 |
| 50 // Resets the Mode state to uninitialized. To be used by tests to cleanup |
| 51 // global state. |
| 52 static void UninitializeMode(); |
| 53 |
| 54 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 55 // used by tests to directly set the mode. |
| 56 static void SetMode(Mode mode); |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 59 }; |
| 60 |
| 61 } // namespace ui |
| 62 |
| 63 #endif // UI_BASE_RESOURCE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
OLD | NEW |