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

Side by Side Diff: ui/base/ime/input_method_base.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, review Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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/base/ime/input_method_base.h"
6
7 #include "base/logging.h"
8 #include "ui/base/ime/text_input_client.h"
9 #include "ui/base/ime/input_method_delegate.h"
10
11 namespace ui {
12
13 InputMethodBase::InputMethodBase()
14 : delegate_(NULL),
15 text_input_client_(NULL) {
16 }
17
18 InputMethodBase::~InputMethodBase() {
19 }
20
21 void InputMethodBase::set_delegate(
22 internal::InputMethodDelegate* delegate) {
23 DCHECK(delegate);
24 delegate_ = delegate;
25 }
26
27 void InputMethodBase::set_text_input_client(TextInputClient* client) {
28 text_input_client_ = client; // NULL allowed.
29 }
30
31 TextInputClient* InputMethodBase::text_input_client() const {
32 return text_input_client_;
33 }
34
35 void InputMethodBase::OnTextInputTypeChanged(gfx::NativeWindow window) {
36 if (IsWindowFocused(window)) {
37 // TODO(yusukes): Support TextInputTypeTracker for TOUCH_UI.
38 }
39 }
40
41 TextInputType InputMethodBase::GetTextInputType() const {
42 return text_input_client_ ?
43 text_input_client_->GetTextInputType() : TEXT_INPUT_TYPE_NONE;
44 }
45
46 bool InputMethodBase::IsTextInputTypeNone() const {
47 return GetTextInputType() == TEXT_INPUT_TYPE_NONE;
48 }
49
50 void InputMethodBase::OnInputMethodChanged() const {
51 if (text_input_client_ &&
52 text_input_client_->GetTextInputType() != TEXT_INPUT_TYPE_NONE)
53 text_input_client_->OnInputMethodChanged();
54 }
55
56 void InputMethodBase::DispatchKeyEventPostIME(
57 gfx::NativeEvent native_key_event) const {
58 if (delegate_)
59 delegate_->DispatchKeyEventPostIME(native_key_event);
60 }
61
62 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698