 Chromium Code Reviews
 Chromium Code Reviews Issue 11413217:
  Instant API: tell page whether the browser is capturing key strokes.  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@focus
    
  
    Issue 11413217:
  Instant API: tell page whether the browser is capturing key strokes.  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@focus| Index: chrome/browser/instant/instant_controller.cc | 
| diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc | 
| index 47663bc6ae185a7dd239519067afe180dddc15e5..ff8071544e4d20fdfa01267d329348a2a10a0b40 100644 | 
| --- a/chrome/browser/instant/instant_controller.cc | 
| +++ b/chrome/browser/instant/instant_controller.cc | 
| @@ -152,7 +152,8 @@ InstantController::InstantController(chrome::BrowserInstantController* browser, | 
| last_verbatim_(false), | 
| last_transition_type_(content::PAGE_TRANSITION_LINK), | 
| last_match_was_search_(false), | 
| - is_omnibox_focused_(false) { | 
| + is_omnibox_focused_(false), | 
| + is_omnibox_invisibly_focused_(false) { | 
| } | 
| InstantController::~InstantController() { | 
| @@ -477,6 +478,7 @@ bool InstantController::CommitIfCurrent(InstantCommitType type) { | 
| void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { | 
| DVLOG(1) << "OmniboxLostFocus"; | 
| is_omnibox_focused_ = false; | 
| + is_omnibox_invisibly_focused_ = false; | 
| if (!extended_enabled_ && !instant_enabled_) | 
| return; | 
| @@ -489,6 +491,8 @@ void InstantController::OmniboxLostFocus(gfx::NativeView view_gaining_focus) { | 
| return; | 
| } | 
| + loader_->OnStoppedCapturingKeyStrokes(); | 
| 
Jered
2012/11/28 17:50:16
OnStopKeyCapture
 
samarth
2012/11/28 19:33:09
Now just OnKeyCaptureChange.
 | 
| + | 
| #if defined(OS_MACOSX) | 
| if (!loader_->IsPointerDownFromActivate()) | 
| Hide(true); | 
| @@ -501,13 +505,19 @@ 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; | 
| + is_omnibox_invisibly_focused_ = !focus_is_visible; | 
| if (!extended_enabled_ && !instant_enabled_) | 
| return; | 
| + if (is_omnibox_invisibly_focused_) | 
| + loader_->OnStartedCapturingKeyStrokes(); | 
| 
Jered
2012/11/28 17:50:16
OnStartKeyCapture
 
samarth
2012/11/28 19:33:09
Now just OnKeyCaptureChange.
 
samarth
2012/11/28 19:33:09
Now just OnKeyCaptureChange.
 | 
| + else | 
| + loader_->OnStoppedCapturingKeyStrokes(); | 
| + | 
| if (!GetPreviewContents()) | 
| CreateDefaultLoader(); | 
| } | 
| @@ -711,6 +721,10 @@ bool InstantController::ResetLoader(const TemplateURL* template_url, | 
| if (extended_enabled_) { | 
| browser_->UpdateThemeInfoForPreview(); | 
| loader_->SearchModeChanged(search_mode_); | 
| + if (is_omnibox_invisibly_focused_) | 
| + loader_->OnStartedCapturingKeyStrokes(); | 
| + else | 
| + loader_->OnStoppedCapturingKeyStrokes(); | 
| } | 
| // Reset the loader timer. |