Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc

Issue 309623005: Remove the flag g_use_wrapped_extension_keyboard_layouts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chromeos/login/network_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace { 46 namespace {
47 47
48 const char kJsScreenPath[] = "login.NetworkScreen"; 48 const char kJsScreenPath[] = "login.NetworkScreen";
49 49
50 // JS API callbacks names. 50 // JS API callbacks names.
51 const char kJsApiNetworkOnExit[] = "networkOnExit"; 51 const char kJsApiNetworkOnExit[] = "networkOnExit";
52 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged"; 52 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged";
53 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged"; 53 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged";
54 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged"; 54 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged";
55 55
56 const char kUSLayout[] = "xkb:us::eng";
57
58 const int kDerelectDetectionTimeoutSeconds = 8 * 60 * 60; // 8 hours. 56 const int kDerelectDetectionTimeoutSeconds = 8 * 60 * 60; // 8 hours.
59 const int kDerelectIdleTimeoutSeconds = 5 * 60; // 5 minutes. 57 const int kDerelectIdleTimeoutSeconds = 5 * 60; // 5 minutes.
60 const int kOobeTimerUpdateIntervalSeconds = 5 * 60; // 5 minutes. 58 const int kOobeTimerUpdateIntervalSeconds = 5 * 60; // 5 minutes.
61 59
62 // Returns true if element was inserted. 60 // Returns true if element was inserted.
63 bool InsertString(const std::string& str, std::set<std::string>& to) { 61 bool InsertString(const std::string& str, std::set<std::string>& to) {
64 const std::pair<std::set<std::string>::iterator, bool> result = 62 const std::pair<std::set<std::string>::iterator, bool> result =
65 to.insert(str); 63 to.insert(str);
66 return result.second; 64 return result.second;
67 } 65 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return time_on_oobe_ >= derelict_detection_timeout_; 441 return time_on_oobe_ >= derelict_detection_timeout_;
444 } 442 }
445 443
446 base::ListValue* NetworkScreenHandler::GetLanguageList() { 444 base::ListValue* NetworkScreenHandler::GetLanguageList() {
447 const std::string app_locale = g_browser_process->GetApplicationLocale(); 445 const std::string app_locale = g_browser_process->GetApplicationLocale();
448 input_method::InputMethodManager* manager = 446 input_method::InputMethodManager* manager =
449 input_method::InputMethodManager::Get(); 447 input_method::InputMethodManager::Get();
450 ComponentExtensionIMEManager* comp_manager = 448 ComponentExtensionIMEManager* comp_manager =
451 manager->GetComponentExtensionIMEManager(); 449 manager->GetComponentExtensionIMEManager();
452 input_method::InputMethodDescriptors descriptors; 450 input_method::InputMethodDescriptors descriptors;
453 if (extension_ime_util::UseWrappedExtensionKeyboardLayouts()) { 451 if (comp_manager->IsInitialized())
454 if (comp_manager->IsInitialized()) 452 descriptors = comp_manager->GetXkbIMEAsInputMethodDescriptor();
455 descriptors = comp_manager->GetXkbIMEAsInputMethodDescriptor();
456 } else {
457 descriptors = *(manager->GetSupportedInputMethods());
458 }
459 base::ListValue* languages_list = 453 base::ListValue* languages_list =
460 options::CrosLanguageOptionsHandler::GetUILanguageList(descriptors); 454 options::CrosLanguageOptionsHandler::GetUILanguageList(descriptors);
461 for (size_t i = 0; i < languages_list->GetSize(); ++i) { 455 for (size_t i = 0; i < languages_list->GetSize(); ++i) {
462 base::DictionaryValue* language_info = NULL; 456 base::DictionaryValue* language_info = NULL;
463 if (!languages_list->GetDictionary(i, &language_info)) 457 if (!languages_list->GetDictionary(i, &language_info))
464 NOTREACHED(); 458 NOTREACHED();
465 459
466 std::string value; 460 std::string value;
467 language_info->GetString("code", &value); 461 language_info->GetString("code", &value);
468 std::string display_name; 462 std::string display_name;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // Buttons are recreated, updated "Continue" button state. 525 // Buttons are recreated, updated "Continue" button state.
532 EnableContinue(is_continue_enabled_); 526 EnableContinue(is_continue_enabled_);
533 } 527 }
534 528
535 // static 529 // static
536 base::ListValue* NetworkScreenHandler::GetInputMethods() { 530 base::ListValue* NetworkScreenHandler::GetInputMethods() {
537 base::ListValue* input_methods_list = new base::ListValue; 531 base::ListValue* input_methods_list = new base::ListValue;
538 input_method::InputMethodManager* manager = 532 input_method::InputMethodManager* manager =
539 input_method::InputMethodManager::Get(); 533 input_method::InputMethodManager::Get();
540 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 534 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
541 if (extension_ime_util::UseWrappedExtensionKeyboardLayouts()) { 535 ComponentExtensionIMEManager* comp_manager =
542 ComponentExtensionIMEManager* comp_manager = 536 manager->GetComponentExtensionIMEManager();
543 manager->GetComponentExtensionIMEManager(); 537 if (!comp_manager->IsInitialized()) {
544 if (!comp_manager->IsInitialized()) { 538 input_method::InputMethodDescriptor fallback =
545 input_method::InputMethodDescriptor fallback = 539 util->GetFallbackInputMethodDescriptor();
546 util->GetFallbackInputMethodDescriptor(); 540 input_methods_list->Append(
547 input_methods_list->Append( 541 CreateInputMethodsEntry(fallback, fallback.id()));
548 CreateInputMethodsEntry(fallback, fallback.id())); 542 return input_methods_list;
549 return input_methods_list;
550 }
551 } 543 }
552 544
553 const std::vector<std::string>& hardware_login_input_methods = 545 const std::vector<std::string>& hardware_login_input_methods =
554 util->GetHardwareLoginInputMethodIds(); 546 util->GetHardwareLoginInputMethodIds();
555 manager->EnableLoginLayouts(g_browser_process->GetApplicationLocale(), 547 manager->EnableLoginLayouts(g_browser_process->GetApplicationLocale(),
556 hardware_login_input_methods); 548 hardware_login_input_methods);
557 549
558 scoped_ptr<input_method::InputMethodDescriptors> input_methods( 550 scoped_ptr<input_method::InputMethodDescriptors> input_methods(
559 manager->GetActiveInputMethods()); 551 manager->GetActiveInputMethods());
560 const std::string& current_input_method_id = 552 const std::string& current_input_method_id =
(...skipping 22 matching lines...) Expand all
583 if (!InsertString(ime_id, input_methods_added)) 575 if (!InsertString(ime_id, input_methods_added))
584 continue; 576 continue;
585 if (!optgroup_added) { 577 if (!optgroup_added) {
586 optgroup_added = true; 578 optgroup_added = true;
587 AddOptgroupOtherLayouts(input_methods_list); 579 AddOptgroupOtherLayouts(input_methods_list);
588 } 580 }
589 input_methods_list->Append( 581 input_methods_list->Append(
590 CreateInputMethodsEntry((*input_methods)[i], current_input_method_id)); 582 CreateInputMethodsEntry((*input_methods)[i], current_input_method_id));
591 } 583 }
592 // "xkb:us::eng" should always be in the list of available layouts. 584 // "xkb:us::eng" should always be in the list of available layouts.
593 const std::string& us_keyboard_id = 585 const std::string us_keyboard_id =
594 extension_ime_util::GetInputMethodIDByKeyboardLayout(kUSLayout); 586 util->GetFallbackInputMethodDescriptor().id();
595 if (input_methods_added.find(us_keyboard_id) == input_methods_added.end()) { 587 if (input_methods_added.find(us_keyboard_id) == input_methods_added.end()) {
596 const input_method::InputMethodDescriptor* us_eng_descriptor = 588 const input_method::InputMethodDescriptor* us_eng_descriptor =
597 util->GetInputMethodDescriptorFromId(us_keyboard_id); 589 util->GetInputMethodDescriptorFromId(us_keyboard_id);
598 DCHECK(us_eng_descriptor != NULL); 590 DCHECK(us_eng_descriptor != NULL);
599 if (!optgroup_added) { 591 if (!optgroup_added) {
600 optgroup_added = true; 592 optgroup_added = true;
601 AddOptgroupOtherLayouts(input_methods_list); 593 AddOptgroupOtherLayouts(input_methods_list);
602 } 594 }
603 input_methods_list->Append( 595 input_methods_list->Append(
604 CreateInputMethodsEntry(*us_eng_descriptor, current_input_method_id)); 596 CreateInputMethodsEntry(*us_eng_descriptor, current_input_method_id));
(...skipping 23 matching lines...) Expand all
628 timezone_option->SetString("value", timezone_id); 620 timezone_option->SetString("value", timezone_id);
629 timezone_option->SetString("title", timezone_name); 621 timezone_option->SetString("title", timezone_name);
630 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); 622 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id);
631 timezone_list->Append(timezone_option.release()); 623 timezone_list->Append(timezone_option.release());
632 } 624 }
633 625
634 return timezone_list.release(); 626 return timezone_list.release();
635 } 627 }
636 628
637 } // namespace chromeos 629 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oobe_localization_browsertest.cc ('k') | chromeos/ime/extension_ime_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698