| 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/options/chromeos/cros_language_options_handler
.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 | 403 |
| 404 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { | 404 void CrosLanguageOptionsHandler::RestartCallback(const base::ListValue* args) { |
| 405 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); | 405 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); |
| 406 chrome::AttemptUserExit(); | 406 chrome::AttemptUserExit(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void CrosLanguageOptionsHandler::InputMethodDisableCallback( | 409 void CrosLanguageOptionsHandler::InputMethodDisableCallback( |
| 410 const base::ListValue* args) { | 410 const base::ListValue* args) { |
| 411 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 411 const std::string input_method_id = |
| 412 base::UTF16ToASCII(ExtractStringValue(args)); |
| 412 const std::string action = base::StringPrintf( | 413 const std::string action = base::StringPrintf( |
| 413 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); | 414 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); |
| 414 content::RecordComputedAction(action); | 415 content::RecordComputedAction(action); |
| 415 } | 416 } |
| 416 | 417 |
| 417 void CrosLanguageOptionsHandler::InputMethodEnableCallback( | 418 void CrosLanguageOptionsHandler::InputMethodEnableCallback( |
| 418 const base::ListValue* args) { | 419 const base::ListValue* args) { |
| 419 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 420 const std::string input_method_id = |
| 421 base::UTF16ToASCII(ExtractStringValue(args)); |
| 420 const std::string action = base::StringPrintf( | 422 const std::string action = base::StringPrintf( |
| 421 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); | 423 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); |
| 422 content::RecordComputedAction(action); | 424 content::RecordComputedAction(action); |
| 423 } | 425 } |
| 424 | 426 |
| 425 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 427 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
| 426 const base::ListValue* args) { | 428 const base::ListValue* args) { |
| 427 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 429 const std::string input_method_id = |
| 430 base::UTF16ToASCII(ExtractStringValue(args)); |
| 428 const std::string extension_id = | 431 const std::string extension_id = |
| 429 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); | 432 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); |
| 430 if (extension_id.empty()) | 433 if (extension_id.empty()) |
| 431 return; | 434 return; |
| 432 | 435 |
| 433 const input_method::InputMethodDescriptor* ime = | 436 const input_method::InputMethodDescriptor* ime = |
| 434 input_method::InputMethodManager::Get()->GetInputMethodFromId( | 437 input_method::InputMethodManager::Get()->GetInputMethodFromId( |
| 435 input_method_id); | 438 input_method_id); |
| 436 if (!ime) | 439 if (!ime) |
| 437 return; | 440 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 ConvertInputMethodDescriptosToIMEList( | 492 ConvertInputMethodDescriptosToIMEList( |
| 490 component_extension_manager->GetAllIMEAsInputMethodDescriptor())); | 493 component_extension_manager->GetAllIMEAsInputMethodDescriptor())); |
| 491 web_ui()->CallJavascriptFunction( | 494 web_ui()->CallJavascriptFunction( |
| 492 "options.LanguageOptions.onComponentManagerInitialized", | 495 "options.LanguageOptions.onComponentManagerInitialized", |
| 493 *ime_list); | 496 *ime_list); |
| 494 composition_extension_appended_ = true; | 497 composition_extension_appended_ = true; |
| 495 } | 498 } |
| 496 | 499 |
| 497 } // namespace options | 500 } // namespace options |
| 498 } // namespace chromeos | 501 } // namespace chromeos |
| OLD | NEW |