diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 02:19:33 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 02:19:33 +0000 |
commit | 64043ec5fbcef7dabcd6ac71834992d8bfa5dbf0 (patch) | |
tree | 6c35382b2b77e52c5db3d286f418b22f85040410 /chrome/browser/chromeos | |
parent | b4a5523670224f3f89c84719bb6228be8f56b7eb (diff) | |
download | chromium_src-64043ec5fbcef7dabcd6ac71834992d8bfa5dbf0.zip chromium_src-64043ec5fbcef7dabcd6ac71834992d8bfa5dbf0.tar.gz chromium_src-64043ec5fbcef7dabcd6ac71834992d8bfa5dbf0.tar.bz2 |
Record user actions in "Language and Input" page.
BUG=chromium-os:2637
TEST=manually
Review URL: http://codereview.chromium.org/3330014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/dom_ui/language_options_handler.cc | 45 | ||||
-rw-r--r-- | chrome/browser/chromeos/dom_ui/language_options_handler.h | 17 |
2 files changed, 61 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/dom_ui/language_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_options_handler.cc index 49bd884..fee33c4 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_options_handler.cc @@ -18,6 +18,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/input_method_library.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" +#include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" @@ -103,6 +104,15 @@ void LanguageOptionsHandler::GetLocalizedValues( void LanguageOptionsHandler::RegisterMessages() { DCHECK(dom_ui_); + dom_ui_->RegisterMessageCallback("inputMethodDisable", + NewCallback(this, &LanguageOptionsHandler::InputMethodDisableCallback)); + dom_ui_->RegisterMessageCallback("inputMethodEnable", + NewCallback(this, &LanguageOptionsHandler::InputMethodEnableCallback)); + dom_ui_->RegisterMessageCallback("inputMethodOptionsOpen", + NewCallback(this, + &LanguageOptionsHandler::InputMethodOptionsOpenCallback)); + dom_ui_->RegisterMessageCallback("languageOptionsOpen", + NewCallback(this, &LanguageOptionsHandler::LanguageOptionsOpenCallback)); dom_ui_->RegisterMessageCallback("uiLanguageChange", NewCallback(this, &LanguageOptionsHandler::UiLanguageChangeCallback)); dom_ui_->RegisterMessageCallback("uiLanguageRestart", @@ -215,8 +225,41 @@ DictionaryValue* LanguageOptionsHandler::GetUiLanguageCodeSet() { return dictionary; } +void LanguageOptionsHandler::InputMethodDisableCallback( + const ListValue* args) { + std::string input_method_id = WideToASCII(ExtractStringValue(args)); + // TODO(satorux): Record the input method ID code as well. + UserMetrics::RecordAction( + UserMetricsAction("LanguageOptions_DisableInputMethod")); +} + +void LanguageOptionsHandler::InputMethodEnableCallback( + const ListValue* args) { + std::string input_method_id = WideToASCII(ExtractStringValue(args)); + // TODO(satorux): Record the input method ID code as well. + UserMetrics::RecordAction( + UserMetricsAction("LanguageOptions_EnableInputMethod")); +} + +void LanguageOptionsHandler::InputMethodOptionsOpenCallback( + const ListValue* args) { + std::string input_method_id = WideToASCII(ExtractStringValue(args)); + // TODO(satorux): Record the input method ID code as well. + UserMetrics::RecordAction( + UserMetricsAction("InputMethodOptions_Open")); +} + +void LanguageOptionsHandler::LanguageOptionsOpenCallback( + const ListValue* args) { + UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Open")); +} + void LanguageOptionsHandler::UiLanguageChangeCallback( const ListValue* args) { + // TODO(satorux): Record the language code as well. + UserMetrics::RecordAction( + UserMetricsAction("LanguageOptions_UiLanguageChange")); + std::string language_code = WideToASCII(ExtractStringValue(args)); CHECK(!language_code.empty()); PrefService* prefs = g_browser_process->local_state(); @@ -227,6 +270,8 @@ void LanguageOptionsHandler::UiLanguageChangeCallback( } void LanguageOptionsHandler::RestartCallback(const ListValue* args) { + UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Restart")); + Browser* browser = Browser::GetBrowserForController( &dom_ui_->tab_contents()->controller(), NULL); // TODO(kochi): For ChromiumOS, just exiting means browser restart. diff --git a/chrome/browser/chromeos/dom_ui/language_options_handler.h b/chrome/browser/chromeos/dom_ui/language_options_handler.h index 5a45dd8..79ab6857 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_handler.h +++ b/chrome/browser/chromeos/dom_ui/language_options_handler.h @@ -53,8 +53,23 @@ class LanguageOptionsHandler : public OptionsPageUIHandler { static DictionaryValue* GetUiLanguageCodeSet(); private: + // Called when the input method is disabled. + // |args| will contain the input method ID as string (ex. "mozc"). + void InputMethodDisableCallback(const ListValue* args); + + // Called when the input method is enabled. + // |args| will contain the input method ID as string (ex. "mozc"). + void InputMethodEnableCallback(const ListValue* args); + + // Called when the input method options page is opened. + // |args| will contain the input method ID as string (ex. "mozc"). + void InputMethodOptionsOpenCallback(const ListValue* args); + + // Called when the language options is opened. + void LanguageOptionsOpenCallback(const ListValue* args); + // Called when the UI language is changed. - // |args| will be the language code as string (ex. "fr"). + // |args| will contain the language code as string (ex. "fr"). void UiLanguageChangeCallback(const ListValue* args); // Called when the restart button is clicked. |