summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorcsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:36:04 +0000
committercsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:36:04 +0000
commit0f3db35be89698ea3f6affd469ec372dbf1fe23b (patch)
treeddba55bd0267e2bd57096a2591acfa9acd6e81b6 /chrome
parent598a795a7d43bb0e04297c914ceb8c8ad3f2516b (diff)
downloadchromium_src-0f3db35be89698ea3f6affd469ec372dbf1fe23b.zip
chromium_src-0f3db35be89698ea3f6affd469ec372dbf1fe23b.tar.gz
chromium_src-0f3db35be89698ea3f6affd469ec372dbf1fe23b.tar.bz2
dom-ui options: record user metrics for pref changes.
BUG=52520 TEST=Verify metrics are saved when changing options in dom-ui options window (--enable-tabbed-options). Review URL: http://codereview.chromium.org/3190004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc9
-rw-r--r--chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h3
-rw-r--r--chrome/browser/dom_ui/advanced_options_handler.cc12
-rw-r--r--chrome/browser/dom_ui/browser_options_handler.cc6
-rw-r--r--chrome/browser/dom_ui/core_options_handler.cc42
-rw-r--r--chrome/browser/dom_ui/core_options_handler.h12
-rw-r--r--chrome/browser/resources/options/advanced_options.html43
-rw-r--r--chrome/browser/resources/options/advanced_options.js6
-rw-r--r--chrome/browser/resources/options/autofill_options.html3
-rw-r--r--chrome/browser/resources/options/browser_options.html30
-rw-r--r--chrome/browser/resources/options/browser_options.js2
-rw-r--r--chrome/browser/resources/options/content_settings.js1
-rw-r--r--chrome/browser/resources/options/font_settings_overlay.html21
-rw-r--r--chrome/browser/resources/options/personal_options.html8
-rw-r--r--chrome/browser/resources/options/personal_options.js5
-rw-r--r--chrome/browser/resources/options/pref_ui.js45
-rw-r--r--chrome/browser/resources/options/preferences.js28
17 files changed, 206 insertions, 70 deletions
diff --git a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc
index 4f66cd7..a8355cd 100644
--- a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.cc
@@ -7,6 +7,7 @@
#include "base/json/json_reader.h"
#include "base/string_number_conversions.h"
#include "chrome/browser/chromeos/cros_settings.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/common/notification_service.h"
namespace chromeos {
@@ -30,9 +31,11 @@ void CoreChromeOSOptionsHandler::ObservePref(const std::string& pref_name) {
void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name,
Value::ValueType pref_type,
- const std::string& value_string) {
+ const std::string& value_string,
+ const std::string& metric) {
if (!CrosSettings::IsCrosSettings(pref_name))
- return ::CoreOptionsHandler::SetPref(pref_name, pref_type, value_string);
+ return ::CoreOptionsHandler::SetPref(pref_name, pref_type, value_string,
+ metric);
CrosSettings* cros_settings = CrosSettings::Get();
switch (pref_type) {
@@ -57,6 +60,8 @@ void CoreChromeOSOptionsHandler::SetPref(const std::string& pref_name,
break;
}
}
+
+ ProcessUserMetric(pref_type, value_string, metric);
}
void CoreChromeOSOptionsHandler::Observe(NotificationType type,
diff --git a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h
index 80acdd3..aa58c29 100644
--- a/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h
+++ b/chrome/browser/chromeos/dom_ui/core_chromeos_options_handler.h
@@ -20,7 +20,8 @@ class CoreChromeOSOptionsHandler : public ::CoreOptionsHandler {
virtual void ObservePref(const std::string& pref_name);
virtual void SetPref(const std::string& pref_name,
Value::ValueType pref_type,
- const std::string& value_string);
+ const std::string& value_string,
+ const std::string& metric);
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/dom_ui/advanced_options_handler.cc b/chrome/browser/dom_ui/advanced_options_handler.cc
index 21095e7..d23dfeb 100644
--- a/chrome/browser/dom_ui/advanced_options_handler.cc
+++ b/chrome/browser/dom_ui/advanced_options_handler.cc
@@ -218,11 +218,15 @@ void AdvancedOptionsHandler::HandleSelectDownloadLocation(
void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index,
void* params) {
+ UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory"),
+ NULL);
default_download_location_.SetValue(path);
SetupDownloadLocationPath();
}
void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) {
+ UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"),
+ NULL);
DCHECK(dom_ui_);
DownloadManager* manager = dom_ui_->GetProfile()->GetDownloadManager();
if (manager) manager->ResetAutoOpenFiles();
@@ -231,12 +235,20 @@ void AdvancedOptionsHandler::HandleAutoOpenButton(const ListValue* args) {
#if defined(OS_WIN)
void AdvancedOptionsHandler::HandleCheckRevocationCheckbox(
const ListValue* args) {
+ UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL);
std::string checked_str = WideToUTF8(ExtractStringValue(args));
+ std::string metric =
+ (checked_str == "true" ? "Options_CheckCertRevocation_Enable"
+ : "Options_CheckCertRevocation_Disable");
net::SSLConfigServiceWin::SetRevCheckingEnabled(checked_str == "true");
}
void AdvancedOptionsHandler::HandleUseSSL2Checkbox(const ListValue* args) {
+ UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL);
std::string checked_str = WideToUTF8(ExtractStringValue(args));
+ std::string metric =
+ (checked_str == "true" ? "Options_SSL2_Enable"
+ : "Options_SSL2_Disable");
net::SSLConfigServiceWin::SetSSL2Enabled(checked_str == "true");
}
diff --git a/chrome/browser/dom_ui/browser_options_handler.cc b/chrome/browser/dom_ui/browser_options_handler.cc
index bcad24b..1405d1e 100644
--- a/chrome/browser/dom_ui/browser_options_handler.cc
+++ b/chrome/browser/dom_ui/browser_options_handler.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/custom_home_pages_table_model.h"
#include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
#include "chrome/browser/dom_ui/options_managed_banner_handler.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/options_window.h"
@@ -139,6 +140,8 @@ void BrowserOptionsHandler::UpdateDefaultBrowserState() {
}
void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) {
+ UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser"),
+ NULL);
#if defined(OS_MACOSX)
if (ShellIntegration::SetAsDefaultBrowser())
UpdateDefaultBrowserState();
@@ -226,6 +229,9 @@ void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
if (selected_index >= 0 &&
selected_index < static_cast<int>(model_urls.size()))
template_url_model_->SetDefaultSearchProvider(model_urls[selected_index]);
+
+ UserMetricsRecordAction(UserMetricsAction("Options_SearchEngineChanged"),
+ NULL);
}
void BrowserOptionsHandler::UpdateSearchEngines() {
diff --git a/chrome/browser/dom_ui/core_options_handler.cc b/chrome/browser/dom_ui/core_options_handler.cc
index 9137326..37171cf 100644
--- a/chrome/browser/dom_ui/core_options_handler.cc
+++ b/chrome/browser/dom_ui/core_options_handler.cc
@@ -9,10 +9,11 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_type.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -110,6 +111,8 @@ void CoreOptionsHandler::RegisterMessages() {
NewCallback(this, &CoreOptionsHandler::HandleSetStringPref));
dom_ui_->RegisterMessageCallback("setObjectPref",
NewCallback(this, &CoreOptionsHandler::HandleSetObjectPref));
+ dom_ui_->RegisterMessageCallback("coreOptionsUserMetricsAction",
+ NewCallback(this, &CoreOptionsHandler::HandleUserMetricsAction));
}
void CoreOptionsHandler::HandleInitialize(const ListValue* args) {
@@ -143,7 +146,8 @@ void CoreOptionsHandler::ObservePref(const std::string& pref_name) {
void CoreOptionsHandler::SetPref(const std::string& pref_name,
Value::ValueType pref_type,
- const std::string& value_string) {
+ const std::string& value_string,
+ const std::string& metric) {
DCHECK(dom_ui_);
PrefService* pref_service = dom_ui_->GetProfile()->GetPrefs();
@@ -162,6 +166,22 @@ void CoreOptionsHandler::SetPref(const std::string& pref_name,
default:
NOTREACHED();
}
+
+ ProcessUserMetric(pref_type, value_string, metric);
+}
+
+void CoreOptionsHandler::ProcessUserMetric(Value::ValueType pref_type,
+ const std::string& value_string,
+ const std::string& metric) {
+ if (metric.empty())
+ return;
+
+ std::string metric_string = metric;
+ if (pref_type == Value::TYPE_BOOLEAN)
+ metric_string += (value_string == "true" ? "_Enable" : "_Disable");
+
+ UserMetricsRecordAction(UserMetricsAction(metric_string.c_str()),
+ dom_ui_->GetProfile()->GetPrefs());
}
void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) {
@@ -202,8 +222,6 @@ void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) {
}
void CoreOptionsHandler::HandleObservePrefs(const ListValue* args) {
- DictionaryValue result_value;
-
// First param is name is JS callback function name, the rest are pref
// identifiers that we are observing.
const size_t kMinObservePrefsParamCount = 2;
@@ -254,7 +272,7 @@ void CoreOptionsHandler::HandleSetObjectPref(const ListValue* args) {
void CoreOptionsHandler::HandleSetPref(const ListValue* args,
Value::ValueType type) {
- if (args->GetSize() != 2)
+ if (args->GetSize() < 2)
return;
std::string pref_name;
@@ -265,7 +283,17 @@ void CoreOptionsHandler::HandleSetPref(const ListValue* args,
if (!args->GetString(1, &value_string))
return;
- SetPref(pref_name, type, value_string);
+ std::string metric;
+ if (args->GetSize() > 2)
+ args->GetString(2, &metric);
+
+ SetPref(pref_name, type, value_string, metric);
+}
+
+void CoreOptionsHandler::HandleUserMetricsAction(const ListValue* args) {
+ std::string metric = WideToUTF8(ExtractStringValue(args));
+ if (!metric.empty())
+ UserMetricsRecordAction(UserMetricsAction(metric.c_str()), NULL);
}
void CoreOptionsHandler::NotifyPrefChanged(const std::string* pref_name) {
diff --git a/chrome/browser/dom_ui/core_options_handler.h b/chrome/browser/dom_ui/core_options_handler.h
index 4a51cad..9eaf44a 100644
--- a/chrome/browser/dom_ui/core_options_handler.h
+++ b/chrome/browser/dom_ui/core_options_handler.h
@@ -41,7 +41,13 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
// Sets a pref value |value_string| of |pref_type| to given |pref_name|.
virtual void SetPref(const std::string& pref_name,
Value::ValueType pref_type,
- const std::string& value_string);
+ const std::string& value_string,
+ const std::string& metric);
+
+ // Records a user metric action for the given value.
+ void ProcessUserMetric(Value::ValueType pref_type,
+ const std::string& value_string,
+ const std::string& metric);
typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap;
PreferenceCallbackMap pref_callback_map_;
@@ -71,6 +77,10 @@ class CoreOptionsHandler : public OptionsPageUIHandler {
void HandleSetPref(const ListValue* args, Value::ValueType type);
+ // Callback for the "coreOptionsUserMetricsAction" message. This records
+ // an action that should be tracked if metrics recording is enabled.
+ void HandleUserMetricsAction(const ListValue* args);
+
void NotifyPrefChanged(const std::string* pref_name);
DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler);
diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html
index c76b52e..de1cbeb 100644
--- a/chrome/browser/resources/options/advanced_options.html
+++ b/chrome/browser/resources/options/advanced_options.html
@@ -13,21 +13,24 @@
<div><a target="_blank" i18n-content="privacyLearnMoreLabel"
i18n-values="href:privacyLearnMoreURL"></a></div>
<label><input id="alternateErrorPagesEnabled"
- pref="alternate_error_pages.enabled" type="checkbox"><span
+ pref="alternate_error_pages.enabled"
+ metric="Options_LinkDoctorCheckbox" type="checkbox"><span
i18n-content="linkDoctorPref"></span></label>
<label><input id="searchSuggestEnabled"
- pref="search.suggest_enabled" type="checkbox"><span
- i18n-content="suggestPref"></span></label>
+ pref="search.suggest_enabled" metric="Options_UseSuggestCheckbox"
+ type="checkbox"><span i18n-content="suggestPref"></span></label>
<label><input id="dnsPrefetchingEnabled"
- pref="dns_prefetching.enabled" type="checkbox"><span
- i18n-content="networkDNSPrefetchEnabledDescription"></span>
- </label>
+ pref="dns_prefetching.enabled" metric="Options_DnsPrefetchCheckbox"
+ type="checkbox"><span
+ i18n-content="networkDNSPrefetchEnabledDescription"></span></label>
<label><input id="safeBrowsingEnabled"
- pref="safebrowsing.enabled" type="checkbox"><span
- i18n-content="safeBrowsingEnableProtection"></span></label>
+ pref="safebrowsing.enabled" metric="Options_SafeBrowsingCheckbox"
+ type="checkbox"><span i18n-content="safeBrowsingEnableProtection">
+ </span></label>
<if expr="pp_ifdef('_google_chrome')">
<label><input id="metricsReportingEnabled"
- pref="user_experience_metrics.reporting_enabled" type="checkbox">
+ pref="user_experience_metrics.reporting_enabled"
+ metric="Options_MetricsReportingCheckbox" type="checkbox">
<span i18n-content="enableLogging"></span></label>
</if>
</div>
@@ -44,8 +47,8 @@
<h3 i18n-content="advancedSectionTitleTranslate"></h3>
<div>
<label><input id="enableTranslate"
- pref="translate.enabled" type="checkbox"><span
- i18n-content="translateEnableTranslate"></span></label>
+ pref="translate.enabled" metric="Options_Translate" type="checkbox">
+ <span i18n-content="translateEnableTranslate"></span></label>
</div>
</section>
<section>
@@ -59,7 +62,8 @@
i18n-content="downloadLocationBrowseButton"></button>
</div>
<label><input id="promptForDownload"
- pref="download.prompt_for_download" type="checkbox"><span
+ pref="download.prompt_for_download"
+ metric="Options_AskForSaveLocation" type="checkbox"><span
i18n-content="downloadLocationAskForSaveLocation"></span></label>
</if>
<div i18n-content="autoOpenFileTypesInfo"></div>
@@ -72,8 +76,8 @@
<div>
<if expr="os == 'darwin'">
<label><input id="tabsToLinksPref"
- pref="webkit.webprefs.tabs_to_links" type="checkbox"><span
- i18n-content="tabsToLinksPref"></span></label>
+ pref="webkit.webprefs.tabs_to_links" metric="Options_TabsToLinks"
+ type="checkbox"><span i18n-content="tabsToLinksPref"></span></label>
</if>
<div><button id="fontSettingsConfigureFontsOnlyButton"
i18n-content="fontSettingsConfigureFontsOnlyButton"></button></div>
@@ -108,16 +112,17 @@
<if expr="not pp_ifdef('chromeos') and (os == 'linux2' or os.find('bsd') != -1)">
<!-- Configure these options for Linux/BSD as preference keys -->
<label><input id="sslCheckRevocation"
- pref="ssl.rev_checking.enabled" type="checkbox"><span
- i18n-content="sslCheckRevocation"></span></label>
+ pref="ssl.rev_checking.enabled" metric="Options_CheckCertRevocation"
+ type="checkbox"><span i18n-content="sslCheckRevocation"></span>
+ </label>
<label><input id="sslUseSSL2"
- pref="ssl.ssl2.enabled" type="checkbox"><span
+ pref="ssl.ssl2.enabled" metric="Options_SSL2" type="checkbox"><span
i18n-content="sslUseSSL2"></span></label>
<label><input id="sslUseSSL3"
- pref="ssl.ssl3.enabled" type="checkbox"><span
+ pref="ssl.ssl3.enabled" metric="Options_SSL3" type="checkbox"><span
i18n-content="sslUseSSL3"></span></label>
<label><input id="sslUseTLS1"
- pref="ssl.tls1.enabled" type="checkbox"><span
+ pref="ssl.tls1.enabled" metric="Options_TLS1" type="checkbox"><span
i18n-content="sslUseTLS1"></span></label>
</if>
<if expr="not pp_ifdef('chromeos')">
diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js
index 57ef20f..d03e26e 100644
--- a/chrome/browser/resources/options/advanced_options.js
+++ b/chrome/browser/resources/options/advanced_options.js
@@ -30,15 +30,19 @@ var OptionsPage = options.OptionsPage;
$('privacyContentSettingsButton').onclick = function(event) {
OptionsPage.showPageByName('content');
OptionsPage.showTab($('cookies-nav-tab'));
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ContentSettings']);
};
$('privacyClearDataButton').onclick = function(event) {
OptionsPage.showOverlay('clearBrowserDataOverlay');
+ chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']);
};
$('autoOpenFileTypesResetToDefault').onclick = function(event) {
chrome.send('autoOpenFileTypesAction');
};
$('fontSettingsConfigureFontsOnlyButton').onclick = function(event) {
OptionsPage.showOverlay('fontSettingsOverlay');
+ chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']);
};
if (!cr.isChromeOS) {
@@ -61,6 +65,8 @@ var OptionsPage = options.OptionsPage;
} else {
$('proxiesConfigureButton').onclick = function(event) {
OptionsPage.showPageByName('proxy');
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ShowProxySettings']);
};
}
diff --git a/chrome/browser/resources/options/autofill_options.html b/chrome/browser/resources/options/autofill_options.html
index ccd4f88..46b1601 100644
--- a/chrome/browser/resources/options/autofill_options.html
+++ b/chrome/browser/resources/options/autofill_options.html
@@ -6,7 +6,8 @@
</h1>
<div class="autofill-section">
- <label><input id="autoFillEnabled" pref="autofill.enabled"type="checkbox">
+ <label><input id="autoFillEnabled" pref="autofill.enabled"
+ metric="Options_FormAutofill" type="checkbox">
<span i18n-content="autoFillEnabled"></span></label>
</div>
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html
index d9ae42a..3e9a9c5 100644
--- a/chrome/browser/resources/options/browser_options.html
+++ b/chrome/browser/resources/options/browser_options.html
@@ -4,14 +4,17 @@
<h3 i18n-content="startupGroupName"></h3>
<div>
<label><input type="radio" name="startup"
- pref="session.restore_on_startup" value="0"><span
- i18n-content="startupShowDefaultAndNewTab"></span></label>
+ pref="session.restore_on_startup" value="0"
+ metric="Options_Startup_Homepage">
+ <span i18n-content="startupShowDefaultAndNewTab"></span></label>
<label><input type="radio" name="startup"
- pref="session.restore_on_startup" value="1"><span
- i18n-content="startupShowLastSession"></span></label>
+ pref="session.restore_on_startup" value="1"
+ metric="Options_Startup_LastSession">
+ <span i18n-content="startupShowLastSession"></span></label>
<label><input type="radio" name="startup" id="startupShowPagesButton"
- pref="session.restore_on_startup" value="4"><span
- i18n-content="startupShowPages"></span></label>
+ pref="session.restore_on_startup" value="4"
+ metric="Options_Startup_Custom">
+ <span i18n-content="startupShowPages"></span></label>
<div class="suboption">
<div class="left-side-table">
<div>
@@ -33,18 +36,21 @@
<h3 i18n-content="homepageGroupName"></h3>
<div>
<label><input type="radio" name="homepage"
- pref="homepage_is_newtabpage" value="true"><span
- i18n-content="homepageUseNewTab"></span></label>
+ pref="homepage_is_newtabpage" value="true"
+ metric="Options_Homepage_IsNewTabPage">
+ <span i18n-content="homepageUseNewTab"></span></label>
<label><input type="radio" name="homepage" id="homepageUseURLButton"
- pref="homepage_is_newtabpage" value="false"><span
- i18n-content="homepageUseURL"></span></label>
+ pref="homepage_is_newtabpage" value="false"
+ metric="Options_Homepage_IsNewTabPage">
+ <span i18n-content="homepageUseURL"></span></label>
<div class="suboption">
<input id="homepageURL" type="url" pref="homepage">
</div>
<div class="option">
<label><input id="homepageShowButton"
- pref="browser.show_home_button" type="checkbox"><span
- i18n-content="homepageShowButton"></span></label>
+ pref="browser.show_home_button"
+ metric="Options_Homepage_HomeButton" type="checkbox">
+ <span i18n-content="homepageShowButton"></span></label>
</div>
</div>
</section>
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index d4f725d..71465c1 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -39,6 +39,8 @@ cr.define('options', function() {
};
$('defaultSearchManageEnginesButton').onclick = function(event) {
OptionsPage.showPageByName('searchEngines');
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ManageSearchEngines']);
};
if (!cr.isChromeOS) {
$('defaultBrowserUseAsDefaultButton').onclick = function(event) {
diff --git a/chrome/browser/resources/options/content_settings.js b/chrome/browser/resources/options/content_settings.js
index 5756ce9..38bd04a 100644
--- a/chrome/browser/resources/options/content_settings.js
+++ b/chrome/browser/resources/options/content_settings.js
@@ -55,6 +55,7 @@ cr.define('options', function() {
};
$('show-cookies-button').onclick = function(event) {
+ chrome.send('coreOptionsUserMetricsAction', ['Options_ShowCookies']);
// TODO(estade): show cookies and other site data page.
};
},
diff --git a/chrome/browser/resources/options/font_settings_overlay.html b/chrome/browser/resources/options/font_settings_overlay.html
index 4a6757c..1efed64 100644
--- a/chrome/browser/resources/options/font_settings_overlay.html
+++ b/chrome/browser/resources/options/font_settings_overlay.html
@@ -7,12 +7,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsSerifLabel"></span>
<select id="fontSettingsSerifSelector"
- pref="webkit.webprefs.serif_font_family"></select>
+ pref="webkit.webprefs.serif_font_family"
+ metric="Options_ChangeSerifFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsSerifSizeSelector"
- pref="webkit.webprefs.default_font_size"></select>
+ pref="webkit.webprefs.default_font_size"
+ metric="Options_ChangeSerifFontSize"></select>
</label>
<div id="fontSettingsSerifPreview"></div>
</div>
@@ -20,12 +22,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsSansSerifLabel"></span>
<select id="fontSettingsSansSerifSelector"
- pref="webkit.webprefs.sansserif_font_family"></select>
+ pref="webkit.webprefs.sansserif_font_family"
+ metric="Options_ChangeSansSerifFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsSansSerifSizeSelector"
- pref="webkit.webprefs.default_font_size"></select>
+ pref="webkit.webprefs.default_font_size"
+ metric="Options_ChangeSansSerifFontSize"></select>
</label>
<div id="fontSettingsSansSerifPreview"></div>
</div>
@@ -33,12 +37,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsFixedWidthLabel"></span>
<select id="fontSettingsFixedWidthSelector"
- pref="webkit.webprefs.fixed_font_family"></select>
+ pref="webkit.webprefs.fixed_font_family"
+ metric="Options_ChangeFixedFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsFixedWidthSizeSelector"
- pref="webkit.webprefs.default_fixed_font_size"></select>
+ pref="webkit.webprefs.default_fixed_font_size"
+ metric="Options_ChangeFixedFontSize"></select>
</label>
<div id="fontSettingsFixedWidthPreview"></div>
</div>
@@ -50,7 +56,8 @@
<label style="display:inline;">
<span i18n-content="fontSettingsEncodingLabel"></span>
<select id="fontSettingsEncodingSelector"
- pref="intl.charset_default"></select>
+ pref="intl.charset_default" metric="Options_ChangeFontEncoding">
+ </select>
</label>
</div>
</section>
diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html
index a90cb50..879f14e 100644
--- a/chrome/browser/resources/options/personal_options.html
+++ b/chrome/browser/resources/options/personal_options.html
@@ -29,14 +29,14 @@
<input id="passwords_asktosave"
name="passwords_radio"
pref="profile.password_manager_enabled"
- type="radio" value="true">
+ type="radio" value="true" metric="Options_PasswordManager">
<span i18n-content="passwords_asktosave"></span>
</label>
<label>
<input id="passwords_neversave"
name="passwords_radio"
pref="profile.password_manager_enabled"
- type="radio" value="false">
+ type="radio" value="false" metric="Options_PasswordManager">
<span i18n-content="passwords_neversave"></span>
</label>
<div><button id="showpasswords"
@@ -71,13 +71,13 @@
<label>
<input name="decorations_radio"
pref="browser.custom_chrome_frame"
- type="radio" value="false">
+ type="radio" value="false" metric="Options_CustomFrame">
<span i18n-content="showWindow_decorations_radio"></span>
</label>
<label>
<input name="decorations_radio"
pref="browser.custom_chrome_frame"
- type="radio" value="true">
+ type="radio" value="true" metric="Options_CustomFrame">
<span i18n-content="hideWindow_decorations_radio"></span>
</label>
</div>
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 4ffd2b9..7b9f170 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -50,10 +50,14 @@ cr.define('options', function() {
PasswordsExceptions.load();
OptionsPage.showPageByName('passwordsExceptions');
OptionsPage.showTab($('passwords-nav-tab'));
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ShowPasswordsExceptions']);
};
$('autofill_options').onclick = function(event) {
OptionsPage.showPageByName('autoFillOptions');
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ShowAutoFillSettings']);
};
if (!cr.isChromeOS) {
@@ -63,6 +67,7 @@ cr.define('options', function() {
$('import_data').onclick = function(event) {
ImportDataOverlay.loadImporter();
OptionsPage.showOverlay('importDataOverlay');
+ chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']);
};
}
diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js
index a09e737e..ffc7ae7 100644
--- a/chrome/browser/resources/options/pref_ui.js
+++ b/chrome/browser/resources/options/pref_ui.js
@@ -33,7 +33,7 @@ cr.define('options', function() {
// Listen to user events.
this.addEventListener('click',
function(e) {
- Preferences.setBooleanPref(self.pref, self.checked);
+ Preferences.setBooleanPref(self.pref, self.checked, self.metric);
});
}
};
@@ -44,6 +44,12 @@ cr.define('options', function() {
*/
cr.defineProperty(PrefCheckbox, 'pref', cr.PropertyKind.ATTR);
+ /**
+ * The user metric string.
+ * @type {string}
+ */
+ cr.defineProperty(PrefCheckbox, 'metric', cr.PropertyKind.ATTR);
+
/////////////////////////////////////////////////////////////////////////////
// PrefRadio class:
@@ -74,10 +80,10 @@ cr.define('options', function() {
function(e) {
if(self.value == 'true' || self.value == 'false') {
Preferences.setBooleanPref(self.pref,
- self.value == 'true');
+ self.value == 'true', self.metric);
} else {
Preferences.setIntegerPref(self.pref,
- parseInt(self.value, 10));
+ parseInt(self.value, 10), self.metric);
}
});
},
@@ -97,6 +103,11 @@ cr.define('options', function() {
}
};
+ /**
+ * The user metric string.
+ * @type {string}
+ */
+ cr.defineProperty(PrefRadio, 'metric', cr.PropertyKind.ATTR);
/////////////////////////////////////////////////////////////////////////////
// PrefNumeric class:
@@ -124,7 +135,7 @@ cr.define('options', function() {
// Listen to user events.
this.addEventListener('change',
function(e) {
- Preferences.setIntegerPref(self.pref, self.value);
+ Preferences.setIntegerPref(self.pref, self.value, self.metric);
});
}
};
@@ -135,6 +146,12 @@ cr.define('options', function() {
*/
cr.defineProperty(PrefNumeric, 'pref', cr.PropertyKind.ATTR);
+ /**
+ * The user metric string.
+ * @type {string}
+ */
+ cr.defineProperty(PrefNumeric, 'metric', cr.PropertyKind.ATTR);
+
/////////////////////////////////////////////////////////////////////////////
// PrefNumber class:
@@ -209,15 +226,15 @@ cr.define('options', function() {
switch(self.dataType) {
case 'number':
Preferences.setIntegerPref(self.pref,
- self.options[self.selectedIndex].value);
+ self.options[self.selectedIndex].value, self.metric);
break;
case 'boolean':
Preferences.setBooleanValue(self.pref,
- self.options[self.selectedIndex].value);
+ self.options[self.selectedIndex].value, self.metric);
break;
case 'string':
Preferences.setStringPref(self.pref,
- self.options[self.selectedIndex].value);
+ self.options[self.selectedIndex].value, self.metric);
break;
}
});
@@ -255,6 +272,12 @@ cr.define('options', function() {
*/
cr.defineProperty(PrefSelect, 'pref', cr.PropertyKind.ATTR);
+ /**
+ * The user metric string.
+ * @type {string}
+ */
+ cr.defineProperty(PrefSelect, 'metric', cr.PropertyKind.ATTR);
+
/////////////////////////////////////////////////////////////////////////////
// PrefTextField class:
@@ -282,7 +305,7 @@ cr.define('options', function() {
// Listen to user events.
this.addEventListener('change',
function(e) {
- Preferences.setStringPref(self.pref, self.value);
+ Preferences.setStringPref(self.pref, self.value, self.metric);
});
window.addEventListener('unload',
@@ -299,6 +322,12 @@ cr.define('options', function() {
*/
cr.defineProperty(PrefTextField, 'pref', cr.PropertyKind.ATTR);
+ /**
+ * The user metric string.
+ * @type {string}
+ */
+ cr.defineProperty(PrefTextField, 'metric', cr.PropertyKind.ATTR);
+
// Export
return {
PrefCheckbox: PrefCheckbox,
diff --git a/chrome/browser/resources/options/preferences.js b/chrome/browser/resources/options/preferences.js
index 72d1a09..b641f37 100644
--- a/chrome/browser/resources/options/preferences.js
+++ b/chrome/browser/resources/options/preferences.js
@@ -41,9 +41,12 @@ cr.define('options', function() {
* and signals its changed value.
* @param {string} name Preference name.
* @param {boolean} value New preference value.
+ * @param {string} metric User metrics identifier.
*/
- Preferences.setBooleanPref = function (name, value) {
- chrome.send('setBooleanPref', [name, value ? 'true' : 'false']);
+ Preferences.setBooleanPref = function (name, value, metric) {
+ var arguments = [name, value ? 'true' : 'false'];
+ if (metric != undefined) arguments.push(metric);
+ chrome.send('setBooleanPref', arguments);
};
/**
@@ -51,9 +54,12 @@ cr.define('options', function() {
* and signals its changed value.
* @param {string} name Preference name.
* @param {number} value New preference value.
+ * @param {string} metric User metrics identifier.
*/
- Preferences.setIntegerPref = function(name, value) {
- chrome.send('setIntegerPref', [name, String(value)]);
+ Preferences.setIntegerPref = function(name, value, metric) {
+ var arguments = [name, String(value)];
+ if (metric != undefined) arguments.push(metric);
+ chrome.send('setIntegerPref', arguments);
};
/**
@@ -61,9 +67,12 @@ cr.define('options', function() {
* and signals its changed value.
* @param {string} name Preference name.
* @param {string} value New preference value.
+ * @param {string} metric User metrics identifier.
*/
- Preferences.setStringPref = function(name, value) {
- chrome.send('setStringPref', [name, value]);
+ Preferences.setStringPref = function(name, value, metric) {
+ var arguments = [name, value];
+ if (metric != undefined) arguments.push(metric);
+ chrome.send('setStringPref', arguments);
};
/**
@@ -71,9 +80,12 @@ cr.define('options', function() {
* and signals its changed value.
* @param {string} name Preference name.
* @param {string} value New preference value.
+ * @param {string} metric User metrics identifier.
*/
- Preferences.setObjectPref = function(name, value) {
- chrome.send('setObjectPref', [name, JSON.stringify(value)]);
+ Preferences.setObjectPref = function(name, value, metric) {
+ var arguments = [name, JSON.stringify(value)];
+ if (metric != undefined) arguments.push(metric);
+ chrome.send('setObjectPref', arguments);
};
Preferences.prototype = {