Index: chrome/browser/ui/browser_instant_controller.cc |
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc |
index 442ba27528f6a09c7aa5bbeaf465d46467199f60..a6519872b1949ca7efbd92e4969fd54bd6fbcc57 100644 |
--- a/chrome/browser/ui/browser_instant_controller.cc |
+++ b/chrome/browser/ui/browser_instant_controller.cc |
@@ -103,13 +103,14 @@ BrowserInstantController::~BrowserInstantController() { |
instant_service->RemoveObserver(this); |
} |
-bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition, |
+void BrowserInstantController::OpenInstant(WindowOpenDisposition disposition, |
const GURL& url) { |
// Unsupported dispositions. |
if (disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB || |
disposition == WindowOpenDisposition::NEW_WINDOW || |
- disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) |
- return false; |
+ disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB) { |
+ return; |
+ } |
// The omnibox currently doesn't use other dispositions, so we don't attempt |
// to handle them. If you hit this DCHECK file a bug and I'll (sky) add |
@@ -119,28 +120,21 @@ bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition, |
const base::string16& search_terms = |
search::ExtractSearchTermsFromURL(profile(), url); |
- EmbeddedSearchRequestParams request_params(url); |
if (search_terms.empty()) |
- return false; |
+ return; |
InstantSearchPrerenderer* prerenderer = |
GetInstantSearchPrerenderer(profile()); |
- if (prerenderer) { |
- if (prerenderer->CanCommitQuery(GetActiveWebContents(), search_terms)) { |
- // Submit query to render the prefetched results. Browser will swap the |
- // prerendered contents with the active tab contents. |
- prerenderer->Commit(search_terms, request_params); |
- return false; |
- } else { |
- prerenderer->Cancel(); |
- } |
- } |
+ if (!prerenderer) |
+ return; |
- // If we will not be replacing search terms from this URL, don't send to |
- // InstantController. |
- if (!search::IsQueryExtractionAllowedForURL(profile(), url)) |
- return false; |
- return instant_.SubmitQuery(search_terms, request_params); |
+ if (prerenderer->CanCommitQuery(GetActiveWebContents(), search_terms)) { |
+ // Submit query to render the prefetched results. Browser will swap the |
+ // prerendered contents with the active tab contents. |
+ prerenderer->Commit(search_terms, EmbeddedSearchRequestParams(url)); |
+ } else { |
+ prerenderer->Cancel(); |
+ } |
} |
Profile* BrowserInstantController::profile() const { |
@@ -171,9 +165,7 @@ void BrowserInstantController::ModelChanged( |
// Record some actions corresponding to the mode change. Note that to get |
// the full story, it's necessary to look at other UMA actions as well, |
// such as tab switches. |
- if (new_mode.is_search_results()) |
- content::RecordAction(base::UserMetricsAction("InstantExtended.ShowSRP")); |
- else if (new_mode.is_ntp()) |
+ if (new_mode.is_ntp()) |
content::RecordAction(base::UserMetricsAction("InstantExtended.ShowNTP")); |
instant_.SearchModeChanged(old_state.mode, new_mode); |