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

Unified Diff: ui/base/ime/input_method_base.h

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.h
diff --git a/ui/base/ime/input_method_base.h b/ui/base/ime/input_method_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ff09cca5270a8882f00a582a35adb6c40e54986
--- /dev/null
+++ b/ui/base/ime/input_method_base.h
@@ -0,0 +1,70 @@
+// 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.
+
+#ifndef UI_BASE_IME_INPUT_METHOD_BASE_H_
+#define UI_BASE_IME_INPUT_METHOD_BASE_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/base/ime/input_method.h"
+#include "ui/base/ui_export.h"
+
+namespace gfx {
+class Rect;
+} // namespace gfx
+
+namespace ui {
+
+class TextInputClient;
+
+// A helper class providing functionalities shared among ui::InputMethod
+// implementations.
+class UI_EXPORT InputMethodBase : public InputMethod {
+ public:
+ InputMethodBase();
+ virtual ~InputMethodBase();
+
+ // Overriden from InputMethod.
+ virtual void set_delegate(internal::InputMethodDelegate* delegate) OVERRIDE;
+ virtual void set_text_input_client(TextInputClient* client) OVERRIDE;
+ virtual TextInputClient* text_input_client() const OVERRIDE;
+
+ // If a derived class overrides this method, it should call parent's
+ // implementation.
+ virtual void OnTextInputTypeChanged(gfx::NativeWindow window) OVERRIDE;
+
+ virtual TextInputType GetTextInputType() const OVERRIDE;
+
+ protected:
+ // Checks if the given |window| is focused. Returns true only if the window
+ // is inside the focused top-level window.
+ virtual bool IsWindowFocused(gfx::NativeWindow window) const = 0;
James Su 2011/11/21 08:23:36 Instead of introducing this method, I'd suggest to
Yusuke Sato 2011/11/22 11:09:30 Done.
+
+ // Derived class must call this function when ...
+ void ActiveWindowChanged(gfx::NativeWindow active);
James Su 2011/11/21 08:23:36 This method is not necessary. Instead, the owner s
Yusuke Sato 2011/11/22 11:09:30 Done.
+
+ // Checks if the focused text input client's text input type is
+ // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text
+ // input client.
+ bool IsTextInputTypeNone() const;
+
+ // Convenience method to call the focused text input client's
+ // OnInputMethodChanged() method. It'll only take effect if the current text
+ // input type is not TEXT_INPUT_TYPE_NONE.
+ void OnInputMethodChanged() const;
+
+ // Convenience method to call delegate_->DispatchKeyEventPostIME().
+ void DispatchKeyEventPostIME(gfx::NativeEvent native_key_event) const;
+
+ private:
+ internal::InputMethodDelegate* delegate_;
+ TextInputClient* text_input_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_IME_INPUT_METHOD_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698