| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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
r2.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/cros_language_options_handle
r2.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/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 20 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 20 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" |
| 23 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
| 24 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 26 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| 30 using content::UserMetricsAction; | 31 using content::UserMetricsAction; |
| 31 | 32 |
| 32 namespace chromeos { | 33 namespace chromeos { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 void CrosLanguageOptionsHandler::SetApplicationLocale( | 212 void CrosLanguageOptionsHandler::SetApplicationLocale( |
| 212 const std::string& language_code) { | 213 const std::string& language_code) { |
| 213 Profile::FromWebUI(web_ui())->ChangeAppLocale( | 214 Profile::FromWebUI(web_ui())->ChangeAppLocale( |
| 214 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 215 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { | 218 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { |
| 218 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 219 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
| 219 | 220 |
| 220 Browser* browser = Browser::GetBrowserForController( | 221 Browser* browser = browser::FindBrowserForController( |
| 221 &web_ui()->GetWebContents()->GetController(), NULL); | 222 &web_ui()->GetWebContents()->GetController(), NULL); |
| 222 if (browser) | 223 if (browser) |
| 223 browser->ExecuteCommand(IDC_EXIT); | 224 browser->ExecuteCommand(IDC_EXIT); |
| 224 } | 225 } |
| 225 | 226 |
| 226 void CrosLanguageOptionsHandler::InputMethodDisableCallback( | 227 void CrosLanguageOptionsHandler::InputMethodDisableCallback( |
| 227 const ListValue* args) { | 228 const ListValue* args) { |
| 228 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 229 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 229 const std::string action = base::StringPrintf( | 230 const std::string action = base::StringPrintf( |
| 230 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); | 231 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 242 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 243 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
| 243 const ListValue* args) { | 244 const ListValue* args) { |
| 244 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 245 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 245 const std::string action = base::StringPrintf( | 246 const std::string action = base::StringPrintf( |
| 246 "InputMethodOptions_Open_%s", input_method_id.c_str()); | 247 "InputMethodOptions_Open_%s", input_method_id.c_str()); |
| 247 content::RecordComputedAction(action); | 248 content::RecordComputedAction(action); |
| 248 } | 249 } |
| 249 | 250 |
| 250 } // namespace options2 | 251 } // namespace options2 |
| 251 } // namespace chromeos | 252 } // namespace chromeos |
| OLD | NEW |