summaryrefslogtreecommitdiffstats
path: root/views/focus
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 21:01:41 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 21:01:41 +0000
commit6eb8ea978cdc3cbd1816ec5994b71499bbce132c (patch)
tree55466b734e00c24e48f31334db6d304ea181702a /views/focus
parentcc829cf6a86824c7651abf68b47993b3d1629260 (diff)
downloadchromium_src-6eb8ea978cdc3cbd1816ec5994b71499bbce132c.zip
chromium_src-6eb8ea978cdc3cbd1816ec5994b71499bbce132c.tar.gz
chromium_src-6eb8ea978cdc3cbd1816ec5994b71499bbce132c.tar.bz2
Fixes regression (and crash) in instant. The crash would happen if
instant is enabled, you go to a page with an auth dialog, then click on one of the login buttons. This previously worked because focus was going to either the widget for the TabContentsView or RWHV (not sure which). Now that focus always goes to the topmost widget, it broke. BUG=89439 TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/7706003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r--views/focus/focus_manager.cc5
-rw-r--r--views/focus/focus_manager.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc
index 2dff171f..4cdc5ae 100644
--- a/views/focus/focus_manager.cc
+++ b/views/focus/focus_manager.cc
@@ -12,6 +12,7 @@
#include <gtk/gtk.h>
#endif
+#include "base/auto_reset.h"
#include "base/logging.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "views/accelerator.h"
@@ -61,7 +62,8 @@ FocusManager::WidgetFocusManager::GetInstance() {
FocusManager::FocusManager(Widget* widget)
: widget_(widget),
focused_view_(NULL),
- focus_change_reason_(kReasonDirectFocusChange) {
+ focus_change_reason_(kReasonDirectFocusChange),
+ is_changing_focus_(false) {
DCHECK(widget_);
stored_focused_view_storage_id_ =
ViewStorage::GetInstance()->CreateStorageID();
@@ -270,6 +272,7 @@ void FocusManager::SetFocusedViewWithReason(
if (focused_view_ == view)
return;
+ AutoReset<bool> auto_changing_focus(&is_changing_focus_, true);
// Update the reason for the focus change (since this is checked by
// some listeners), then notify all listeners.
focus_change_reason_ = reason;
diff --git a/views/focus/focus_manager.h b/views/focus/focus_manager.h
index f2bf069..88f7a1c 100644
--- a/views/focus/focus_manager.h
+++ b/views/focus/focus_manager.h
@@ -225,6 +225,9 @@ class VIEWS_EXPORT FocusManager {
// Clears the stored focused view.
void ClearStoredFocusedView();
+ // Returns true if in the process of changing the focused view.
+ bool is_changing_focus() const { return is_changing_focus_; }
+
// Register a keyboard accelerator for the specified target. If multiple
// targets are registered for an accelerator, a target registered later has
// higher priority.
@@ -313,6 +316,9 @@ class VIEWS_EXPORT FocusManager {
// The list of registered FocusChange listeners.
ObserverList<FocusChangeListener, true> focus_change_listeners_;
+ // See description above getter.
+ bool is_changing_focus_;
+
DISALLOW_COPY_AND_ASSIGN(FocusManager);
};