Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
James Cook
2014/09/19 16:13:15
nice comments
| |
| 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 passedto an window/web contents. | |
|
James Cook
2014/09/19 16:13:15
nit: "never be passed to"
oshima
2014/09/19 18:55:19
Done.
| |
| 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 Loading... | |
| 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_; |
| 167 // Reserved actions. See accelerator_table.h for details. | 173 // Reserved actions. See accelerator_table.h for details. |
|
James Cook
2014/09/19 16:13:14
nit: Reserved -> Preferred
oshima
2014/09/19 18:55:19
Done.
| |
| 174 std::set<int> preferred_actions_; | |
| 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_ |
| OLD | NEW |