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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 descriptor = &(i->second); | 311 descriptor = &(i->second); |
312 } | 312 } |
313 DCHECK(descriptor); | 313 DCHECK(descriptor); |
314 | 314 |
315 previous_input_method_ = current_input_method_; | 315 previous_input_method_ = current_input_method_; |
316 current_input_method_ = *descriptor; | 316 current_input_method_ = *descriptor; |
317 } | 317 } |
318 | 318 |
319 // Change the keyboard layout to a preferred layout for the input method. | 319 // Change the keyboard layout to a preferred layout for the input method. |
320 if (!xkeyboard_->SetCurrentKeyboardLayoutByName( | 320 if (!xkeyboard_->SetCurrentKeyboardLayoutByName( |
321 current_input_method_.keyboard_layout())) { | 321 current_input_method_.GetPreferredKeyboardLayout())) { |
322 LOG(ERROR) << "Failed to change keyboard layout to " | 322 LOG(ERROR) << "Failed to change keyboard layout to " |
323 << current_input_method_.keyboard_layout(); | 323 << current_input_method_.GetPreferredKeyboardLayout(); |
324 } | 324 } |
325 | 325 |
326 // Update input method indicators (e.g. "US", "DV") in Chrome windows. | 326 // Update input method indicators (e.g. "US", "DV") in Chrome windows. |
327 FOR_EACH_OBSERVER(InputMethodManager::Observer, | 327 FOR_EACH_OBSERVER(InputMethodManager::Observer, |
328 observers_, | 328 observers_, |
329 InputMethodChanged(this, show_message)); | 329 InputMethodChanged(this, show_message)); |
330 } | 330 } |
331 | 331 |
332 void InputMethodManagerImpl::OnComponentExtensionInitialized( | 332 void InputMethodManagerImpl::OnComponentExtensionInitialized( |
333 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate) { | 333 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 InputMethodEngine* engine) { | 383 InputMethodEngine* engine) { |
384 if (state_ == STATE_TERMINATING) | 384 if (state_ == STATE_TERMINATING) |
385 return; | 385 return; |
386 | 386 |
387 if (!extension_ime_util::IsExtensionIME(id) && | 387 if (!extension_ime_util::IsExtensionIME(id) && |
388 !ComponentExtensionIMEManager::IsComponentExtensionIMEId(id)) { | 388 !ComponentExtensionIMEManager::IsComponentExtensionIMEId(id)) { |
389 DVLOG(1) << id << " is not a valid extension input method ID."; | 389 DVLOG(1) << id << " is not a valid extension input method ID."; |
390 return; | 390 return; |
391 } | 391 } |
392 | 392 |
393 const std::string layout = layouts.empty() ? "" : layouts[0]; | |
394 // TODO(nona): Support options page for normal extension ime. | 393 // TODO(nona): Support options page for normal extension ime. |
395 // crbug.com/156283. | 394 // crbug.com/156283. |
396 extra_input_methods_[id] = | 395 extra_input_methods_[id] = |
397 InputMethodDescriptor(id, name, layout, language, ""); | 396 InputMethodDescriptor(id, name, layouts, language, ""); |
398 if (!Contains(filtered_extension_imes_, id) && | 397 if (!Contains(filtered_extension_imes_, id) && |
399 !ComponentExtensionIMEManager::IsComponentExtensionIMEId(id)) { | 398 !ComponentExtensionIMEManager::IsComponentExtensionIMEId(id)) { |
400 if (!Contains(active_input_method_ids_, id)) { | 399 if (!Contains(active_input_method_ids_, id)) { |
401 active_input_method_ids_.push_back(id); | 400 active_input_method_ids_.push_back(id); |
402 } else { | 401 } else { |
403 DVLOG(1) << "AddInputMethodExtension: alread added: " | 402 DVLOG(1) << "AddInputMethodExtension: alread added: " |
404 << id << ", " << name; | 403 << id << ", " << name; |
405 // Call Start() anyway, just in case. | 404 // Call Start() anyway, just in case. |
406 } | 405 } |
407 | 406 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 candidate_window_controller_.reset( | 793 candidate_window_controller_.reset( |
795 CandidateWindowController::CreateCandidateWindowController()); | 794 CandidateWindowController::CreateCandidateWindowController()); |
796 if (candidate_window_controller_->Init(ibus_controller_.get())) | 795 if (candidate_window_controller_->Init(ibus_controller_.get())) |
797 candidate_window_controller_->AddObserver(this); | 796 candidate_window_controller_->AddObserver(this); |
798 else | 797 else |
799 DVLOG(1) << "Failed to initialize the candidate window controller"; | 798 DVLOG(1) << "Failed to initialize the candidate window controller"; |
800 } | 799 } |
801 | 800 |
802 } // namespace input_method | 801 } // namespace input_method |
803 } // namespace chromeos | 802 } // namespace chromeos |
OLD | NEW |