Chromium Code Reviews| Index: chrome/browser/ui/search/instant_controller.cc |
| diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc |
| index 02ba4d3c6a367e313050d415e01b35bf01b8838f..f219dabdbb6120dad5700af08a0edbd405ad11eb 100644 |
| --- a/chrome/browser/ui/search/instant_controller.cc |
| +++ b/chrome/browser/ui/search/instant_controller.cc |
| @@ -923,25 +923,15 @@ void InstantController::OmniboxFocusChanged( |
| OmniboxFocusState old_focus_state = omnibox_focus_state_; |
| omnibox_focus_state_ = state; |
| + reason_ = reason; |
| if (!extended_enabled_ && !instant_enabled_) |
| return; |
| - // Tell the page if the key capture mode changed unless the focus state |
| - // changed because of TYPING. This is because in that case, the browser hasn't |
| - // really stopped capturing key strokes. |
| - // |
| - // (More practically, if we don't do this check, the page would receive |
| - // onkeycapturechange before the corresponding onchange, and the page would |
| - // have no way of telling whether the keycapturechange happened because of |
| - // some actual user action or just because they started typing.) |
| - if (extended_enabled_ && GetOverlayContents() && |
| - reason != OMNIBOX_FOCUS_CHANGE_TYPING) { |
| - const bool is_key_capture_enabled = |
| - omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE; |
| + if (extended_enabled_) { |
| if (overlay_) |
| - overlay_->KeyCaptureChanged(is_key_capture_enabled); |
| + overlay_->FocusChanged(omnibox_focus_state_, reason); |
| if (instant_tab_) |
| - instant_tab_->KeyCaptureChanged(is_key_capture_enabled); |
| + instant_tab_->FocusChanged(omnibox_focus_state_, reason); |
| } |
| if (state == OMNIBOX_FOCUS_VISIBLE && old_focus_state == OMNIBOX_FOCUS_NONE) { |
| @@ -1161,8 +1151,8 @@ void InstantController::InstantPageRenderViewCreated( |
| // Ensure the searchbox API has the correct initial state. |
| if (IsContentsFrom(overlay(), contents)) { |
| overlay_->SetDisplayInstantResults(instant_enabled_); |
| - overlay_->KeyCaptureChanged( |
| - omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE); |
| + overlay_->FocusChanged(omnibox_focus_state_, |
| + OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
|
samarth
2013/05/15 19:05:53
Use the saved reason_ here.
Donn Denman
2013/05/20 23:48:14
Done.
|
| overlay_->SetOmniboxBounds(omnibox_bounds_); |
| overlay_->InitializeFonts(); |
| } else if (IsContentsFrom(ntp(), contents)) { |
| @@ -1541,8 +1531,8 @@ void InstantController::UpdateInfoForInstantTab() { |
| instant_tab_->SetOmniboxBounds(omnibox_bounds_); |
| instant_tab_->InitializeFonts(); |
| StartListeningToMostVisitedChanges(); |
| - instant_tab_->KeyCaptureChanged( |
| - omnibox_focus_state_ == OMNIBOX_FOCUS_INVISIBLE); |
| + instant_tab_->FocusChanged(omnibox_focus_state_, |
| + OMNIBOX_FOCUS_CHANGE_EXPLICIT); |
|
samarth
2013/05/15 19:05:53
Here as well.
Donn Denman
2013/05/20 23:48:14
Done.
|
| } |
| } |