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 28ce7fac1c3616fed381233b516181f582feb3a9..a2e65f56c8c316f6c51cf04ddbd815105d84ac48 100644 |
--- a/chrome/browser/ui/search/instant_controller.cc |
+++ b/chrome/browser/ui/search/instant_controller.cc |
@@ -318,27 +318,7 @@ void InstantController::FocusOmnibox(const content::WebContents* contents, |
return; |
DCHECK(IsContentsFrom(instant_tab(), contents)); |
- |
- // Do not add a default case in the switch block for the following reasons: |
- // (1) Explicitly handle the new states. If new states are added in the |
- // OmniboxFocusState, the compiler will warn the developer to handle the new |
- // states. |
- // (2) An attacker may control the renderer and sends the browser process a |
- // malformed IPC. This function responds to the invalid |state| values by |
- // doing nothing instead of crashing the browser process (intentional no-op). |
- switch (state) { |
- case OMNIBOX_FOCUS_VISIBLE: |
- // TODO(samarth): re-enable this once setValue() correctly handles |
- // URL-shaped queries. |
- // browser_->FocusOmnibox(true); |
- break; |
- case OMNIBOX_FOCUS_INVISIBLE: |
- browser_->FocusOmnibox(false); |
- break; |
- case OMNIBOX_FOCUS_NONE: |
- contents->GetView()->Focus(); |
- break; |
- } |
+ browser_->FocusOmnibox(contents, state); |
} |
void InstantController::NavigateToURL(const content::WebContents* contents, |
@@ -365,6 +345,15 @@ void InstantController::NavigateToURL(const content::WebContents* contents, |
browser_->OpenURL(url, transition, disposition); |
} |
+void InstantController::PasteIntoOmnibox(const content::WebContents* contents) { |
+ if (!extended_enabled() || search_mode_.is_origin_default()) |
+ return; |
+ |
+ DCHECK(IsContentsFrom(instant_tab(), contents)); |
+ |
+ browser_->PasteIntoOmnibox(); |
+} |
+ |
bool InstantController::extended_enabled() const { |
return extended_enabled_; |
} |