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

Unified Diff: chrome/browser/autocomplete/network_action_predictor.cc

Issue 9153004: More fine grained understanding of Omnibox navigation counts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/network_action_predictor.cc
diff --git a/chrome/browser/autocomplete/network_action_predictor.cc b/chrome/browser/autocomplete/network_action_predictor.cc
index 848feeb5b84cf1064b8df75bb19ab480c5151477..68d5f509b4b3dc0794efb8472ca98691eaac56e7 100644
--- a/chrome/browser/autocomplete/network_action_predictor.cc
+++ b/chrome/browser/autocomplete/network_action_predictor.cc
@@ -56,6 +56,22 @@ bool GetURLRowForAutocompleteMatch(Profile* profile,
return url_db && (url_db->GetRowForURL(match.destination_url, url_row) != 0);
}
+// Return true if the suggestion type is a 'search' type.
+bool IsSearchType(const AutocompleteMatch::Type& type) {
Peter Kasting 2012/01/09 20:47:37 Nit: I wonder if this is consistent with other pla
dominich 2012/01/09 22:43:43 Hmm. On the other side of this, when we swap in th
Peter Kasting 2012/01/09 22:51:30 In the abstract, yes; the fact that we have many o
+ switch (type) {
+ // Matches using the user's default search engine.
+ case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED:
+ case AutocompleteMatch::SEARCH_HISTORY:
+ case AutocompleteMatch::SEARCH_SUGGEST:
+ // A match that uses a non-default search engine (e.g. for tab-to-search).
Peter Kasting 2012/01/09 20:47:37 Nit: Unindent 2.
dominich 2012/01/09 22:43:43 Done.
+ case AutocompleteMatch::SEARCH_OTHER_ENGINE:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
}
const int NetworkActionPredictor::kMaximumDaysToKeepEntry = 14;
@@ -150,10 +166,7 @@ NetworkActionPredictor::Action NetworkActionPredictor::RecommendAction(
// Downgrade prerender to preconnect if this is a search match or if omnibox
// prerendering is disabled.
if (action == ACTION_PRERENDER &&
- ((match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED ||
- match.type == AutocompleteMatch::SEARCH_SUGGEST ||
- match.type == AutocompleteMatch::SEARCH_OTHER_ENGINE) ||
- !prerender::IsOmniboxEnabled(profile_))) {
+ (IsPreconnectable(match) || !prerender::IsOmniboxEnabled(profile_))) {
action = ACTION_PRECONNECT;
}
@@ -164,18 +177,7 @@ NetworkActionPredictor::Action NetworkActionPredictor::RecommendAction(
// i.e., it is now quite likely that the user will select the related domain.
// static
bool NetworkActionPredictor::IsPreconnectable(const AutocompleteMatch& match) {
- switch (match.type) {
- // Matches using the user's default search engine.
- case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED:
- case AutocompleteMatch::SEARCH_HISTORY:
- case AutocompleteMatch::SEARCH_SUGGEST:
- // A match that uses a non-default search engine (e.g. for tab-to-search).
- case AutocompleteMatch::SEARCH_OTHER_ENGINE:
- return true;
-
- default:
- return false;
- }
+ return IsSearchType(match.type);
}
void NetworkActionPredictor::Shutdown() {
@@ -231,10 +233,12 @@ void NetworkActionPredictor::OnOmniboxOpenedUrl(const AutocompleteLog& log) {
if (log.text.length() < kMinimumUserTextLength)
return;
- UMA_HISTOGRAM_COUNTS("NetworkActionPredictor.NavigationCount", 1);
+ const AutocompleteMatch& match = log.result.match_at(log.selected_index);
+
+ UMA_HISTOGRAM_BOOLEAN("Prerender.OmniboxNavigationsCouldPrerender",
+ prerender::IsOmniboxEnabled(profile_) && !IsSearchType(match.type));
- const GURL& opened_url =
- log.result.match_at(log.selected_index).destination_url;
+ const GURL& opened_url = match.destination_url;
const string16 lower_user_text(base::i18n::ToLower(log.text));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698