| 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 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 namespace test { | 13 namespace test { |
| 14 class MaterialDesignControllerTestAPI; | 14 class MaterialDesignControllerTestAPI; |
| 15 } // namespace test | 15 } // namespace test |
| 16 | 16 |
| 17 // Central controller to handle material design modes. | 17 // Central controller to handle material design modes. |
| 18 class UI_BASE_EXPORT MaterialDesignController { | 18 class UI_BASE_EXPORT MaterialDesignController { |
| 19 public: | 19 public: |
| 20 // The different material design modes. The order cannot be changed without | 20 // The different material design modes. The order cannot be changed without |
| 21 // updating references as these are used as array indices. | 21 // updating references as these are used as array indices. |
| 22 enum Mode { | 22 enum Mode { |
| 23 // Classic, non-material design. | |
| 24 NON_MATERIAL = 0, | |
| 25 // Basic material design. | 23 // Basic material design. |
| 26 MATERIAL_NORMAL = 1, | 24 MATERIAL_NORMAL = 1, |
| 27 // Material design targeted at mouse/touch hybrid devices. | 25 // Material design targeted at mouse/touch hybrid devices. |
| 28 MATERIAL_HYBRID = 2 | 26 MATERIAL_HYBRID = 2 |
| 29 }; | 27 }; |
| 30 | 28 |
| 31 // Initializes |mode_|. Must be called before checking |mode_|. | 29 // Initializes |mode_|. Must be called before checking |mode_|. |
| 32 static void Initialize(); | 30 static void Initialize(); |
| 33 | 31 |
| 34 // Get the current Mode that should be used by the system. | 32 // Get the current Mode that should be used by the system. |
| 35 static Mode GetMode(); | 33 static Mode GetMode(); |
| 36 | 34 |
| 37 // Returns true if the current mode is a material design variant. | 35 // Returns true. TODO(estade): remove. |
| 38 static bool IsModeMaterial(); | 36 static bool IsModeMaterial(); |
| 39 | 37 |
| 40 // Returns true if the current mode is a material design variant and this mode | 38 // Returns true if the current mode is a material design variant and this mode |
| 41 // should be extended to cover secondary UI. | 39 // should be extended to cover secondary UI. |
| 42 static bool IsSecondaryUiMaterial(); | 40 static bool IsSecondaryUiMaterial(); |
| 43 | 41 |
| 44 // Returns the per-platform default material design variant. | 42 // Returns the per-platform default material design variant. |
| 45 static Mode DefaultMode(); | 43 static Mode DefaultMode(); |
| 46 | 44 |
| 47 static bool is_mode_initialized() { return is_mode_initialized_; } | 45 static bool is_mode_initialized() { return is_mode_initialized_; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be | 70 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 73 // used by tests to directly set the mode. | 71 // used by tests to directly set the mode. |
| 74 static void SetMode(Mode mode); | 72 static void SetMode(Mode mode); |
| 75 | 73 |
| 76 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); | 74 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 } // namespace ui | 77 } // namespace ui |
| 80 | 78 |
| 81 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 79 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| OLD | NEW |