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

Unified Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 2269933002: Instant cleanup: remove MODE_SEARCH_RESULTS and ORIGIN_SEARCH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_url_replacement
Patch Set: review Created 4 years, 3 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/browser_instant_controller.h ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | chrome/browser/ui/search/instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698