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

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 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
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 set_delegate(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(
49 TextInputClient* focused_before, TextInputClient* focused) {}
sky 2011/12/05 15:15:29 nit: when you wrap, each param on its own line.
Yusuke Sato 2011/12/05 22:55:14 Done.
50 virtual void OnDidChangeFocusedClient(
51 TextInputClient* focused_before, 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(
71 EventType type, KeyboardCode key_code, int flags) const;
72
73 bool system_toplevel_window_focused() const {
74 return system_toplevel_window_focused_;
75 }
76
77 private:
78 internal::InputMethodDelegate* delegate_;
79 TextInputClient* text_input_client_;
80
81 bool system_toplevel_window_focused_;
82
83 DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
84 };
85
86 } // namespace ui
87
88 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698