summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/keyword_table.cc
diff options
context:
space:
mode:
authoravayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 12:58:04 +0000
committeravayvod@chromium.org <avayvod@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 12:58:04 +0000
commit75b99eb6f4707d34457edc5293372478c2275029 (patch)
tree06ef7d109958d426b34cfbd0303de51c3a00cf0e /chrome/browser/webdata/keyword_table.cc
parent65a48e5da2047807ae49ed160833a335576b7bb9 (diff)
downloadchromium_src-75b99eb6f4707d34457edc5293372478c2275029.zip
chromium_src-75b99eb6f4707d34457edc5293372478c2275029.tar.gz
chromium_src-75b99eb6f4707d34457edc5293372478c2275029.tar.bz2
Added histograms for default search provider protection. Removed protection
R=ivankr@chromium.org BUG=94447 TEST=Verify that changes of default search engine in Web Data before Chrome start are not overridden but chrome://histograms shows ProtectorError.DefaultSearchProvider field. Review URL: http://codereview.chromium.org/8393052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/keyword_table.cc')
-rw-r--r--chrome/browser/webdata/keyword_table.cc33
1 files changed, 26 insertions, 7 deletions
diff --git a/chrome/browser/webdata/keyword_table.cc b/chrome/browser/webdata/keyword_table.cc
index e6cf033..1258f89 100644
--- a/chrome/browser/webdata/keyword_table.cc
+++ b/chrome/browser/webdata/keyword_table.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/webdata/keyword_table.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
@@ -40,6 +41,20 @@ const char kDefaultSearchProviderBackupKey[] =
const char kDefaultSearchProviderBackupSignatureKey[] =
"Default Search Provider ID Backup Signature";
+// Histogram name to report protection errors for the default search
+// provider.
+const char kProtectorHistogramDefaultSearchProvider[] =
+ "Protector.DefaultSearchProvider";
+
+// Protector histogram values. TODO(avayvod): Move to protector.h/cc
+enum ProtectorError {
+ kProtectorErrorBackupInvalid,
+ kProtectorErrorValueChanged,
+
+ // This is for convenience only, must always be the last.
+ kProtectorErrorCount
+};
+
void BindURLToStatement(const TemplateURL& url, sql::Statement* s) {
s->BindString(0, UTF16ToUTF8(url.short_name()));
s->BindString(1, UTF16ToUTF8(url.keyword()));
@@ -271,14 +286,18 @@ int64 KeywordTable::GetDefaultSearchProviderID() {
std::string backup_signature;
meta_table_->GetValue(
kDefaultSearchProviderBackupSignatureKey, &backup_signature);
+ // For now only track how often signature or backup is lost or value is
+ // changed. Don't change the value since UI is not working yet.
if (!IsSearchProviderIDValid(backup_value, backup_signature)) {
- // TODO(avayvod): Notify UI about the setting having been hijacked and
- // the backup value lost.
- return value;
- }
- if (value != backup_value) {
- // TODO(avayvod): Notify UI about the setting having been hijacked.
- return backup_value;
+ UMA_HISTOGRAM_ENUMERATION(kProtectorHistogramDefaultSearchProvider,
+ kProtectorErrorBackupInvalid,
+ kProtectorErrorCount);
+ SetDefaultSearchProviderBackupID(value);
+ } else if (value != backup_value) {
+ UMA_HISTOGRAM_ENUMERATION(kProtectorHistogramDefaultSearchProvider,
+ kProtectorErrorValueChanged,
+ kProtectorErrorCount);
+ SetDefaultSearchProviderBackupID(value);
}
return value;
}