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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 13954012: Move GetFallbackInputMethodDescriptor function to InputMethodUtil. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 594 }
595 } 595 }
596 596
597 std::string InputMethodUtil::GetHardwareInputMethodId() const { 597 std::string InputMethodUtil::GetHardwareInputMethodId() const {
598 const std::string input_method_id = delegate_->GetHardwareKeyboardLayout(); 598 const std::string input_method_id = delegate_->GetHardwareKeyboardLayout();
599 599
600 if (input_method_id.empty()) { 600 if (input_method_id.empty()) {
601 // This is totally fine if it's empty. The hardware keyboard layout is 601 // This is totally fine if it's empty. The hardware keyboard layout is
602 // not stored if startup_manifest.json (OEM customization data) is not 602 // not stored if startup_manifest.json (OEM customization data) is not
603 // present (ex. Cr48 doen't have that file). 603 // present (ex. Cr48 doen't have that file).
604 return InputMethodDescriptor::GetFallbackInputMethodDescriptor().id(); 604 return GetFallbackInputMethodDescriptor().id();
605 } 605 }
606 return input_method_id; 606 return input_method_id;
607 } 607 }
608 608
609 void InputMethodUtil::SetComponentExtensions( 609 void InputMethodUtil::SetComponentExtensions(
610 const InputMethodDescriptors& imes) { 610 const InputMethodDescriptors& imes) {
611 component_extension_ime_id_to_descriptor_.clear(); 611 component_extension_ime_id_to_descriptor_.clear();
612 for (size_t i = 0; i < imes.size(); ++i) { 612 for (size_t i = 0; i < imes.size(); ++i) {
613 const InputMethodDescriptor& input_method = imes.at(i); 613 const InputMethodDescriptor& input_method = imes.at(i);
614 const std::string language_code = input_method.language_code(); 614 const std::string language_code = input_method.language_code();
615 id_to_language_code_.insert( 615 id_to_language_code_.insert(
616 std::make_pair(input_method.id(), language_code)); 616 std::make_pair(input_method.id(), language_code));
617 id_to_descriptor_.insert( 617 id_to_descriptor_.insert(
618 std::make_pair(input_method.id(), input_method)); 618 std::make_pair(input_method.id(), input_method));
619 } 619 }
620 } 620 }
621 621
622 InputMethodDescriptor InputMethodUtil::GetFallbackInputMethodDescriptor() {
623 return InputMethodDescriptor("xkb:us::eng",
624 "",
625 "us",
626 "en-US",
627 "", // options page, not available.
628 false);
629 }
630
622 void InputMethodUtil::ReloadInternalMaps() { 631 void InputMethodUtil::ReloadInternalMaps() {
623 if (supported_input_methods_->size() <= 1) { 632 if (supported_input_methods_->size() <= 1) {
624 DVLOG(1) << "GetSupportedInputMethods returned a fallback ID"; 633 DVLOG(1) << "GetSupportedInputMethods returned a fallback ID";
625 // TODO(yusukes): Handle this error in nicer way. 634 // TODO(yusukes): Handle this error in nicer way.
626 } 635 }
627 636
628 // Clear the existing maps. 637 // Clear the existing maps.
629 language_code_to_ids_.clear(); 638 language_code_to_ids_.clear();
630 id_to_language_code_.clear(); 639 id_to_language_code_.clear();
631 id_to_descriptor_.clear(); 640 id_to_descriptor_.clear();
(...skipping 27 matching lines...) Expand all
659 if (iter != id_to_descriptor_.end()) { 668 if (iter != id_to_descriptor_.end()) {
660 const InputMethodDescriptor& input_method = iter->second; 669 const InputMethodDescriptor& input_method = iter->second;
661 language_code_to_ids_.insert( 670 language_code_to_ids_.insert(
662 std::make_pair(language_code, input_method.id())); 671 std::make_pair(language_code, input_method.id()));
663 } 672 }
664 } 673 }
665 } 674 }
666 675
667 } // namespace input_method 676 } // namespace input_method
668 } // namespace chromeos 677 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698