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/chromeos/input_method/input_method_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
6 | 6 |
7 #include <algorithm> // std::find | 7 #include <algorithm> // std::find |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 const std::vector<std::string>& | 140 const std::vector<std::string>& |
141 InputMethodManagerImpl::GetActiveInputMethodIds() const { | 141 InputMethodManagerImpl::GetActiveInputMethodIds() const { |
142 return active_input_method_ids_; | 142 return active_input_method_ids_; |
143 } | 143 } |
144 | 144 |
145 size_t InputMethodManagerImpl::GetNumActiveInputMethods() const { | 145 size_t InputMethodManagerImpl::GetNumActiveInputMethods() const { |
146 return active_input_method_ids_.size(); | 146 return active_input_method_ids_.size(); |
147 } | 147 } |
148 | 148 |
| 149 const InputMethodDescriptor* InputMethodManagerImpl::GetInputMethodFromId( |
| 150 const std::string& input_method_id) const { |
| 151 const InputMethodDescriptor* ime = util_.GetInputMethodDescriptorFromId( |
| 152 input_method_id); |
| 153 if (!ime) { |
| 154 std::map<std::string, InputMethodDescriptor>::const_iterator ix = |
| 155 extra_input_methods_.find(input_method_id); |
| 156 if (ix != extra_input_methods_.end()) |
| 157 ime = &ix->second; |
| 158 } |
| 159 return ime; |
| 160 } |
| 161 |
149 void InputMethodManagerImpl::EnableLayouts(const std::string& language_code, | 162 void InputMethodManagerImpl::EnableLayouts(const std::string& language_code, |
150 const std::string& initial_layout) { | 163 const std::string& initial_layout) { |
151 if (state_ == STATE_TERMINATING) | 164 if (state_ == STATE_TERMINATING) |
152 return; | 165 return; |
153 | 166 |
154 std::vector<std::string> candidates; | 167 std::vector<std::string> candidates; |
155 // Add input methods associated with the language. | 168 // Add input methods associated with the language. |
156 util_.GetInputMethodIdsFromLanguageCode(language_code, | 169 util_.GetInputMethodIdsFromLanguageCode(language_code, |
157 kKeyboardLayoutsOnly, | 170 kKeyboardLayoutsOnly, |
158 &candidates); | 171 &candidates); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 if (candidate_window_controller_.get()) | 828 if (candidate_window_controller_.get()) |
816 return; | 829 return; |
817 | 830 |
818 candidate_window_controller_.reset( | 831 candidate_window_controller_.reset( |
819 CandidateWindowController::CreateCandidateWindowController()); | 832 CandidateWindowController::CreateCandidateWindowController()); |
820 candidate_window_controller_->AddObserver(this); | 833 candidate_window_controller_->AddObserver(this); |
821 } | 834 } |
822 | 835 |
823 } // namespace input_method | 836 } // namespace input_method |
824 } // namespace chromeos | 837 } // namespace chromeos |
OLD | NEW |