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 "base/strings/utf_string_conversions.h" | |
8 #include "ui/base/ime/text_input_client.h" | |
9 #include "ui/views/mus/input_method_mus.h" | |
10 | |
11 namespace views { | |
12 | |
13 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client) | |
14 : text_input_client_(text_input_client), binding_(this) {} | |
15 | |
16 TextInputClientImpl::~TextInputClientImpl() {} | |
17 | |
18 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() { | |
19 return binding_.CreateInterfacePtrAndBind(); | |
20 } | |
21 | |
22 void TextInputClientImpl::SetCompositionText( | |
23 const ui::CompositionText& composition) { | |
24 text_input_client_->SetCompositionText(composition); | |
25 } | |
26 | |
27 void TextInputClientImpl::ConfirmCompositionText() { | |
28 text_input_client_->ConfirmCompositionText(); | |
29 } | |
30 | |
31 void TextInputClientImpl::ClearCompositionText() { | |
32 text_input_client_->ClearCompositionText(); | |
33 } | |
34 | |
35 void TextInputClientImpl::InsertText(const std::string& text) { | |
36 text_input_client_->InsertText(base::UTF8ToUTF16(text)); | |
37 } | |
38 | |
39 void TextInputClientImpl::InsertChar(std::unique_ptr<ui::Event> event) { | |
40 DCHECK(event->IsKeyEvent()); | |
41 text_input_client_->InsertChar(*event->AsKeyEvent()); | |
42 } | |
43 | |
44 } // namespace views | |
OLD | NEW |