| 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/candidate_window_controller_impl.
h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window_controller_impl.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ime/infolist_window.h" | 10 #include "ash/ime/infolist_window.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } else { | 145 } else { |
| 146 infolist_window_ = new ash::ime::InfolistWindow( | 146 infolist_window_ = new ash::ime::InfolistWindow( |
| 147 candidate_window_view_, infolist_entries); | 147 candidate_window_view_, infolist_entries); |
| 148 infolist_window_->InitWidget(); | 148 infolist_window_->InitWidget(); |
| 149 infolist_window_->GetWidget()->AddObserver(this); | 149 infolist_window_->GetWidget()->AddObserver(this); |
| 150 } | 150 } |
| 151 infolist_window_->ShowWithDelay(); | 151 infolist_window_->ShowWithDelay(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void CandidateWindowControllerImpl::UpdatePreeditText( | 154 void CandidateWindowControllerImpl::UpdatePreeditText( |
| 155 const std::string& utf8_text, unsigned int cursor, bool visible) { | 155 const base::string16& text, unsigned int cursor, bool visible) { |
| 156 // If it's not visible, hide the preedit text and return. | 156 // If it's not visible, hide the preedit text and return. |
| 157 if (!visible || utf8_text.empty()) { | 157 if (!visible || text.empty()) { |
| 158 if (candidate_window_view_) | 158 if (candidate_window_view_) |
| 159 candidate_window_view_->HidePreeditText(); | 159 candidate_window_view_->HidePreeditText(); |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 if (!candidate_window_view_) | 162 if (!candidate_window_view_) |
| 163 InitCandidateWindowView(); | 163 InitCandidateWindowView(); |
| 164 candidate_window_view_->UpdatePreeditText(utf8_text); | 164 candidate_window_view_->UpdatePreeditText(text); |
| 165 candidate_window_view_->ShowPreeditText(); | 165 candidate_window_view_->ShowPreeditText(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void CandidateWindowControllerImpl::OnCandidateCommitted(int index) { | 168 void CandidateWindowControllerImpl::OnCandidateCommitted(int index) { |
| 169 FOR_EACH_OBSERVER(CandidateWindowController::Observer, observers_, | 169 FOR_EACH_OBSERVER(CandidateWindowController::Observer, observers_, |
| 170 CandidateClicked(index)); | 170 CandidateClicked(index)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void CandidateWindowControllerImpl::OnWidgetClosing(views::Widget* widget) { | 173 void CandidateWindowControllerImpl::OnWidgetClosing(views::Widget* widget) { |
| 174 if (infolist_window_ && widget == infolist_window_->GetWidget()) { | 174 if (infolist_window_ && widget == infolist_window_->GetWidget()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 189 observers_.AddObserver(observer); | 189 observers_.AddObserver(observer); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void CandidateWindowControllerImpl::RemoveObserver( | 192 void CandidateWindowControllerImpl::RemoveObserver( |
| 193 CandidateWindowController::Observer* observer) { | 193 CandidateWindowController::Observer* observer) { |
| 194 observers_.RemoveObserver(observer); | 194 observers_.RemoveObserver(observer); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace input_method | 197 } // namespace input_method |
| 198 } // namespace chromeos | 198 } // namespace chromeos |
| OLD | NEW |