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 <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 734 |
735 // Initialize candidate window controller and widgets such as | 735 // Initialize candidate window controller and widgets such as |
736 // candidate window, infolist and mode indicator. Note, mode | 736 // candidate window, infolist and mode indicator. Note, mode |
737 // indicator is used by only keyboard layout input methods. | 737 // indicator is used by only keyboard layout input methods. |
738 if (state_.get() == state) | 738 if (state_.get() == state) |
739 MaybeInitializeCandidateWindowController(); | 739 MaybeInitializeCandidateWindowController(); |
740 } | 740 } |
741 | 741 |
742 void InputMethodManagerImpl::SetState( | 742 void InputMethodManagerImpl::SetState( |
743 scoped_refptr<InputMethodManager::State> state) { | 743 scoped_refptr<InputMethodManager::State> state) { |
744 DCHECK(state); | 744 DCHECK(state.get()); |
745 InputMethodManagerImpl::StateImpl* new_impl_state = | 745 InputMethodManagerImpl::StateImpl* new_impl_state = |
746 static_cast<InputMethodManagerImpl::StateImpl*>(state.get()); | 746 static_cast<InputMethodManagerImpl::StateImpl*>(state.get()); |
747 const bool need_update_current_input_method = | 747 const bool need_update_current_input_method = |
748 (state_ ? state_->current_input_method.id() != | 748 (state_.get() |
749 new_impl_state->current_input_method.id() | 749 ? state_->current_input_method.id() != |
750 : true); | 750 new_impl_state->current_input_method.id() |
| 751 : true); |
751 state_ = new_impl_state; | 752 state_ = new_impl_state; |
752 | 753 |
753 if (state_ && state_->active_input_method_ids.size()) { | 754 if (state_.get() && state_->active_input_method_ids.size()) { |
754 // Initialize candidate window controller and widgets such as | 755 // Initialize candidate window controller and widgets such as |
755 // candidate window, infolist and mode indicator. Note, mode | 756 // candidate window, infolist and mode indicator. Note, mode |
756 // indicator is used by only keyboard layout input methods. | 757 // indicator is used by only keyboard layout input methods. |
757 MaybeInitializeCandidateWindowController(); | 758 MaybeInitializeCandidateWindowController(); |
758 | 759 |
759 if (need_update_current_input_method) { | 760 if (need_update_current_input_method) { |
760 ChangeInputMethodInternal(state_->current_input_method, | 761 ChangeInputMethodInternal(state_->current_input_method, |
761 false /* show_message */, | 762 false /* show_message */, |
762 true /* notify_menu */); | 763 true /* notify_menu */); |
763 } else { | 764 } else { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 if (candidate_window_controller_.get()) | 1056 if (candidate_window_controller_.get()) |
1056 return; | 1057 return; |
1057 | 1058 |
1058 candidate_window_controller_.reset( | 1059 candidate_window_controller_.reset( |
1059 CandidateWindowController::CreateCandidateWindowController()); | 1060 CandidateWindowController::CreateCandidateWindowController()); |
1060 candidate_window_controller_->AddObserver(this); | 1061 candidate_window_controller_->AddObserver(this); |
1061 } | 1062 } |
1062 | 1063 |
1063 } // namespace input_method | 1064 } // namespace input_method |
1064 } // namespace chromeos | 1065 } // namespace chromeos |
OLD | NEW |