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

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

Issue 14587007: Unify and change logout/sleep/lock shortcuts (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review Created 7 years, 7 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
11 #include "ash/accelerators/exit_warning_handler.h"
11 #include "ash/ash_export.h" 12 #include "ash/ash_export.h"
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "ui/base/accelerators/accelerator.h" 17 #include "ui/base/accelerators/accelerator.h"
17 18
18 namespace ui { 19 namespace ui {
19 class AcceleratorManager; 20 class AcceleratorManager;
20 } 21 }
21 22
22 namespace ash { 23 namespace ash {
23 24
24 struct AcceleratorData; 25 struct AcceleratorData;
25 class BrightnessControlDelegate; 26 class BrightnessControlDelegate;
27 class ExitWarningHandler;
26 class ImeControlDelegate; 28 class ImeControlDelegate;
27 class KeyboardBrightnessControlDelegate; 29 class KeyboardBrightnessControlDelegate;
28 class ScreenshotDelegate; 30 class ScreenshotDelegate;
29 class VolumeControlDelegate; 31 class VolumeControlDelegate;
30 32
31 // Stores information about accelerator context, eg. previous accelerator 33 // Stores information about accelerator context, eg. previous accelerator
32 // or if the current accelerator is repeated or not. 34 // or if the current accelerator is repeated or not.
33 class ASH_EXPORT AcceleratorControllerContext { 35 class ASH_EXPORT AcceleratorControllerContext {
34 public: 36 public:
35 AcceleratorControllerContext(); 37 AcceleratorControllerContext();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 scoped_ptr<ScreenshotDelegate> screenshot_delegate); 110 scoped_ptr<ScreenshotDelegate> screenshot_delegate);
109 BrightnessControlDelegate* brightness_control_delegate() const { 111 BrightnessControlDelegate* brightness_control_delegate() const {
110 return brightness_control_delegate_.get(); 112 return brightness_control_delegate_.get();
111 } 113 }
112 114
113 // Provides access to an object holding contextual information. 115 // Provides access to an object holding contextual information.
114 AcceleratorControllerContext* context() { 116 AcceleratorControllerContext* context() {
115 return &context_; 117 return &context_;
116 } 118 }
117 119
120 // Provides access to the ExitWarningHandler for testing.
121 ExitWarningHandler* GetExitWarningHandlerForTest() {
122 return &exit_warning_handler_;
123 }
124
118 private: 125 private:
119 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators); 126 FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators);
120 127
121 // Initializes the accelerators this class handles as a target. 128 // Initializes the accelerators this class handles as a target.
122 void Init(); 129 void Init();
123 130
124 // Registers the specified accelerators. 131 // Registers the specified accelerators.
125 void RegisterAccelerators(const AcceleratorData accelerators[], 132 void RegisterAccelerators(const AcceleratorData accelerators[],
126 size_t accelerators_length); 133 size_t accelerators_length);
127 134
128 void SetKeyboardBrightnessControlDelegate( 135 void SetKeyboardBrightnessControlDelegate(
129 scoped_ptr<KeyboardBrightnessControlDelegate> 136 scoped_ptr<KeyboardBrightnessControlDelegate>
130 keyboard_brightness_control_delegate); 137 keyboard_brightness_control_delegate);
131 138
132 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; 139 scoped_ptr<ui::AcceleratorManager> accelerator_manager_;
133 140
134 // TODO(derat): BrightnessControlDelegate is also used by the system tray; 141 // TODO(derat): BrightnessControlDelegate is also used by the system tray;
135 // move it outside of this class. 142 // move it outside of this class.
136 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_; 143 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate_;
144 ExitWarningHandler exit_warning_handler_;
137 scoped_ptr<ImeControlDelegate> ime_control_delegate_; 145 scoped_ptr<ImeControlDelegate> ime_control_delegate_;
138 scoped_ptr<KeyboardBrightnessControlDelegate> 146 scoped_ptr<KeyboardBrightnessControlDelegate>
139 keyboard_brightness_control_delegate_; 147 keyboard_brightness_control_delegate_;
140 scoped_ptr<ScreenshotDelegate> screenshot_delegate_; 148 scoped_ptr<ScreenshotDelegate> screenshot_delegate_;
141 149
142 // Contextual information, eg. if the current accelerator is repeated. 150 // Contextual information, eg. if the current accelerator is repeated.
143 AcceleratorControllerContext context_; 151 AcceleratorControllerContext context_;
144 152
145 // A map from accelerators to the AcceleratorAction values, which are used in 153 // A map from accelerators to the AcceleratorAction values, which are used in
146 // the implementation. 154 // the implementation.
(...skipping 11 matching lines...) Expand all
158 std::set<int> nonrepeatable_actions_; 166 std::set<int> nonrepeatable_actions_;
159 // Actions allowed in app mode. 167 // Actions allowed in app mode.
160 std::set<int> actions_allowed_in_app_mode_; 168 std::set<int> actions_allowed_in_app_mode_;
161 169
162 DISALLOW_COPY_AND_ASSIGN(AcceleratorController); 170 DISALLOW_COPY_AND_ASSIGN(AcceleratorController);
163 }; 171 };
164 172
165 } // namespace ash 173 } // namespace ash
166 174
167 #endif // ASH_ACCELERATORS_ACCELERATOR_CONTROLLER_H_ 175 #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