OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ | 5 #ifndef UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ |
6 #define UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ | 6 #define UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "ui/base/ime/text_input_client.h" | 13 #include "ui/base/ime/text_input_client.h" |
14 #include "ui/views/ime/input_method_base.h" | 14 #include "ui/views/ime/input_method_base.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class InputMethod; | 17 class InputMethod; |
18 } // namespace ui | 18 } // namespace ui |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 class View; | 22 class View; |
23 | 23 |
24 // A "bridge" InputMethod implementation for views top-level widgets, which just | 24 // A "bridge" InputMethod implementation for views top-level widgets, which just |
25 // sends/receives IME related events to/from a system-wide ui::InputMethod | 25 // sends/receives IME related events to/from a system-wide ui::InputMethod |
26 // object. | 26 // object. |
27 class InputMethodBridge : public InputMethodBase, | 27 class InputMethodBridge : public InputMethodBase, |
28 public ui::TextInputClient { | 28 public ui::TextInputClient { |
29 public: | 29 public: |
| 30 // |this| object owns neither |delegate| nor |host|. Both |delegate| and |
| 31 // |host| must outlive |this| object. |
30 InputMethodBridge(internal::InputMethodDelegate* delegate, | 32 InputMethodBridge(internal::InputMethodDelegate* delegate, |
31 ui::InputMethod* host); | 33 ui::InputMethod* host); |
32 virtual ~InputMethodBridge(); | 34 virtual ~InputMethodBridge(); |
33 | 35 |
34 // Overridden from InputMethod: | 36 // Overridden from InputMethod: |
35 virtual void Init(Widget* widget) OVERRIDE; | 37 virtual void Init(Widget* widget) OVERRIDE; |
36 virtual void OnFocus() OVERRIDE; | 38 virtual void OnFocus() OVERRIDE; |
37 virtual void OnBlur() OVERRIDE; | 39 virtual void OnBlur() OVERRIDE; |
38 virtual void DispatchKeyEvent(const KeyEvent& key) OVERRIDE; | 40 virtual void DispatchKeyEvent(const KeyEvent& key) OVERRIDE; |
39 virtual void OnTextInputTypeChanged(View* view) OVERRIDE; | 41 virtual void OnTextInputTypeChanged(View* view) OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 75 |
74 ui::InputMethod* const host_; | 76 ui::InputMethod* const host_; |
75 bool context_focused_; | 77 bool context_focused_; |
76 | 78 |
77 DISALLOW_COPY_AND_ASSIGN(InputMethodBridge); | 79 DISALLOW_COPY_AND_ASSIGN(InputMethodBridge); |
78 }; | 80 }; |
79 | 81 |
80 } // namespace views | 82 } // namespace views |
81 | 83 |
82 #endif // UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ | 84 #endif // UI_VIEWS_IME_INPUT_METHOD_BRIDGE_H_ |
OLD | NEW |