OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/mus/text_input_client_impl.h" |
| 6 |
| 7 #include "ui/base/ime/text_input_client.h" |
| 8 |
| 9 namespace views { |
| 10 |
| 11 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client) |
| 12 : text_input_client_(text_input_client), binding_(this) {} |
| 13 |
| 14 TextInputClientImpl::~TextInputClientImpl() {} |
| 15 |
| 16 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() { |
| 17 return binding_.CreateInterfacePtrAndBind(); |
| 18 } |
| 19 |
| 20 void TextInputClientImpl::OnCompositionEvent( |
| 21 ui::mojom::CompositionEventPtr event) { |
| 22 switch (event->type) { |
| 23 case ui::mojom::CompositionEventType::INSERT_CHAR: |
| 24 text_input_client_->InsertChar(*(*event->key_event)->AsKeyEvent()); |
| 25 break; |
| 26 case ui::mojom::CompositionEventType::CONFIRM: |
| 27 text_input_client_->ConfirmCompositionText(); |
| 28 break; |
| 29 case ui::mojom::CompositionEventType::CLEAR: |
| 30 text_input_client_->ClearCompositionText(); |
| 31 break; |
| 32 case ui::mojom::CompositionEventType::UPDATE: |
| 33 case ui::mojom::CompositionEventType::INSERT_TEXT: |
| 34 // TODO(moshayedi): crbug.com/631524. Implement these types of composition |
| 35 // events once we have the necessary fields in ui.mojom.CompositionEvent. |
| 36 NOTIMPLEMENTED(); |
| 37 break; |
| 38 } |
| 39 } |
| 40 |
| 41 } // namespace views |
OLD | NEW |