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

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

Issue 8659033: IME (input method editor) support for Aura, part 1 of 3: Add ui/base/ime/ classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, review fix Created 9 years 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
« no previous file with comments | « ui/base/ime/input_method.h ('k') | ui/base/ime/input_method_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef UI_BASE_IME_INPUT_METHOD_BASE_H_
6 #define UI_BASE_IME_INPUT_METHOD_BASE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "ui/base/events.h"
12 #include "ui/base/ime/input_method.h"
13 #include "ui/base/ui_export.h"
14
15 namespace gfx {
16 class Rect;
17 } // namespace gfx
18
19 namespace ui {
20
21 class TextInputClient;
22
23 // A helper class providing functionalities shared among ui::InputMethod
24 // implementations.
25 class UI_EXPORT InputMethodBase : public InputMethod {
26 public:
27 InputMethodBase();
28 virtual ~InputMethodBase();
29
30 // Overriden from InputMethod.
31 virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE;
32 virtual void Init(bool focused) OVERRIDE;
33 // If a derived class overrides OnFocus()/OnBlur(), it should call parent's
34 // implementation first, to make sure |system_toplevel_window_focused_| flag
35 // can be updated correctly.
36 virtual void OnFocus() OVERRIDE;
37 virtual void OnBlur() OVERRIDE;
38 virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE;
39 virtual TextInputClient* GetTextInputClient() const OVERRIDE;
40
41 // If a derived class overrides this method, it should call parent's
42 // implementation.
43 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE;
44
45 virtual TextInputType GetTextInputType() const OVERRIDE;
46
47 protected:
48 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before,
49 TextInputClient* focused) {}
50 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before,
51 TextInputClient* focused) {}
52
53 // Returns true if |client| is currently focused.
54 bool IsTextInputClientFocused(const TextInputClient* client);
55
56 // Checks if the focused text input client's text input type is
57 // TEXT_INPUT_TYPE_NONE. Also returns true if there is no focused text
58 // input client.
59 bool IsTextInputTypeNone() const;
60
61 // Convenience method to call the focused text input client's
62 // OnInputMethodChanged() method. It'll only take effect if the current text
63 // input type is not TEXT_INPUT_TYPE_NONE.
64 void OnInputMethodChanged() const;
65
66 // Convenience method to call delegate_->DispatchKeyEventPostIME().
67 void DispatchKeyEventPostIME(const base::NativeEvent& native_event) const;
68
69 // Convenience method to call delegate_->DispatchFabricatedKeyEventPostIME().
70 void DispatchFabricatedKeyEventPostIME(EventType type,
71 KeyboardCode key_code,
72 int flags) const;
73
74 bool system_toplevel_window_focused() const {
75 return system_toplevel_window_focused_;
76 }
77
78 private:
79 internal::InputMethodDelegate* delegate_;
80 TextInputClient* text_input_client_;
81
82 bool system_toplevel_window_focused_;
83
84 DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
85 };
86
87 } // namespace ui
88
89 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_
OLDNEW
« no previous file with comments | « ui/base/ime/input_method.h ('k') | ui/base/ime/input_method_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698