Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: chrome/browser/ui/search/instant_controller.cc

Issue 20501002: Adds paste function to searchbox api and handles paste event on fakebox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | chrome/browser/ui/search/instant_ntp_prerenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8c866355e0bd501d2001bb4ef80a8f7d31494a17..3b42999bd19b7a6d6403489c94bee230bc1cd837 100644
--- a/chrome/browser/ui/search/instant_controller.cc
+++ b/chrome/browser/ui/search/instant_controller.cc
@@ -307,27 +307,7 @@ void InstantController::InstantPageAboutToNavigateMainFrame(
void InstantController::FocusOmnibox(const content::WebContents* contents,
OmniboxFocusState state) {
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(state);
}
void InstantController::NavigateToURL(const content::WebContents* contents,
@@ -351,6 +331,16 @@ void InstantController::NavigateToURL(const content::WebContents* contents,
browser_->OpenURL(url, transition, disposition);
}
+void InstantController::PasteIntoOmnibox(const content::WebContents* contents,
+ const string16& text) {
+ if (search_mode_.is_origin_default())
+ return;
+
+ DCHECK(IsContentsFrom(instant_tab(), contents));
+
+ browser_->PasteIntoOmnibox(text);
+}
+
void InstantController::ResetInstantTab() {
if (!search_mode_.is_origin_default()) {
content::WebContents* active_tab = browser_->GetActiveWebContents();
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | chrome/browser/ui/search/instant_ntp_prerenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698