| 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 // Same as Initialize(), but uses |mode| (instead of DefaultMode()) as the | |
| 35 // default value if no command-line switch or field trial overrides it. | |
| 36 static void InitializeWithDefaultMode(Mode mode); | |
| 37 | |
| 38 // Get the current Mode that should be used by the system. | 34 // Get the current Mode that should be used by the system. |
| 39 static Mode GetMode(); | 35 static Mode GetMode(); |
| 40 | 36 |
| 41 // Returns true if the current mode is a material design variant. | 37 // Returns true if the current mode is a material design variant. |
| 42 static bool IsModeMaterial(); | 38 static bool IsModeMaterial(); |
| 43 | 39 |
| 44 // Returns true if the current mode is a material design variant and this mode | 40 // Returns true if the current mode is a material design variant and this mode |
| 45 // should be extended to cover secondary UI. | 41 // should be extended to cover secondary UI. |
| 46 static bool IsSecondaryUiMaterial(); | 42 static bool IsSecondaryUiMaterial(); |
| 47 | 43 |
| 44 // Returns the per-platform default material design variant. |
| 45 static Mode DefaultMode(); |
| 46 |
| 48 private: | 47 private: |
| 49 friend class test::MaterialDesignControllerTestAPI; | 48 friend class test::MaterialDesignControllerTestAPI; |
| 50 | 49 |
| 51 // Tracks whether |mode_| has been initialized. This is necessary so tests can | 50 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 52 // reset the state back to a clean state during tear down. | 51 // reset the state back to a clean state during tear down. |
| 53 static bool is_mode_initialized_; | 52 static bool is_mode_initialized_; |
| 54 | 53 |
| 55 // The current Mode to be used by the system. | 54 // The current Mode to be used by the system. |
| 56 static Mode mode_; | 55 static Mode mode_; |
| 57 | 56 |
| 58 // True when |mode_| applies beyond the primary UI (toolbar, tabstrip, | 57 // True when |mode_| applies beyond the primary UI (toolbar, tabstrip, |
| 59 // etc.). For example, this controls use of MD inside bubbles and dialogs. | 58 // etc.). For example, this controls use of MD inside bubbles and dialogs. |
| 60 static bool include_secondary_ui_; | 59 static bool include_secondary_ui_; |
| 61 | 60 |
| 61 // Declarations only. Do not allow construction of an object. |
| 62 MaterialDesignController(); |
| 63 ~MaterialDesignController(); |
| 64 |
| 62 // Resets the initialization state to uninitialized. To be used by tests to | 65 // Resets the initialization state to uninitialized. To be used by tests to |
| 63 // allow calling Initialize() more than once. | 66 // allow calling Initialize() more than once. |
| 64 static void Uninitialize(); | 67 static void Uninitialize(); |
| 65 | 68 |
| 66 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be | 69 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 67 // used by tests to directly set the mode. | 70 // used by tests to directly set the mode. |
| 68 static void SetMode(Mode mode); | 71 static void SetMode(Mode mode); |
| 69 | 72 |
| 70 // Returns the per-platform default material design variant. | 73 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 71 static Mode DefaultMode(); | |
| 72 | |
| 73 DISALLOW_IMPLICIT_CONSTRUCTORS(MaterialDesignController); | |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace ui | 76 } // namespace ui |
| 77 | 77 |
| 78 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 78 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| OLD | NEW |