| 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
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/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" | |
| 23 #include "content/public/browser/user_metrics.h" | 22 #include "content/public/browser/user_metrics.h" |
| 23 #include "content/public/browser/web_contents.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; | 28 using content::UserMetricsAction; |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 namespace options2 { | 31 namespace options2 { |
| 32 | 32 |
| 33 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() { | 33 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void CrosLanguageOptionsHandler::SetApplicationLocale( | 207 void CrosLanguageOptionsHandler::SetApplicationLocale( |
| 208 const std::string& language_code) { | 208 const std::string& language_code) { |
| 209 Profile::FromWebUI(web_ui())->ChangeAppLocale( | 209 Profile::FromWebUI(web_ui())->ChangeAppLocale( |
| 210 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 210 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { | 213 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { |
| 214 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 214 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
| 215 | 215 |
| 216 Browser* browser = Browser::GetBrowserForController( | 216 Browser* browser = Browser::GetBrowserForController( |
| 217 &web_ui()->tab_contents()->GetController(), NULL); | 217 &web_ui()->web_contents()->GetController(), NULL); |
| 218 if (browser) | 218 if (browser) |
| 219 browser->ExecuteCommand(IDC_EXIT); | 219 browser->ExecuteCommand(IDC_EXIT); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CrosLanguageOptionsHandler::InputMethodDisableCallback( | 222 void CrosLanguageOptionsHandler::InputMethodDisableCallback( |
| 223 const ListValue* args) { | 223 const ListValue* args) { |
| 224 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 224 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 225 const std::string action = base::StringPrintf( | 225 const std::string action = base::StringPrintf( |
| 226 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); | 226 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); |
| 227 content::RecordComputedAction(action); | 227 content::RecordComputedAction(action); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 238 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 238 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
| 239 const ListValue* args) { | 239 const ListValue* args) { |
| 240 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 240 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 241 const std::string action = base::StringPrintf( | 241 const std::string action = base::StringPrintf( |
| 242 "InputMethodOptions_Open_%s", input_method_id.c_str()); | 242 "InputMethodOptions_Open_%s", input_method_id.c_str()); |
| 243 content::RecordComputedAction(action); | 243 content::RecordComputedAction(action); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace options2 | 246 } // namespace options2 |
| 247 } // namespace chromeos | 247 } // namespace chromeos |
| OLD | NEW |