Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 static Mode GetMode(); | 35 static Mode GetMode(); |
| 36 | 36 |
| 37 // Returns true if the current mode is a material design variant. | 37 // Returns true if the current mode is a material design variant. |
| 38 static bool IsModeMaterial(); | 38 static bool IsModeMaterial(); |
| 39 | 39 |
| 40 // 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 |
| 41 // should be extended to cover secondary UI. | 41 // should be extended to cover secondary UI. |
| 42 static bool IsSecondaryUiMaterial(); | 42 static bool IsSecondaryUiMaterial(); |
| 43 | 43 |
| 44 // Returns the per-platform default material design variant. | 44 // Returns the per-platform default material design variant. |
| 45 static Mode DefaultMode(); | 45 static Mode DefaultMode(); |
|
sky
2016/05/13 15:49:56
sorry, random question. Can this be private?
Peter Kasting
2016/05/16 19:53:16
It's called elsewhere only by tests. I think it's
| |
| 46 | 46 |
| 47 // On Windows, this should be called during startup before anyone calls any of | |
| 48 // the functions above to declare whether we should default to Material mode. | |
| 49 // TODO(pkasting): Remove this as soon as MD is on by default. | |
| 50 static void SetDefaultToMaterial(bool default_to_material); | |
|
sky
2016/05/13 15:49:56
I find it mildly confusing that you expect this fu
Peter Kasting
2016/05/16 19:53:16
You mean, by combining its functionality with Init
| |
| 51 | |
| 47 private: | 52 private: |
| 48 friend class test::MaterialDesignControllerTestAPI; | 53 friend class test::MaterialDesignControllerTestAPI; |
| 49 | 54 |
| 50 // Tracks whether |mode_| has been initialized. This is necessary so tests can | 55 // Tracks whether |mode_| has been initialized. This is necessary so tests can |
| 51 // reset the state back to a clean state during tear down. | 56 // reset the state back to a clean state during tear down. |
| 52 static bool is_mode_initialized_; | 57 static bool is_mode_initialized_; |
| 53 | 58 |
| 59 // True if we should default to Material mode. Only respected on Windows. | |
| 60 static bool default_to_material_; | |
| 61 | |
| 54 // The current Mode to be used by the system. | 62 // The current Mode to be used by the system. |
| 55 static Mode mode_; | 63 static Mode mode_; |
| 56 | 64 |
| 57 // True when |mode_| applies beyond the primary UI (toolbar, tabstrip, | 65 // True when |mode_| applies beyond the primary UI (toolbar, tabstrip, |
| 58 // etc.). For example, this controls use of MD inside bubbles and dialogs. | 66 // etc.). For example, this controls use of MD inside bubbles and dialogs. |
| 59 static bool include_secondary_ui_; | 67 static bool include_secondary_ui_; |
| 60 | 68 |
| 61 // Declarations only. Do not allow construction of an object. | 69 // Declarations only. Do not allow construction of an object. |
| 62 MaterialDesignController(); | 70 MaterialDesignController(); |
| 63 ~MaterialDesignController(); | 71 ~MaterialDesignController(); |
| 64 | 72 |
| 65 // Resets the initialization state to uninitialized. To be used by tests to | 73 // Resets the initialization state to uninitialized. To be used by tests to |
| 66 // allow calling Initialize() more than once. | 74 // allow calling Initialize() more than once. |
| 67 static void Uninitialize(); | 75 static void Uninitialize(); |
| 68 | 76 |
| 69 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be | 77 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be |
| 70 // used by tests to directly set the mode. | 78 // used by tests to directly set the mode. |
| 71 static void SetMode(Mode mode); | 79 static void SetMode(Mode mode); |
| 72 | 80 |
| 73 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); | 81 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); |
| 74 }; | 82 }; |
| 75 | 83 |
| 76 } // namespace ui | 84 } // namespace ui |
| 77 | 85 |
| 78 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ | 86 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ |
| OLD | NEW |