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

Unified Diff: chrome/browser/instant/instant_controller.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | views/focus/focus_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index bfedf40c19a8acd9931be9c5c3aa3d9f0de7c187..7334e48026702307fbdfc2473f8424fd2b282d92 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -32,6 +32,12 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
+#if defined(TOOLKIT_VIEWS)
+#include "views/focus/focus_manager.h"
+#include "views/view.h"
+#include "views/widget/widget.h"
+#endif
+
namespace {
// Number of ms to delay between loading urls.
@@ -352,6 +358,25 @@ void InstantController::OnAutocompleteLostFocus(
return;
}
+#if defined(TOOLKIT_VIEWS)
+ // For views the top level widget is always focused. If the focus change
+ // originated in views determine the child Widget from the view that is being
+ // focused.
+ if (view_gaining_focus) {
+ views::Widget* widget =
+ views::Widget::GetWidgetForNativeView(view_gaining_focus);
+ if (widget) {
+ views::FocusManager* focus_manager = widget->GetFocusManager();
+ if (focus_manager && focus_manager->is_changing_focus() &&
+ focus_manager->GetFocusedView() &&
+ focus_manager->GetFocusedView()->GetWidget()) {
+ view_gaining_focus =
+ focus_manager->GetFocusedView()->GetWidget()->GetNativeView();
+ }
+ }
+ }
+#endif
+
gfx::NativeView tab_view =
GetPreviewContents()->tab_contents()->GetNativeView();
// Focus is going to the renderer.
« no previous file with comments | « no previous file | views/focus/focus_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698