| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/ime/remote_input_method_win.h" | 5 #include "ui/base/ime/remote_input_method_win.h" |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/win/metro.h" | 9 #include "base/win/metro.h" |
| 10 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 336 } |
| 337 | 337 |
| 338 virtual void OnInputSourceChanged(LANGID langid, bool /*is_ime*/) OVERRIDE { | 338 virtual void OnInputSourceChanged(LANGID langid, bool /*is_ime*/) OVERRIDE { |
| 339 // Note: Currently |is_ime| is not utilized yet. | 339 // Note: Currently |is_ime| is not utilized yet. |
| 340 const bool changed = (langid_ != langid); | 340 const bool changed = (langid_ != langid); |
| 341 langid_ = langid; | 341 langid_ = langid; |
| 342 if (changed && GetTextInputClient()) | 342 if (changed && GetTextInputClient()) |
| 343 GetTextInputClient()->OnInputMethodChanged(); | 343 GetTextInputClient()->OnInputMethodChanged(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 virtual void OnCompositionChanged( |
| 347 const CompositionText& composition_text) OVERRIDE { |
| 348 if (!text_input_client_) |
| 349 return; |
| 350 text_input_client_->SetCompositionText(composition_text); |
| 351 } |
| 352 |
| 353 virtual void OnTextCommitted(const base::string16& text) OVERRIDE { |
| 354 if (!text_input_client_) |
| 355 return; |
| 356 if (text_input_client_->GetTextInputType() == TEXT_INPUT_TYPE_NONE) { |
| 357 // According to the comment in text_input_client.h, |
| 358 // TextInputClient::InsertText should never be called when the |
| 359 // text input type is TEXT_INPUT_TYPE_NONE. |
| 360 for (size_t i = 0; i < text.size(); ++i) |
| 361 text_input_client_->InsertChar(text[i], 0); |
| 362 return; |
| 363 } |
| 364 text_input_client_->InsertText(text); |
| 365 } |
| 366 |
| 346 bool CanSendRemoteNotification( | 367 bool CanSendRemoteNotification( |
| 347 const TextInputClient* text_input_client) const { | 368 const TextInputClient* text_input_client) const { |
| 348 return text_input_client_ && | 369 return text_input_client_ && |
| 349 text_input_client_ == text_input_client && | 370 text_input_client_ == text_input_client && |
| 350 remote_delegate_; | 371 remote_delegate_; |
| 351 } | 372 } |
| 352 | 373 |
| 353 ObserverList<InputMethodObserver> observer_list_; | 374 ObserverList<InputMethodObserver> observer_list_; |
| 354 | 375 |
| 355 internal::InputMethodDelegate* delegate_; | 376 internal::InputMethodDelegate* delegate_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); | 408 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); |
| 388 } | 409 } |
| 389 | 410 |
| 390 // static | 411 // static |
| 391 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( | 412 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( |
| 392 InputMethod* input_method) { | 413 InputMethod* input_method) { |
| 393 return GetPrivate(input_method); | 414 return GetPrivate(input_method); |
| 394 } | 415 } |
| 395 | 416 |
| 396 } // namespace ui | 417 } // namespace ui |
| OLD | NEW |