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

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

Issue 7706003: Fixes regression (and crash) in instant. The crash would happen if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial field Created 9 years, 4 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
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | views/focus/focus_manager.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_FOCUS_FOCUS_MANAGER_H_ 5 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_
6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ 6 #define 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void ValidateFocusedView(); 218 void ValidateFocusedView();
219 219
220 // Stores and restores the focused view. Used when the window becomes 220 // Stores and restores the focused view. Used when the window becomes
221 // active/inactive. 221 // active/inactive.
222 void StoreFocusedView(); 222 void StoreFocusedView();
223 void RestoreFocusedView(); 223 void RestoreFocusedView();
224 224
225 // Clears the stored focused view. 225 // Clears the stored focused view.
226 void ClearStoredFocusedView(); 226 void ClearStoredFocusedView();
227 227
228 // Returns true if in the process of changing the focused view.
229 bool is_changing_focus() const { return is_changing_focus_; }
230
228 // Register a keyboard accelerator for the specified target. If multiple 231 // Register a keyboard accelerator for the specified target. If multiple
229 // targets are registered for an accelerator, a target registered later has 232 // targets are registered for an accelerator, a target registered later has
230 // higher priority. 233 // higher priority.
231 // Note that we are currently limited to accelerators that are either: 234 // Note that we are currently limited to accelerators that are either:
232 // - a key combination including Ctrl or Alt 235 // - a key combination including Ctrl or Alt
233 // - the escape key 236 // - the escape key
234 // - the enter key 237 // - the enter key
235 // - any F key (F1, F2, F3 ...) 238 // - any F key (F1, F2, F3 ...)
236 // - any browser specific keys (as available on special keyboards) 239 // - any browser specific keys (as available on special keyboards)
237 void RegisterAccelerator(const Accelerator& accelerator, 240 void RegisterAccelerator(const Accelerator& accelerator,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 FocusChangeReason focus_change_reason_; 309 FocusChangeReason focus_change_reason_;
307 310
308 // The accelerators and associated targets. 311 // The accelerators and associated targets.
309 typedef std::list<AcceleratorTarget*> AcceleratorTargetList; 312 typedef std::list<AcceleratorTarget*> AcceleratorTargetList;
310 typedef std::map<Accelerator, AcceleratorTargetList> AcceleratorMap; 313 typedef std::map<Accelerator, AcceleratorTargetList> AcceleratorMap;
311 AcceleratorMap accelerators_; 314 AcceleratorMap accelerators_;
312 315
313 // The list of registered FocusChange listeners. 316 // The list of registered FocusChange listeners.
314 ObserverList<FocusChangeListener, true> focus_change_listeners_; 317 ObserverList<FocusChangeListener, true> focus_change_listeners_;
315 318
319 // See description above getter.
320 bool is_changing_focus_;
321
316 DISALLOW_COPY_AND_ASSIGN(FocusManager); 322 DISALLOW_COPY_AND_ASSIGN(FocusManager);
317 }; 323 };
318 324
319 // A basic helper class that is used to disable native focus change 325 // A basic helper class that is used to disable native focus change
320 // notifications within a scope. 326 // notifications within a scope.
321 class AutoNativeNotificationDisabler { 327 class AutoNativeNotificationDisabler {
322 public: 328 public:
323 AutoNativeNotificationDisabler() { 329 AutoNativeNotificationDisabler() {
324 FocusManager::GetWidgetFocusManager()->DisableNotifications(); 330 FocusManager::GetWidgetFocusManager()->DisableNotifications();
325 } 331 }
326 332
327 ~AutoNativeNotificationDisabler() { 333 ~AutoNativeNotificationDisabler() {
328 FocusManager::GetWidgetFocusManager()->EnableNotifications(); 334 FocusManager::GetWidgetFocusManager()->EnableNotifications();
329 } 335 }
330 private: 336 private:
331 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler); 337 DISALLOW_COPY_AND_ASSIGN(AutoNativeNotificationDisabler);
332 }; 338 };
333 339
334 } // namespace views 340 } // namespace views
335 341
336 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ 342 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | views/focus/focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698