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

Unified Diff: chrome/browser/search_engines/template_url.cc

Issue 6465020: Add metrics for omnibox Google searches that has no RLZ token for windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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/search_engines/template_url.h ('k') | chrome/tools/chromeactions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url.cc
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index f3d8682bde790751870eadb58f5945cfc6241683..24c2f6b5250458b6124982dc4d4218287dfe2fca 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -9,13 +9,17 @@
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/search_engines/search_engine_type.h"
#include "chrome/browser/search_engines/search_terms_data.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/url_constants.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "net/base/escape.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/favicon_size.h"
+// TODO(pastarmovj): Remove google_update_settings and user_metrics when the
+// CollectRLZMetrics function is not needed anymore.
// The TemplateURLRef has any number of terms that need to be replaced. Each of
// the terms is enclosed in braces. If the character preceeding the final
@@ -518,6 +522,28 @@ bool TemplateURLRef::SameUrlRefs(const TemplateURLRef* ref1,
return ref1 == ref2 || (ref1 && ref2 && ref1->url() == ref2->url());
}
+void TemplateURLRef::CollectRLZMetrics() const {
+#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
+ ParseIfNecessary();
+ for (size_t i = 0; i < replacements_.size(); ++i) {
+ // We are interesed in searches that were supposed to send the RLZ token.
+ if (replacements_[i].type == GOOGLE_RLZ) {
+ string16 brand;
+ // We only have RLZ tocken on a branded browser version.
+ if (GoogleUpdateSettings::GetBrand(&brand) && !brand.empty() &&
+ !GoogleUpdateSettings::IsOrganic(brand)) {
+ // Now we know we should have had RLZ token check if there was one.
+ if (url().find("rlz=") != std::string::npos)
+ UserMetrics::RecordAction(UserMetricsAction("SearchWithRLZ"));
+ else
+ UserMetrics::RecordAction(UserMetricsAction("SearchWithoutRLZ"));
+ }
+ return;
+ }
+ }
+#endif
+}
+
void TemplateURLRef::InvalidateCachedValues() const {
supports_replacements_ = valid_ = parsed_ = false;
host_.clear();
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/tools/chromeactions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698