| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/views/mus/text_input_client_impl.h" | 5 #include "ui/views/mus/text_input_client_impl.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/text_input_client.h" | 7 #include "ui/base/ime/text_input_client.h" |
| 8 #include "ui/views/mus/input_method_mus.h" | 8 #include "ui/views/mus/input_method_mus.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client, | 12 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client) |
| 13 InputMethodMus* input_method) | 13 : text_input_client_(text_input_client), binding_(this) {} |
| 14 : text_input_client_(text_input_client), | |
| 15 input_method_(input_method), | |
| 16 binding_(this) {} | |
| 17 | 14 |
| 18 TextInputClientImpl::~TextInputClientImpl() {} | 15 TextInputClientImpl::~TextInputClientImpl() {} |
| 19 | 16 |
| 20 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() { | 17 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() { |
| 21 return binding_.CreateInterfacePtrAndBind(); | 18 return binding_.CreateInterfacePtrAndBind(); |
| 22 } | 19 } |
| 23 | 20 |
| 24 void TextInputClientImpl::OnCompositionEvent( | 21 void TextInputClientImpl::OnCompositionEvent( |
| 25 ui::mojom::CompositionEventPtr event) { | 22 ui::mojom::CompositionEventPtr event) { |
| 26 switch (event->type) { | 23 switch (event->type) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 break; | 36 break; |
| 40 case ui::mojom::CompositionEventType::UPDATE: | 37 case ui::mojom::CompositionEventType::UPDATE: |
| 41 case ui::mojom::CompositionEventType::INSERT_TEXT: | 38 case ui::mojom::CompositionEventType::INSERT_TEXT: |
| 42 // TODO(moshayedi): crbug.com/631524. Implement these types of composition | 39 // TODO(moshayedi): crbug.com/631524. Implement these types of composition |
| 43 // events once we have the necessary fields in ui.mojom.CompositionEvent. | 40 // events once we have the necessary fields in ui.mojom.CompositionEvent. |
| 44 NOTIMPLEMENTED(); | 41 NOTIMPLEMENTED(); |
| 45 break; | 42 break; |
| 46 } | 43 } |
| 47 } | 44 } |
| 48 | 45 |
| 49 void TextInputClientImpl::OnUnhandledEvent( | |
| 50 std::unique_ptr<ui::Event> key_event) { | |
| 51 DCHECK(key_event && key_event->IsKeyEvent()); | |
| 52 input_method_->DispatchKeyEventPostIME(key_event->AsKeyEvent()); | |
| 53 } | |
| 54 | |
| 55 } // namespace views | 46 } // namespace views |
| OLD | NEW |