Index: chrome/browser/instant/instant_controller.cc |
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc |
index 531e9a2a64f07f3916dfb4421f16253dd3af2d8b..e6841310aa75100099d68a190a9f71bf672696c4 100644 |
--- a/chrome/browser/instant/instant_controller.cc |
+++ b/chrome/browser/instant/instant_controller.cc |
@@ -152,7 +152,7 @@ InstantController::InstantController(chrome::BrowserInstantController* browser, |
last_verbatim_(false), |
last_transition_type_(content::PAGE_TRANSITION_LINK), |
last_match_was_search_(false), |
- is_omnibox_focused_(false) { |
+ omnibox_focus_state_(NONE) { |
} |
InstantController::~InstantController() { |
@@ -476,7 +476,8 @@ bool InstantController::CommitIfCurrent(InstantCommitType type) { |
void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { |
DVLOG(1) << "OmniboxLostFocus"; |
- is_omnibox_focused_ = false; |
+ omnibox_focus_state_ = NONE; |
+ SendKeyCaptureModeToPage(); |
if (!extended_enabled_ && !instant_enabled_) |
return; |
@@ -501,9 +502,10 @@ void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { |
#endif |
} |
-void InstantController::OmniboxGotFocus() { |
+void InstantController::OmniboxGotFocus(bool focus_is_visible) { |
DVLOG(1) << "OmniboxGotFocus"; |
- is_omnibox_focused_ = true; |
+ omnibox_focus_state_ = focus_is_visible ? VISIBLE : INVISIBLE; |
+ SendKeyCaptureModeToPage(); |
if (!extended_enabled_ && !instant_enabled_) |
return; |
@@ -707,10 +709,11 @@ bool InstantController::ResetLoader(const TemplateURL* template_url, |
loader_.reset(new InstantLoader(this, instant_url, active_tab)); |
loader_->Init(); |
- // Ensure the searchbox API has the correct theme-related info and context. |
+ // Ensure the searchbox API has correct state. |
if (extended_enabled_) { |
browser_->UpdateThemeInfoForPreview(); |
loader_->SearchModeChanged(search_mode_); |
+ SendKeyCaptureModeToPage(); |
} |
// Reset the loader timer. |
@@ -740,7 +743,7 @@ void InstantController::OnStaleLoader() { |
// If the preview is showing or the omnibox has focus, don't delete the |
// loader. It will get refreshed the next time the preview is hidden or the |
// omnibox loses focus. |
- if (!stale_loader_timer_.IsRunning() && !is_omnibox_focused_ && |
+ if (!stale_loader_timer_.IsRunning() && omnibox_focus_state_ == NONE && |
model_.mode().is_default()) { |
DeleteLoader(); |
CreateDefaultLoader(); |
@@ -862,6 +865,11 @@ void InstantController::SendBoundsToPage() { |
loader_->SetOmniboxBounds(intersection); |
} |
+void InstantController::SendKeyCaptureModeToPage() { |
+ if (extended_enabled_ && GetPreviewContents()) |
+ loader_->OnKeyCaptureChange(omnibox_focus_state_ == INVISIBLE); |
+} |
+ |
bool InstantController::GetInstantURL(const TemplateURL* template_url, |
std::string* instant_url) const { |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |