Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: ui/views/mus/text_input_client_impl.cc

Issue 2230393002: IME for Mus: Make InputMethodMus use the IME Mojo API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "ui/views/mus/input_method_mus.h"
9
10 namespace views {
11
12 TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client,
13 InputMethodMus* input_method)
14 : text_input_client_(text_input_client),
15 input_method_(input_method),
16 binding_(this) {}
17
18 TextInputClientImpl::~TextInputClientImpl() {}
19
20 ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() {
21 return binding_.CreateInterfacePtrAndBind();
22 }
23
24 void TextInputClientImpl::OnCompositionEvent(
25 ui::mojom::CompositionEventPtr event) {
26 switch (event->type) {
27 case ui::mojom::CompositionEventType::INSERT_CHAR: {
28 ui::KeyEvent* key_event = (*event->key_event)->AsKeyEvent();
sky 2016/08/18 23:43:07 DCHECK event is a KeyEvent?
Hadi 2016/08/25 18:06:06 Done.
29 DCHECK(key_event->is_char());
30 text_input_client_->InsertChar(*key_event);
31 break;
32 }
33 case ui::mojom::CompositionEventType::CONFIRM:
34 text_input_client_->ConfirmCompositionText();
35 break;
36 case ui::mojom::CompositionEventType::CLEAR:
37 text_input_client_->ClearCompositionText();
38 break;
39 case ui::mojom::CompositionEventType::UPDATE:
40 case ui::mojom::CompositionEventType::INSERT_TEXT:
41 // TODO(moshayedi): crbug.com/631524. Implement these types of composition
42 // events once we have the necessary fields in ui.mojom.CompositionEvent.
43 NOTIMPLEMENTED();
44 break;
45 }
46 }
47
48 void TextInputClientImpl::OnUnhandledEvent(
49 std::unique_ptr<ui::Event> key_event) {
50 DCHECK(key_event && key_event->IsKeyEvent());
51 input_method_->DispatchKeyEventPostIME(key_event->AsKeyEvent());
52 }
53
54 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698