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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/ime/input_method_base.cc
diff --git a/ui/base/ime/input_method_base.cc b/ui/base/ime/input_method_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..768f6c27c82251df75db537cb871b1bf6fb06f39
--- /dev/null
+++ b/ui/base/ime/input_method_base.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/ime/input_method_base.h"
+
+#include "base/logging.h"
+#include "ui/base/ime/text_input_client.h"
+#include "ui/base/ime/input_method_delegate.h"
+
+namespace ui {
+
+InputMethodBase::InputMethodBase()
+ : delegate_(NULL),
+ text_input_client_(NULL) {
+}
+
+InputMethodBase::~InputMethodBase() {
+}
+
+void InputMethodBase::set_delegate(
+ internal::InputMethodDelegate* delegate) {
+ DCHECK(delegate);
+ delegate_ = delegate;
+}
+
+void InputMethodBase::set_text_input_client(TextInputClient* client) {
+ text_input_client_ = client; // NULL allowed.
+}
+
+TextInputClient* InputMethodBase::text_input_client() const {
+ return text_input_client_;
+}
+
+void InputMethodBase::OnTextInputTypeChanged(gfx::NativeWindow window) {
+ if (IsWindowFocused(window)) {
+ // TODO(yusukes): Support TextInputTypeTracker for TOUCH_UI.
+ }
+}
+
+TextInputType InputMethodBase::GetTextInputType() const {
+ return text_input_client_ ?
+ text_input_client_->GetTextInputType() : TEXT_INPUT_TYPE_NONE;
+}
+
+bool InputMethodBase::IsTextInputTypeNone() const {
+ return GetTextInputType() == TEXT_INPUT_TYPE_NONE;
+}
+
+void InputMethodBase::OnInputMethodChanged() const {
+ if (text_input_client_ &&
+ text_input_client_->GetTextInputType() != TEXT_INPUT_TYPE_NONE)
+ text_input_client_->OnInputMethodChanged();
+}
+
+void InputMethodBase::DispatchKeyEventPostIME(
+ gfx::NativeEvent native_key_event) const {
+ if (delegate_)
+ delegate_->DispatchKeyEventPostIME(native_key_event);
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698