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

Side by Side Diff: ui/views/focus/focus_manager.h

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
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 UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ 5 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_H_
6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 // Clears the stored focused view. 183 // Clears the stored focused view.
184 void ClearStoredFocusedView(); 184 void ClearStoredFocusedView();
185 185
186 // Returns true if in the process of changing the focused view. 186 // Returns true if in the process of changing the focused view.
187 bool is_changing_focus() const { return is_changing_focus_; } 187 bool is_changing_focus() const { return is_changing_focus_; }
188 188
189 // Register a keyboard accelerator for the specified target. If multiple 189 // Register a keyboard accelerator for the specified target. If multiple
190 // targets are registered for an accelerator, a target registered later has 190 // targets are registered for an accelerator, a target registered later has
191 // higher priority. 191 // higher priority.
192 // |accelerator| is the accelerator to register.
193 // |priority| denotes whether the |target| is a priority handler or not.
194 // NOTE: In almost all cases, you should specify |false| for this parameter.
195 // Setting it to |true| prevents Chrome from sending the shortcut to the
196 // webpage if the renderer has focus, which is not desirable except for
197 // isolated cases.
198 // |target| is the AcceleratorTarget that handles the event once the
199 // accelerator is pressed.
192 // Note that we are currently limited to accelerators that are either: 200 // Note that we are currently limited to accelerators that are either:
193 // - a key combination including Ctrl or Alt 201 // - a key combination including Ctrl or Alt
194 // - the escape key 202 // - the escape key
195 // - the enter key 203 // - the enter key
196 // - any F key (F1, F2, F3 ...) 204 // - any F key (F1, F2, F3 ...)
197 // - any browser specific keys (as available on special keyboards) 205 // - any browser specific keys (as available on special keyboards)
198 void RegisterAccelerator(const ui::Accelerator& accelerator, 206 void RegisterAccelerator(const ui::Accelerator& accelerator,
207 bool priority,
199 ui::AcceleratorTarget* target); 208 ui::AcceleratorTarget* target);
200 209
201 // Unregister the specified keyboard accelerator for the specified target. 210 // Unregister the specified keyboard accelerator for the specified target.
202 void UnregisterAccelerator(const ui::Accelerator& accelerator, 211 void UnregisterAccelerator(const ui::Accelerator& accelerator,
203 ui::AcceleratorTarget* target); 212 ui::AcceleratorTarget* target);
204 213
205 // Unregister all keyboard accelerator for the specified target. 214 // Unregister all keyboard accelerator for the specified target.
206 void UnregisterAccelerators(ui::AcceleratorTarget* target); 215 void UnregisterAccelerators(ui::AcceleratorTarget* target);
207 216
208 // Activate the target associated with the specified accelerator. 217 // Activate the target associated with the specified accelerator.
(...skipping 23 matching lines...) Expand all
232 // the focused view is about to change. 241 // the focused view is about to change.
233 void AddFocusChangeListener(FocusChangeListener* listener); 242 void AddFocusChangeListener(FocusChangeListener* listener);
234 void RemoveFocusChangeListener(FocusChangeListener* listener); 243 void RemoveFocusChangeListener(FocusChangeListener* listener);
235 244
236 // Returns the AcceleratorTarget that should be activated for the specified 245 // Returns the AcceleratorTarget that should be activated for the specified
237 // keyboard accelerator, or NULL if no view is registered for that keyboard 246 // keyboard accelerator, or NULL if no view is registered for that keyboard
238 // accelerator. 247 // accelerator.
239 ui::AcceleratorTarget* GetCurrentTargetForAccelerator( 248 ui::AcceleratorTarget* GetCurrentTargetForAccelerator(
240 const ui::Accelerator& accelertor) const; 249 const ui::Accelerator& accelertor) const;
241 250
251 // Whether the given |accelerator| has a priority handler associated with it.
252 bool HasPriorityHandler(const ui::Accelerator& accelerator) const;
253
242 // Clears the native view having the focus. 254 // Clears the native view having the focus.
243 virtual void ClearNativeFocus(); 255 virtual void ClearNativeFocus();
244 256
245 // Convenience method that returns true if the passed |key_event| should 257 // Convenience method that returns true if the passed |key_event| should
246 // trigger tab traversal (if it is a TAB key press with or without SHIFT 258 // trigger tab traversal (if it is a TAB key press with or without SHIFT
247 // pressed). 259 // pressed).
248 static bool IsTabTraversalKeyEvent(const KeyEvent& key_event); 260 static bool IsTabTraversalKeyEvent(const KeyEvent& key_event);
249 261
250 private: 262 private:
251 // Returns the next focusable view. 263 // Returns the next focusable view.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 297
286 // See description above getter. 298 // See description above getter.
287 bool is_changing_focus_; 299 bool is_changing_focus_;
288 300
289 DISALLOW_COPY_AND_ASSIGN(FocusManager); 301 DISALLOW_COPY_AND_ASSIGN(FocusManager);
290 }; 302 };
291 303
292 } // namespace views 304 } // namespace views
293 305
294 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ 306 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698