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/lifetime/application_lifetime.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
24 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
28 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
30 | 31 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 208 } |
208 | 209 |
209 void CrosLanguageOptionsHandler::SetApplicationLocale( | 210 void CrosLanguageOptionsHandler::SetApplicationLocale( |
210 const std::string& language_code) { | 211 const std::string& language_code) { |
211 Profile::FromWebUI(web_ui())->ChangeAppLocale( | 212 Profile::FromWebUI(web_ui())->ChangeAppLocale( |
212 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 213 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
213 } | 214 } |
214 | 215 |
215 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { | 216 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { |
216 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 217 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
217 | 218 browser::AttemptUserExit(); |
218 Browser* browser = browser::FindBrowserWithWebContents( | |
219 web_ui()->GetWebContents()); | |
220 if (browser) | |
221 browser->ExecuteCommand(IDC_EXIT); | |
222 } | 219 } |
223 | 220 |
224 void CrosLanguageOptionsHandler::InputMethodDisableCallback( | 221 void CrosLanguageOptionsHandler::InputMethodDisableCallback( |
225 const ListValue* args) { | 222 const ListValue* args) { |
226 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 223 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
227 const std::string action = base::StringPrintf( | 224 const std::string action = base::StringPrintf( |
228 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); | 225 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); |
229 content::RecordComputedAction(action); | 226 content::RecordComputedAction(action); |
230 } | 227 } |
231 | 228 |
232 void CrosLanguageOptionsHandler::InputMethodEnableCallback( | 229 void CrosLanguageOptionsHandler::InputMethodEnableCallback( |
233 const ListValue* args) { | 230 const ListValue* args) { |
234 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 231 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
235 const std::string action = base::StringPrintf( | 232 const std::string action = base::StringPrintf( |
236 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); | 233 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); |
237 content::RecordComputedAction(action); | 234 content::RecordComputedAction(action); |
238 } | 235 } |
239 | 236 |
240 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 237 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
241 const ListValue* args) { | 238 const ListValue* args) { |
242 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 239 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
243 const std::string action = base::StringPrintf( | 240 const std::string action = base::StringPrintf( |
244 "InputMethodOptions_Open_%s", input_method_id.c_str()); | 241 "InputMethodOptions_Open_%s", input_method_id.c_str()); |
245 content::RecordComputedAction(action); | 242 content::RecordComputedAction(action); |
246 } | 243 } |
247 | 244 |
248 } // namespace options2 | 245 } // namespace options2 |
249 } // namespace chromeos | 246 } // namespace chromeos |
OLD | NEW |