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

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

Issue 582143004: Introduce "Preferred" accelerators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed typo Created 6 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // First, AcceleratorPressed handler of the most recently registered target 70 // First, AcceleratorPressed handler of the most recently registered target
71 // is called, and if that handler processes the event (i.e. returns true), 71 // is called, and if that handler processes the event (i.e. returns true),
72 // this method immediately returns. If not, we do the same thing on the next 72 // this method immediately returns. If not, we do the same thing on the next
73 // target, and so on. 73 // target, and so on.
74 // Returns true if an accelerator was activated. 74 // Returns true if an accelerator was activated.
75 bool Process(const ui::Accelerator& accelerator); 75 bool Process(const ui::Accelerator& accelerator);
76 76
77 // Returns true if the |accelerator| is registered. 77 // Returns true if the |accelerator| is registered.
78 bool IsRegistered(const ui::Accelerator& accelerator) const; 78 bool IsRegistered(const ui::Accelerator& accelerator) const;
79 79
80 // Returns true if the |accelerator| is one of the |reserved_actions_|. 80 // Returns true if the |accelerator| is preferred. A preferred accelerator
81 bool IsReservedAccelerator(const ui::Accelerator& accelerator) const; 81 // is handled before being passed to an window/web contents, unless
82 // the window is in fullscreen state.
83 bool IsPreferred(const ui::Accelerator& accelerator) const;
84
85 // Returns true if the |accelerator| is reserved. A reserved accelerator
86 // is always handled and will never be passed to an window/web contents.
87 bool IsReserved(const ui::Accelerator& accelerator) const;
82 88
83 // Performs the specified action. The |accelerator| may provide additional 89 // Performs the specified action. The |accelerator| may provide additional
84 // data the action needs. Returns whether an action was performed 90 // data the action needs. Returns whether an action was performed
85 // successfully. 91 // successfully.
86 bool PerformAction(int action, 92 bool PerformAction(int action,
87 const ui::Accelerator& accelerator); 93 const ui::Accelerator& accelerator);
88 94
89 // Returns the restriction for the current context. 95 // Returns the restriction for the current context.
90 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction(); 96 AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction();
91 97
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // A map from accelerators to the AcceleratorAction values, which are used in 163 // A map from accelerators to the AcceleratorAction values, which are used in
158 // the implementation. 164 // the implementation.
159 std::map<ui::Accelerator, int> accelerators_; 165 std::map<ui::Accelerator, int> accelerators_;
160 166
161 // Actions allowed when the user is not signed in. 167 // Actions allowed when the user is not signed in.
162 std::set<int> actions_allowed_at_login_screen_; 168 std::set<int> actions_allowed_at_login_screen_;
163 // Actions allowed when the screen is locked. 169 // Actions allowed when the screen is locked.
164 std::set<int> actions_allowed_at_lock_screen_; 170 std::set<int> actions_allowed_at_lock_screen_;
165 // Actions allowed when a modal window is up. 171 // Actions allowed when a modal window is up.
166 std::set<int> actions_allowed_at_modal_window_; 172 std::set<int> actions_allowed_at_modal_window_;
173 // Preferred actions. See accelerator_table.h for details.
174 std::set<int> preferred_actions_;
167 // Reserved actions. See accelerator_table.h for details. 175 // Reserved actions. See accelerator_table.h for details.
168 std::set<int> reserved_actions_; 176 std::set<int> reserved_actions_;
169 // Actions which will not be repeated while holding the accelerator key. 177 // Actions which will not be repeated while holding the accelerator key.
170 std::set<int> nonrepeatable_actions_; 178 std::set<int> nonrepeatable_actions_;
171 // Actions allowed in app mode. 179 // Actions allowed in app mode.
172 std::set<int> actions_allowed_in_app_mode_; 180 std::set<int> actions_allowed_in_app_mode_;
173 // Actions disallowed if there are no windows. 181 // Actions disallowed if there are no windows.
174 std::set<int> actions_needing_window_; 182 std::set<int> actions_needing_window_;
175 183
176 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); 184 DISALLOW_COPY_AND_ASSIGN(AcceleratorController);
177 }; 185 };
178 186
179 } // namespace ash 187 } // namespace ash
180 188
181 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 189 #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