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

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

Issue 2427913003: Use mojo volume interfaces for mash and classic ash. (Closed)
Patch Set: Split volume and system events observers; only hook up volume. Created 4 years, 2 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 (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_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 5 #ifndef ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
6 #define ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 6 #define ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 13
14 #include "ash/ash_export.h" 14 #include "ash/ash_export.h"
15 #include "ash/common/accelerators/accelerator_table.h" 15 #include "ash/common/accelerators/accelerator_table.h"
16 #include "ash/common/accelerators/exit_warning_handler.h" 16 #include "ash/common/accelerators/exit_warning_handler.h"
17 #include "ash/public/interfaces/volume.mojom.h"
17 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
18 #include "base/gtest_prod_util.h" 19 #include "base/gtest_prod_util.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "ui/base/accelerators/accelerator.h" 21 #include "ui/base/accelerators/accelerator.h"
21 #include "ui/base/accelerators/accelerator_history.h" 22 #include "ui/base/accelerators/accelerator_history.h"
22 23
23 namespace ui { 24 namespace ui {
24 class AcceleratorManager; 25 class AcceleratorManager;
25 class AcceleratorManagerDelegate; 26 class AcceleratorManagerDelegate;
26 } 27 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const ui::Accelerator& accelerator); 149 const ui::Accelerator& accelerator);
149 150
150 // Returns whether performing |action| should consume the key event. 151 // Returns whether performing |action| should consume the key event.
151 bool ShouldActionConsumeKeyEvent(AcceleratorAction action); 152 bool ShouldActionConsumeKeyEvent(AcceleratorAction action);
152 153
153 // Get the accelerator restriction for the given action. Supply an |action| 154 // Get the accelerator restriction for the given action. Supply an |action|
154 // of -1 to get restrictions that apply for the current context. 155 // of -1 to get restrictions that apply for the current context.
155 AcceleratorProcessingRestriction GetAcceleratorProcessingRestriction( 156 AcceleratorProcessingRestriction GetAcceleratorProcessingRestriction(
156 int action); 157 int action);
157 158
159 // Returns the volume controller interface raw pointer, may be null in tests.
160 mojom::VolumeController* GetVolumeController();
161 void OnVolumeControllerConnectionError();
162
158 AcceleratorControllerDelegate* delegate_; 163 AcceleratorControllerDelegate* delegate_;
159 164
160 std::unique_ptr<ui::AcceleratorManager> accelerator_manager_; 165 std::unique_ptr<ui::AcceleratorManager> accelerator_manager_;
161 166
162 // A tracker for the current and previous accelerators. 167 // A tracker for the current and previous accelerators.
163 std::unique_ptr<ui::AcceleratorHistory> accelerator_history_; 168 std::unique_ptr<ui::AcceleratorHistory> accelerator_history_;
164 169
165 std::unique_ptr<ImeControlDelegate> ime_control_delegate_; 170 std::unique_ptr<ImeControlDelegate> ime_control_delegate_;
166 171
167 // Handles the exit accelerator which requires a double press to exit and 172 // Handles the exit accelerator which requires a double press to exit and
168 // shows a popup with an explanation. 173 // shows a popup with an explanation.
169 ExitWarningHandler exit_warning_handler_; 174 ExitWarningHandler exit_warning_handler_;
170 175
171 // A map from accelerators to the AcceleratorAction values, which are used in 176 // A map from accelerators to the AcceleratorAction values, which are used in
172 // the implementation. 177 // the implementation.
173 std::map<ui::Accelerator, AcceleratorAction> accelerators_; 178 std::map<ui::Accelerator, AcceleratorAction> accelerators_;
174 179
175 std::map<AcceleratorAction, const DeprecatedAcceleratorData*> 180 std::map<AcceleratorAction, const DeprecatedAcceleratorData*>
176 actions_with_deprecations_; 181 actions_with_deprecations_;
177 std::set<ui::Accelerator> deprecated_accelerators_; 182 std::set<ui::Accelerator> deprecated_accelerators_;
178 183
184 // The cached volume controller interface pointer.
185 mojom::VolumeControllerPtr volume_controller_;
186
179 // Actions allowed when the user is not signed in. 187 // Actions allowed when the user is not signed in.
180 std::set<int> actions_allowed_at_login_screen_; 188 std::set<int> actions_allowed_at_login_screen_;
181 // Actions allowed when the screen is locked. 189 // Actions allowed when the screen is locked.
182 std::set<int> actions_allowed_at_lock_screen_; 190 std::set<int> actions_allowed_at_lock_screen_;
183 // Actions allowed when a modal window is up. 191 // Actions allowed when a modal window is up.
184 std::set<int> actions_allowed_at_modal_window_; 192 std::set<int> actions_allowed_at_modal_window_;
185 // Preferred actions. See accelerator_table.h for details. 193 // Preferred actions. See accelerator_table.h for details.
186 std::set<int> preferred_actions_; 194 std::set<int> preferred_actions_;
187 // Reserved actions. See accelerator_table.h for details. 195 // Reserved actions. See accelerator_table.h for details.
188 std::set<int> reserved_actions_; 196 std::set<int> reserved_actions_;
189 // Actions which will be repeated while holding the accelerator key. 197 // Actions which will be repeated while holding the accelerator key.
190 std::set<int> repeatable_actions_; 198 std::set<int> repeatable_actions_;
191 // Actions allowed in app mode. 199 // Actions allowed in app mode.
192 std::set<int> actions_allowed_in_app_mode_; 200 std::set<int> actions_allowed_in_app_mode_;
193 // Actions allowed in pinned mode. 201 // Actions allowed in pinned mode.
194 std::set<int> actions_allowed_in_pinned_mode_; 202 std::set<int> actions_allowed_in_pinned_mode_;
195 // Actions disallowed if there are no windows. 203 // Actions disallowed if there are no windows.
196 std::set<int> actions_needing_window_; 204 std::set<int> actions_needing_window_;
197 // Actions that can be performed without closing the menu (if one is present). 205 // Actions that can be performed without closing the menu (if one is present).
198 std::set<int> actions_keeping_menu_open_; 206 std::set<int> actions_keeping_menu_open_;
199 207
200 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); 208 DISALLOW_COPY_AND_ASSIGN(AcceleratorController);
201 }; 209 };
202 210
203 } // namespace ash 211 } // namespace ash
204 212
205 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 213 #endif // ASH_COMMON_ACCELERATORS_ACCELERATOR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_interactive_uitest_chromeos.cc ('k') | ash/common/accelerators/accelerator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698