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

Side by Side Diff: ash/sticky_keys/sticky_keys_controller.h

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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 | « ash/shell_unittest.cc ('k') | ash/sticky_keys/sticky_keys_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ 5 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_
6 #define ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ 6 #define ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_
7 7
8 #include <memory>
9
8 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
9 #include "ash/sticky_keys/sticky_keys_state.h" 11 #include "ash/sticky_keys/sticky_keys_state.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
13 #include "ui/events/event_handler.h" 14 #include "ui/events/event_handler.h"
14 #include "ui/events/event_rewriter.h" 15 #include "ui/events/event_rewriter.h"
15 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
16 17
17 namespace ui { 18 namespace ui {
18 class Event; 19 class Event;
19 class KeyEvent; 20 class KeyEvent;
20 class MouseEvent; 21 class MouseEvent;
21 } // namespace ui 22 } // namespace ui
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 int* flags); 102 int* flags);
102 103
103 // Obtains a pending modifier-up event. If the immediately previous 104 // Obtains a pending modifier-up event. If the immediately previous
104 // call to |Rewrite...Event()| or |NextDispatchEvent()| returned 105 // call to |Rewrite...Event()| or |NextDispatchEvent()| returned
105 // ui::EVENT_REWRITE_DISPATCH_ANOTHER, this sets |new_event| and returns: 106 // ui::EVENT_REWRITE_DISPATCH_ANOTHER, this sets |new_event| and returns:
106 // - ui::EVENT_REWRITE_DISPATCH_ANOTHER if there is at least one more 107 // - ui::EVENT_REWRITE_DISPATCH_ANOTHER if there is at least one more
107 // pending modifier-up event; 108 // pending modifier-up event;
108 // - ui::EVENT_REWRITE_REWRITE if this is the last or only modifier-up event; 109 // - ui::EVENT_REWRITE_REWRITE if this is the last or only modifier-up event;
109 // Otherwise, there is no pending modifier-up event, and this function 110 // Otherwise, there is no pending modifier-up event, and this function
110 // returns ui::EVENT_REWRITE_CONTINUE and sets |new_event| to NULL. 111 // returns ui::EVENT_REWRITE_CONTINUE and sets |new_event| to NULL.
111 ui::EventRewriteStatus NextDispatchEvent(scoped_ptr<ui::Event>* new_event); 112 ui::EventRewriteStatus NextDispatchEvent(
113 std::unique_ptr<ui::Event>* new_event);
112 114
113 private: 115 private:
114 // Handles keyboard event. Returns true if Sticky key consumes keyboard event. 116 // Handles keyboard event. Returns true if Sticky key consumes keyboard event.
115 // Adds to |mod_down_flags| any flag to be added to the key event. 117 // Adds to |mod_down_flags| any flag to be added to the key event.
116 // Sets |released| if any modifier is to be released after the key event. 118 // Sets |released| if any modifier is to be released after the key event.
117 bool HandleKeyEvent(const ui::KeyEvent& event, 119 bool HandleKeyEvent(const ui::KeyEvent& event,
118 ui::KeyboardCode key_code, 120 ui::KeyboardCode key_code,
119 int* mod_down_flags, 121 int* mod_down_flags,
120 bool* released); 122 bool* released);
121 123
(...skipping 15 matching lines...) Expand all
137 // Whether sticky keys is activated and modifying events. 139 // Whether sticky keys is activated and modifying events.
138 bool enabled_; 140 bool enabled_;
139 141
140 // Whether the current layout has a mod3 key. 142 // Whether the current layout has a mod3 key.
141 bool mod3_enabled_; 143 bool mod3_enabled_;
142 144
143 // Whether the current layout has an altgr key. 145 // Whether the current layout has an altgr key.
144 bool altgr_enabled_; 146 bool altgr_enabled_;
145 147
146 // Sticky key handlers. 148 // Sticky key handlers.
147 scoped_ptr<StickyKeysHandler> shift_sticky_key_; 149 std::unique_ptr<StickyKeysHandler> shift_sticky_key_;
148 scoped_ptr<StickyKeysHandler> alt_sticky_key_; 150 std::unique_ptr<StickyKeysHandler> alt_sticky_key_;
149 scoped_ptr<StickyKeysHandler> altgr_sticky_key_; 151 std::unique_ptr<StickyKeysHandler> altgr_sticky_key_;
150 scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; 152 std::unique_ptr<StickyKeysHandler> ctrl_sticky_key_;
151 scoped_ptr<StickyKeysHandler> mod3_sticky_key_; 153 std::unique_ptr<StickyKeysHandler> mod3_sticky_key_;
152 scoped_ptr<StickyKeysHandler> search_sticky_key_; 154 std::unique_ptr<StickyKeysHandler> search_sticky_key_;
153 155
154 scoped_ptr<StickyKeysOverlay> overlay_; 156 std::unique_ptr<StickyKeysOverlay> overlay_;
155 157
156 DISALLOW_COPY_AND_ASSIGN(StickyKeysController); 158 DISALLOW_COPY_AND_ASSIGN(StickyKeysController);
157 }; 159 };
158 160
159 // StickyKeysHandler handles key event and controls sticky keysfor specific 161 // StickyKeysHandler handles key event and controls sticky keysfor specific
160 // modifier keys. If monitored keyboard events are recieved, StickyKeysHandler 162 // modifier keys. If monitored keyboard events are recieved, StickyKeysHandler
161 // changes internal state. If non modifier keyboard events or mouse events are 163 // changes internal state. If non modifier keyboard events or mouse events are
162 // received, StickyKeysHandler will append modifier based on internal state. 164 // received, StickyKeysHandler will append modifier based on internal state.
163 // For other events, StickyKeysHandler does nothing. 165 // For other events, StickyKeysHandler does nothing.
164 // 166 //
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Handles scroll event. Returns true if sticky key consumes scroll event. 210 // Handles scroll event. Returns true if sticky key consumes scroll event.
209 // Sets its own modifier flag in |mod_down_flags| if it is active and needs 211 // Sets its own modifier flag in |mod_down_flags| if it is active and needs
210 // to be added to the event, and sets |released| if releasing it. 212 // to be added to the event, and sets |released| if releasing it.
211 bool HandleScrollEvent(const ui::ScrollEvent& event, 213 bool HandleScrollEvent(const ui::ScrollEvent& event,
212 int* mod_down_flags, 214 int* mod_down_flags,
213 bool* released); 215 bool* released);
214 216
215 // Fetches a pending modifier-up event if one exists and the return 217 // Fetches a pending modifier-up event if one exists and the return
216 // parameter |new_event| is available (i.e. not set). Returns the number 218 // parameter |new_event| is available (i.e. not set). Returns the number
217 // of pending events still remaining to be returned. 219 // of pending events still remaining to be returned.
218 int GetModifierUpEvent(scoped_ptr<ui::Event>* new_event); 220 int GetModifierUpEvent(std::unique_ptr<ui::Event>* new_event);
219 221
220 // Returns current internal state. 222 // Returns current internal state.
221 StickyKeyState current_state() const { return current_state_; } 223 StickyKeyState current_state() const { return current_state_; }
222 224
223 private: 225 private:
224 // Represents event type in Sticky Key context. 226 // Represents event type in Sticky Key context.
225 enum KeyEventType { 227 enum KeyEventType {
226 TARGET_MODIFIER_DOWN, // The monitoring modifier key is down. 228 TARGET_MODIFIER_DOWN, // The monitoring modifier key is down.
227 TARGET_MODIFIER_UP, // The monitoring modifier key is up. 229 TARGET_MODIFIER_UP, // The monitoring modifier key is up.
228 NORMAL_KEY_DOWN, // The non modifier key is down. 230 NORMAL_KEY_DOWN, // The non modifier key is down.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // shortcuts (eg. ctrl + t) during this time will prevent a transition to 266 // shortcuts (eg. ctrl + t) during this time will prevent a transition to
265 // the ENABLED state. 267 // the ENABLED state.
266 bool preparing_to_enable_; 268 bool preparing_to_enable_;
267 269
268 // Tracks the scroll direction of the current scroll sequence. Sticky keys 270 // Tracks the scroll direction of the current scroll sequence. Sticky keys
269 // stops modifying the scroll events of the sequence when the direction 271 // stops modifying the scroll events of the sequence when the direction
270 // changes. If no sequence is tracked, the value is 0. 272 // changes. If no sequence is tracked, the value is 0.
271 int scroll_delta_; 273 int scroll_delta_;
272 274
273 // The modifier up key event to be sent on non modifier key on ENABLED state. 275 // The modifier up key event to be sent on non modifier key on ENABLED state.
274 scoped_ptr<ui::KeyEvent> modifier_up_event_; 276 std::unique_ptr<ui::KeyEvent> modifier_up_event_;
275 277
276 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler); 278 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler);
277 }; 279 };
278 280
279 } // namespace ash 281 } // namespace ash
280 282
281 #endif // ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ 283 #endif // ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/shell_unittest.cc ('k') | ash/sticky_keys/sticky_keys_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698