| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle
r.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle
r.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 19 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
| 23 #include "content/public/browser/user_metrics.h" | 23 #include "content/public/browser/user_metrics.h" |
| 24 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 | 27 |
| 28 using content::UserMetricsAction; |
| 29 |
| 28 namespace chromeos { | 30 namespace chromeos { |
| 29 | 31 |
| 30 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() { | 32 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() { |
| 31 } | 33 } |
| 32 | 34 |
| 33 CrosLanguageOptionsHandler::~CrosLanguageOptionsHandler() { | 35 CrosLanguageOptionsHandler::~CrosLanguageOptionsHandler() { |
| 34 } | 36 } |
| 35 | 37 |
| 36 void CrosLanguageOptionsHandler::GetLocalizedValues( | 38 void CrosLanguageOptionsHandler::GetLocalizedValues( |
| 37 DictionaryValue* localized_strings) { | 39 DictionaryValue* localized_strings) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); | 202 return l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void CrosLanguageOptionsHandler::SetApplicationLocale( | 205 void CrosLanguageOptionsHandler::SetApplicationLocale( |
| 204 const std::string& language_code) { | 206 const std::string& language_code) { |
| 205 Profile::FromWebUI(web_ui_)->ChangeAppLocale( | 207 Profile::FromWebUI(web_ui_)->ChangeAppLocale( |
| 206 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 208 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
| 207 } | 209 } |
| 208 | 210 |
| 209 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { | 211 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { |
| 210 UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 212 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
| 211 | 213 |
| 212 Browser* browser = Browser::GetBrowserForController( | 214 Browser* browser = Browser::GetBrowserForController( |
| 213 &web_ui_->tab_contents()->controller(), NULL); | 215 &web_ui_->tab_contents()->controller(), NULL); |
| 214 if (browser) | 216 if (browser) |
| 215 browser->ExecuteCommand(IDC_EXIT); | 217 browser->ExecuteCommand(IDC_EXIT); |
| 216 } | 218 } |
| 217 | 219 |
| 218 void CrosLanguageOptionsHandler::InputMethodDisableCallback( | 220 void CrosLanguageOptionsHandler::InputMethodDisableCallback( |
| 219 const ListValue* args) { | 221 const ListValue* args) { |
| 220 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 222 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 221 const std::string action = base::StringPrintf( | 223 const std::string action = base::StringPrintf( |
| 222 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); | 224 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); |
| 223 UserMetrics::RecordComputedAction(action); | 225 content::RecordComputedAction(action); |
| 224 } | 226 } |
| 225 | 227 |
| 226 void CrosLanguageOptionsHandler::InputMethodEnableCallback( | 228 void CrosLanguageOptionsHandler::InputMethodEnableCallback( |
| 227 const ListValue* args) { | 229 const ListValue* args) { |
| 228 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 230 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 229 const std::string action = base::StringPrintf( | 231 const std::string action = base::StringPrintf( |
| 230 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); | 232 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); |
| 231 UserMetrics::RecordComputedAction(action); | 233 content::RecordComputedAction(action); |
| 232 } | 234 } |
| 233 | 235 |
| 234 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 236 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
| 235 const ListValue* args) { | 237 const ListValue* args) { |
| 236 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 238 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 237 const std::string action = base::StringPrintf( | 239 const std::string action = base::StringPrintf( |
| 238 "InputMethodOptions_Open_%s", input_method_id.c_str()); | 240 "InputMethodOptions_Open_%s", input_method_id.c_str()); |
| 239 UserMetrics::RecordComputedAction(action); | 241 content::RecordComputedAction(action); |
| 240 } | 242 } |
| 241 | 243 |
| 242 } // namespace chromeos | 244 } // namespace chromeos |
| OLD | NEW |