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

Side by Side Diff: ash/accelerators/accelerator_controller.h

Issue 1177773002: Deprecating high-conflict accelerators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oshima's comments Created 5 years, 3 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
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 6 #define ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Returns true if the |accelerator| is preferred. A preferred accelerator 82 // Returns true if the |accelerator| is preferred. A preferred accelerator
83 // is handled before being passed to an window/web contents, unless 83 // is handled before being passed to an window/web contents, unless
84 // the window is in fullscreen state. 84 // the window is in fullscreen state.
85 bool IsPreferred(const ui::Accelerator& accelerator) const; 85 bool IsPreferred(const ui::Accelerator& accelerator) const;
86 86
87 // Returns true if the |accelerator| is reserved. A reserved accelerator 87 // Returns true if the |accelerator| is reserved. A reserved accelerator
88 // is always handled and will never be passed to an window/web contents. 88 // is always handled and will never be passed to an window/web contents.
89 bool IsReserved(const ui::Accelerator& accelerator) const; 89 bool IsReserved(const ui::Accelerator& accelerator) const;
90 90
91 // Returns true if the |accelerator| is deprecated. Deprecated accelerators
92 // can be consumed by web contents if needed.
93 bool IsDeprecated(const ui::Accelerator& accelerator) const;
94
91 // Performs the specified action if it is enabled. Returns whether the action 95 // Performs the specified action if it is enabled. Returns whether the action
92 // was performed successfully. 96 // was performed successfully.
93 bool PerformActionIfEnabled(AcceleratorAction action); 97 bool PerformActionIfEnabled(AcceleratorAction action);
94 98
95 // Returns the restriction for the current context. 99 // Returns the restriction for the current context.
96 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction(); 100 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction();
97 101
98 void SetBrightnessControlDelegate( 102 void SetBrightnessControlDelegate(
99 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); 103 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate);
100 void SetImeControlDelegate( 104 void SetImeControlDelegate(
(...skipping 25 matching lines...) Expand all
126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, 130 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest,
127 DontRepeatToggleFullscreen); 131 DontRepeatToggleFullscreen);
128 132
129 // Initializes the accelerators this class handles as a target. 133 // Initializes the accelerators this class handles as a target.
130 void Init(); 134 void Init();
131 135
132 // Registers the specified accelerators. 136 // Registers the specified accelerators.
133 void RegisterAccelerators(const AcceleratorData accelerators[], 137 void RegisterAccelerators(const AcceleratorData accelerators[],
134 size_t accelerators_length); 138 size_t accelerators_length);
135 139
140 // Registers the deprecated accelerators and their replacing new ones.
141 void RegisterDeprecatedAccelerators();
142
136 // Returns whether |action| can be performed. The |accelerator| may provide 143 // Returns whether |action| can be performed. The |accelerator| may provide
137 // additional data the action needs. 144 // additional data the action needs.
138 bool CanPerformAction(AcceleratorAction action, 145 bool CanPerformAction(AcceleratorAction action,
139 const ui::Accelerator& accelerator); 146 const ui::Accelerator& accelerator);
140 147
141 // Performs the specified action. The |accelerator| may provide additional 148 // Performs the specified action. The |accelerator| may provide additional
142 // data the action needs. 149 // data the action needs.
143 void PerformAction(AcceleratorAction action, 150 void PerformAction(AcceleratorAction action,
144 const ui::Accelerator& accelerator); 151 const ui::Accelerator& accelerator);
145 152
(...skipping 23 matching lines...) Expand all
169 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; 176 scoped_ptr<ScreenshotDelegate> screenshot_delegate_;
170 177
171 // Handles the exit accelerator which requires a double press to exit and 178 // Handles the exit accelerator which requires a double press to exit and
172 // shows a popup with an explanation. 179 // shows a popup with an explanation.
173 ExitWarningHandler exit_warning_handler_; 180 ExitWarningHandler exit_warning_handler_;
174 181
175 // A map from accelerators to the AcceleratorAction values, which are used in 182 // A map from accelerators to the AcceleratorAction values, which are used in
176 // the implementation. 183 // the implementation.
177 std::map<ui::Accelerator, AcceleratorAction> accelerators_; 184 std::map<ui::Accelerator, AcceleratorAction> accelerators_;
178 185
186 std::map<AcceleratorAction, const DeprecatedAcceleratorData*>
187 actions_with_deprecations_;
188 std::set<ui::Accelerator> deprecated_accelerators_;
189
179 // Actions allowed when the user is not signed in. 190 // Actions allowed when the user is not signed in.
180 std::set<int> actions_allowed_at_login_screen_; 191 std::set<int> actions_allowed_at_login_screen_;
181 // Actions allowed when the screen is locked. 192 // Actions allowed when the screen is locked.
182 std::set<int> actions_allowed_at_lock_screen_; 193 std::set<int> actions_allowed_at_lock_screen_;
183 // Actions allowed when a modal window is up. 194 // Actions allowed when a modal window is up.
184 std::set<int> actions_allowed_at_modal_window_; 195 std::set<int> actions_allowed_at_modal_window_;
185 // Preferred actions. See accelerator_table.h for details. 196 // Preferred actions. See accelerator_table.h for details.
186 std::set<int> preferred_actions_; 197 std::set<int> preferred_actions_;
187 // Reserved actions. See accelerator_table.h for details. 198 // Reserved actions. See accelerator_table.h for details.
188 std::set<int> reserved_actions_; 199 std::set<int> reserved_actions_;
189 // Actions which will not be repeated while holding the accelerator key. 200 // Actions which will not be repeated while holding the accelerator key.
190 std::set<int> nonrepeatable_actions_; 201 std::set<int> nonrepeatable_actions_;
191 // Actions allowed in app mode. 202 // Actions allowed in app mode.
192 std::set<int> actions_allowed_in_app_mode_; 203 std::set<int> actions_allowed_in_app_mode_;
193 // Actions disallowed if there are no windows. 204 // Actions disallowed if there are no windows.
194 std::set<int> actions_needing_window_; 205 std::set<int> actions_needing_window_;
195 206
196 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); 207 DISALLOW_COPY_AND_ASSIGN(AcceleratorController);
197 }; 208 };
198 209
199 } // namespace ash 210 } // namespace ash
200 211
201 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 212 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698