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

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

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 months 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
« no previous file with comments | « ui/views/ime/input_method.h ('k') | ui/views/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_VIEWS_IME_INPUT_METHOD_BASE_H_
6 #define UI_VIEWS_IME_INPUT_METHOD_BASE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/focus/focus_manager.h"
11 #include "ui/views/ime/input_method.h"
12 #include "ui/views/ime/input_method_delegate.h"
13
14 namespace gfx {
15 class Rect;
16 }
17
18 namespace ui {
19 class KeyEvent;
20 }
21
22 namespace views {
23
24 // A helper that provides functionality shared by InputMethod implementations.
25 class VIEWS_EXPORT InputMethodBase : public InputMethod,
26 public FocusChangeListener {
27 public:
28 InputMethodBase();
29 ~InputMethodBase() override;
30
31 // Overridden from InputMethod.
32 void SetDelegate(internal::InputMethodDelegate* delegate) override;
33 void Init(Widget* widget) override;
34 void OnTextInputTypeChanged(View* view) override;
35 ui::TextInputClient* GetTextInputClient() const override;
36 ui::TextInputType GetTextInputType() const override;
37
38 // Overridden from FocusChangeListener.
39 void OnWillChangeFocus(View* focused_before, View* focused) override;
40 void OnDidChangeFocus(View* focused_before, View* focused) override;
41
42 protected:
43 internal::InputMethodDelegate* delegate() const { return delegate_; }
44 Widget* widget() const { return widget_; }
45 View* GetFocusedView() const;
46
47 // Returns true only if the View is focused and its Widget is active.
48 bool IsViewFocused(View* view) const;
49
50 // Returns true if there is no focused text input client or its type is none.
51 bool IsTextInputTypeNone() const;
52
53 // Calls the focused text input client's OnInputMethodChanged() method.
54 // This has no effect if the text input type is ui::TEXT_INPUT_TYPE_NONE.
55 void OnInputMethodChanged() const;
56
57 // Convenience method to call delegate_->DispatchKeyEventPostIME().
58 void DispatchKeyEventPostIME(const ui::KeyEvent& key) const;
59
60 // Gets the current text input client's caret bounds in Widget's coordinates.
61 // Returns false if the current text input client doesn't support text input.
62 bool GetCaretBoundsInWidget(gfx::Rect* rect) const;
63
64 // Removes any state installed on |widget_| and NULLs it out. Use if the
65 // widget is in a state such that it should no longer be used (such as when
66 // this is in its destructor).
67 void DetachFromWidget();
68
69 private:
70 internal::InputMethodDelegate* delegate_;
71 Widget* widget_;
72
73 DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
74 };
75
76 } // namespace views
77
78 #endif // UI_VIEWS_IME_INPUT_METHOD_BASE_H_
OLDNEW
« no previous file with comments | « ui/views/ime/input_method.h ('k') | ui/views/ime/input_method_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698