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 8dcc23badcd2c8ac4034bb6080f57d5ad555c2a2..7901607fd77214f3c8d9eeaa16a9b5c52d80aa9e 100644 |
| --- a/chrome/browser/ui/search/instant_controller.cc |
| +++ b/chrome/browser/ui/search/instant_controller.cc |
| @@ -1169,31 +1169,24 @@ void InstantController::ShowInstantOverlay(const content::WebContents* contents, |
| ShowOverlay(height, units); |
| } |
| -void InstantController::FocusOmnibox(const content::WebContents* contents) { |
| +void InstantController::FocusOmnibox(const content::WebContents* contents, |
| + OmniboxFocusState state) { |
| if (!extended_enabled_) |
| return; |
| DCHECK(IsContentsFrom(instant_tab(), contents)); |
| - browser_->FocusOmnibox(true); |
| -} |
| - |
| -void InstantController::StartCapturingKeyStrokes( |
| - const content::WebContents* contents) { |
| - if (!extended_enabled_) |
| - return; |
| - |
| - DCHECK(IsContentsFrom(instant_tab(), contents)); |
| - browser_->FocusOmnibox(false); |
| -} |
| - |
| -void InstantController::StopCapturingKeyStrokes( |
| - content::WebContents* contents) { |
| - // Nothing to do if omnibox doesn't have invisible focus. |
| - if (!extended_enabled_ || omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) |
| - return; |
| - |
| - DCHECK(IsContentsFrom(instant_tab(), contents)); |
| - contents->GetView()->Focus(); |
| + switch (state) { |
| + case OMNIBOX_FOCUS_VISIBLE: |
| + browser_->FocusOmnibox(true); |
| + break; |
| + case OMNIBOX_FOCUS_INVISIBLE: |
| + browser_->FocusOmnibox(false); |
| + break; |
| + case OMNIBOX_FOCUS_NONE: |
| + if (omnibox_focus_state_ != OMNIBOX_FOCUS_INVISIBLE) |
| + contents->GetView()->Focus(); |
| + break; |
| + } |
|
jln (very slow on Chromium)
2013/04/05 21:32:45
I'm surprised the compiler didn't complain about d
sreeram
2013/04/05 21:47:13
All the enum values are explicitly handled here, s
jln (very slow on Chromium)
2013/04/05 21:53:59
It's all about review-ability. It's easy to assert
sreeram
2013/04/05 22:03:38
Okay, how about we don't add the "default:" clause
kmadhusu
2013/04/05 22:08:51
sreeram@: How about adding a COMPILE_ASSERT macro
jln (very slow on Chromium)
2013/04/05 22:32:44
This wouldn't work and needs to be a run-time chec
sreeram
2013/04/05 22:38:48
So it turns out enum variables are explicitly allo
jln (very slow on Chromium)
2013/04/05 22:43:50
As explained above, it's much harder to assess the
kmadhusu
2013/04/05 23:51:37
Added a detailed comment. PTAL.
|
| } |
| void InstantController::NavigateToURL(const content::WebContents* contents, |