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

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

Issue 1202923002: Revert "Deprecating high-conflict accelerators" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
95 // Performs the specified action if it is enabled. Returns whether the action 91 // Performs the specified action if it is enabled. Returns whether the action
96 // was performed successfully. 92 // was performed successfully.
97 bool PerformActionIfEnabled(AcceleratorAction action); 93 bool PerformActionIfEnabled(AcceleratorAction action);
98 94
99 // Returns the restriction for the current context. 95 // Returns the restriction for the current context.
100 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction(); 96 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction();
101 97
102 void SetBrightnessControlDelegate( 98 void SetBrightnessControlDelegate(
103 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate); 99 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate);
104 void SetImeControlDelegate( 100 void SetImeControlDelegate(
(...skipping 25 matching lines...) Expand all
130 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, 126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest,
131 DontRepeatToggleFullscreen); 127 DontRepeatToggleFullscreen);
132 128
133 // Initializes the accelerators this class handles as a target. 129 // Initializes the accelerators this class handles as a target.
134 void Init(); 130 void Init();
135 131
136 // Registers the specified accelerators. 132 // Registers the specified accelerators.
137 void RegisterAccelerators(const AcceleratorData accelerators[], 133 void RegisterAccelerators(const AcceleratorData accelerators[],
138 size_t accelerators_length); 134 size_t accelerators_length);
139 135
140 // Registers the deprecated and their replacing accelerators.
141 void RegisterDeprecatedAccelerators(
142 const DeprecatedAcceleratorData deprecated_accelerators[],
143 size_t length);
144
145 // Returns whether |action| can be performed. The |accelerator| may provide 136 // Returns whether |action| can be performed. The |accelerator| may provide
146 // additional data the action needs. 137 // additional data the action needs.
147 bool CanPerformAction(AcceleratorAction action, 138 bool CanPerformAction(AcceleratorAction action,
148 const ui::Accelerator& accelerator); 139 const ui::Accelerator& accelerator);
149 140
150 // Performs the specified action. The |accelerator| may provide additional 141 // Performs the specified action. The |accelerator| may provide additional
151 // data the action needs. 142 // data the action needs.
152 void PerformAction(AcceleratorAction action, 143 void PerformAction(AcceleratorAction action,
153 const ui::Accelerator& accelerator); 144 const ui::Accelerator& accelerator);
154 145
(...skipping 23 matching lines...) Expand all
178 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; 169 scoped_ptr<ScreenshotDelegate> screenshot_delegate_;
179 170
180 // Handles the exit accelerator which requires a double press to exit and 171 // Handles the exit accelerator which requires a double press to exit and
181 // shows a popup with an explanation. 172 // shows a popup with an explanation.
182 ExitWarningHandler exit_warning_handler_; 173 ExitWarningHandler exit_warning_handler_;
183 174
184 // A map from accelerators to the AcceleratorAction values, which are used in 175 // A map from accelerators to the AcceleratorAction values, which are used in
185 // the implementation. 176 // the implementation.
186 std::map<ui::Accelerator, AcceleratorAction> accelerators_; 177 std::map<ui::Accelerator, AcceleratorAction> accelerators_;
187 178
188 std::map<AcceleratorAction, const DeprecatedAcceleratorData*>
189 actions_with_deprecations_;
190 std::set<ui::Accelerator> deprecated_accelerators_;
191
192 // Actions allowed when the user is not signed in. 179 // Actions allowed when the user is not signed in.
193 std::set<int> actions_allowed_at_login_screen_; 180 std::set<int> actions_allowed_at_login_screen_;
194 // Actions allowed when the screen is locked. 181 // Actions allowed when the screen is locked.
195 std::set<int> actions_allowed_at_lock_screen_; 182 std::set<int> actions_allowed_at_lock_screen_;
196 // Actions allowed when a modal window is up. 183 // Actions allowed when a modal window is up.
197 std::set<int> actions_allowed_at_modal_window_; 184 std::set<int> actions_allowed_at_modal_window_;
198 // Preferred actions. See accelerator_table.h for details. 185 // Preferred actions. See accelerator_table.h for details.
199 std::set<int> preferred_actions_; 186 std::set<int> preferred_actions_;
200 // Reserved actions. See accelerator_table.h for details. 187 // Reserved actions. See accelerator_table.h for details.
201 std::set<int> reserved_actions_; 188 std::set<int> reserved_actions_;
202 // Actions which will not be repeated while holding the accelerator key. 189 // Actions which will not be repeated while holding the accelerator key.
203 std::set<int> nonrepeatable_actions_; 190 std::set<int> nonrepeatable_actions_;
204 // Actions allowed in app mode. 191 // Actions allowed in app mode.
205 std::set<int> actions_allowed_in_app_mode_; 192 std::set<int> actions_allowed_in_app_mode_;
206 // Actions disallowed if there are no windows. 193 // Actions disallowed if there are no windows.
207 std::set<int> actions_needing_window_; 194 std::set<int> actions_needing_window_;
208 195
209 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); 196 DISALLOW_COPY_AND_ASSIGN(AcceleratorController);
210 }; 197 };
211 198
212 } // namespace ash 199 } // namespace ash
213 200
214 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 201 #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