Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: ui/base/material_design/material_design_controller.h

Issue 1926943002: Introduce new flag to control usage of MD in secondary (not top-chrome) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
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. 23 // Classic, non-material design.
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 // The extent to which the mode applies.
32 enum Extent {
33 // Only apply the Material Design modes to primary UI (toolbar, etc.).
34 PRIMARY = 0,
35 // Apply the Material Design modes to secondary UI (bubble contents, etc.).
36 SECONDARY = 1,
37 };
38
31 // Initializes |mode_|. Must be called before checking |mode_|. 39 // Initializes |mode_|. Must be called before checking |mode_|.
32 static void Initialize(); 40 static void Initialize();
33 41
34 // Get the current Mode that should be used by the system. 42 // Get the current Mode that should be used by the system.
35 static Mode GetMode(); 43 static Mode GetMode();
36 44
37 // Returns true if the current mode is a material design variant. 45 // Returns true if the current mode is a material design variant.
38 static bool IsModeMaterial(); 46 static bool IsModeMaterial();
39 47
48 // Returns true if the current mode is a material design variant and this mode
49 // should be extended to cover secondary UI.
50 static bool IsSecondaryUiMaterial();
51
40 // Returns the per-platform default material design variant. 52 // Returns the per-platform default material design variant.
41 static Mode DefaultMode(); 53 static Mode DefaultMode();
42 54
43 private: 55 private:
44 friend class test::MaterialDesignControllerTestAPI; 56 friend class test::MaterialDesignControllerTestAPI;
45 57
46 // Tracks whether |mode_| has been initialized. This is necessary so tests can 58 // Tracks whether |mode_| has been initialized. This is necessary so tests can
47 // reset the state back to a clean state during tear down. 59 // reset the state back to a clean state during tear down.
48 static bool is_mode_initialized_; 60 static bool is_mode_initialized_;
49 61
50 // The current Mode to be used by the system. 62 // The current Mode to be used by the system.
51 static Mode mode_; 63 static Mode mode_;
52 64
65 // The extent to apply |mode_|.
66 static Extent extent_;
varkha 2016/04/27 23:06:05 You would probably want to save / restore the mode
Evan Stade 2016/04/27 23:20:40 I think this would make sense as soon as we decide
varkha 2016/04/27 23:30:58 True but easy to forget and the results may be fla
67
53 // Declarations only. Do not allow construction of an object. 68 // Declarations only. Do not allow construction of an object.
54 MaterialDesignController(); 69 MaterialDesignController();
55 ~MaterialDesignController(); 70 ~MaterialDesignController();
56 71
57 // Resets the initialization state to uninitialized. To be used by tests to 72 // Resets the initialization state to uninitialized. To be used by tests to
58 // allow calling Initialize() more than once. 73 // allow calling Initialize() more than once.
59 static void Uninitialize(); 74 static void Uninitialize();
60 75
61 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be 76 // Set |mode_| to |mode| and updates |is_mode_initialized_| to true. Can be
62 // used by tests to directly set the mode. 77 // used by tests to directly set the mode.
63 static void SetMode(Mode mode); 78 static void SetMode(Mode mode);
64 79
65 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController); 80 DISALLOW_COPY_AND_ASSIGN(MaterialDesignController);
66 }; 81 };
67 82
68 } // namespace ui 83 } // namespace ui
69 84
70 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_ 85 #endif // UI_BASE_MATERIAL_DESIGN_MATERIAL_DESIGN_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698