| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 5 #ifndef UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 6 #define UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 6 #define UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/base/ui_base_export.h" | 9 #include "ui/base/ui_base_export.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 NON_MATERIAL = 0, | 24 NON_MATERIAL = 0, |
| 25 // Basic material design. | 25 // Basic material design. |
| 26 MATERIAL_NORMAL = 1, | 26 MATERIAL_NORMAL = 1, |
| 27 // Material design targeted at mouse/touch hybrid devices. | 27 // Material design targeted at mouse/touch hybrid devices. |
| 28 MATERIAL_HYBRID = 2 | 28 MATERIAL_HYBRID = 2 |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Initializes |mode_|. Must be called before checking |mode_|. | 31 // Initializes |mode_|. Must be called before checking |mode_|. |
| 32 static void Initialize(); | 32 static void Initialize(); |
| 33 | 33 |
| 34 static bool DeviceListsComplete(); |
| 35 |
| 34 // Get the current Mode that should be used by the system. | 36 // Get the current Mode that should be used by the system. |
| 35 static Mode GetMode(); | 37 static Mode GetMode(); |
| 36 | 38 |
| 37 // Returns true if the current mode is a material design variant. | 39 // Returns true if the current mode is a material design variant. |
| 38 static bool IsModeMaterial(); | 40 static bool IsModeMaterial(); |
| 39 | 41 |
| 40 // Returns the per-platform default material design variant. | 42 // Returns the per-platform default material design variant. |
| 41 static Mode DefaultMode(); | 43 static Mode DefaultMode(); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 friend class test::MaterialDesignControllerTestAPI; | 46 friend class test::MaterialDesignControllerTestAPI; |
| 45 | 47 |
| 46 // Tracks whether |mode_| has been initialized. This is necessary so tests can | 48 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 47 // reset the state back to a clean state during tear down. | 49 // reset the state back to a clean state during tear down. |
| 48 static bool is_mode_initialized_; | 50 static bool is_mode_initialized_; |
| 49 | 51 |
| 52 // Terry: merge with above. |
| 53 static bool mode_initialized_by_switch_; |
| 54 |
| 50 // The current Mode to be used by the system. | 55 // The current Mode to be used by the system. |
| 51 static Mode mode_; | 56 static Mode mode_; |
| 52 | 57 |
| 53 // Declarations only. Do not allow construction of an object. | 58 // Declarations only. Do not allow construction of an object. |
| 54 MaterialDesignController(); | 59 MaterialDesignController(); |
| 55 ~MaterialDesignController(); | 60 ~MaterialDesignController(); |
| 56 | 61 |
| 57 // Resets the initialization state to uninitialized. To be used by tests to | 62 // Resets the initialization state to uninitialized. To be used by tests to |
| 58 // allow calling Initialize() more than once. | 63 // allow calling Initialize() more than once. |
| 59 static void Uninitialize(); | 64 static void Uninitialize(); |
| 60 | 65 |
| 61 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be | 66 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 62 // used by tests to directly set the mode. | 67 // used by tests to directly set the mode. |
| 63 static void SetMode(Mode mode); | 68 static void SetMode(Mode mode); |
| 64 | 69 |
| 65 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); | 70 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 66 }; | 71 }; |
| 67 | 72 |
| 68 } // namespace ui | 73 } // namespace ui |
| 69 | 74 |
| 70 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 75 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| OLD | NEW |