diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 13:43:54 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 13:43:54 +0000 |
commit | 5a3cf34b090cbb34ab8a938c0b5694470de88827 (patch) | |
tree | 1c77add7ea6c0c5d29c9429bb8eaacc612bd44ff /chrome/browser/search_engines/template_url.cc | |
parent | 955dd7ebf6808dd93dd1aedc7390e7280e848f80 (diff) | |
download | chromium_src-5a3cf34b090cbb34ab8a938c0b5694470de88827.zip chromium_src-5a3cf34b090cbb34ab8a938c0b5694470de88827.tar.gz chromium_src-5a3cf34b090cbb34ab8a938c0b5694470de88827.tar.bz2 |
Add metrics for omnibox Google searches that has no RLZ token for windows.
This metric will give us idea whether we need to take further measures to
close the short gap between the time the RLZ token is first cached and
later used to perform searches.
BUG=71548
TEST=Manual.
Review URL: http://codereview.chromium.org/6465020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/template_url.cc')
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index f3d8682..24c2f6b 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(); |