| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_IME_INPUT_METHOD_BASE_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_BASE_H_ |
| 6 #define UI_BASE_IME_INPUT_METHOD_BASE_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_BASE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Returns true if the event was processed | 78 // Returns true if the event was processed |
| 79 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) const; | 79 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) const; |
| 80 | 80 |
| 81 // Convenience method to notify all observers of TextInputClient changes. | 81 // Convenience method to notify all observers of TextInputClient changes. |
| 82 void NotifyTextInputStateChanged(const TextInputClient* client); | 82 void NotifyTextInputStateChanged(const TextInputClient* client); |
| 83 | 83 |
| 84 // Convenience method to notify all observers of CaretBounds changes on | 84 // Convenience method to notify all observers of CaretBounds changes on |
| 85 // |client| which is the text input client with focus. | 85 // |client| which is the text input client with focus. |
| 86 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); | 86 void NotifyTextInputCaretBoundsChanged(const TextInputClient* client); |
| 87 | 87 |
| 88 // Interface for for signalling candidate window events. | |
| 89 // See also *Callback functions below. To avoid reentrancy issue that | |
| 90 // TextInputClient manipulates IME state during even handling, these methods | |
| 91 // defer sending actual signals to renderer. | |
| 92 void OnCandidateWindowShown(); | |
| 93 void OnCandidateWindowUpdated(); | |
| 94 void OnCandidateWindowHidden(); | |
| 95 | |
| 96 bool system_toplevel_window_focused() const { | 88 bool system_toplevel_window_focused() const { |
| 97 return system_toplevel_window_focused_; | 89 return system_toplevel_window_focused_; |
| 98 } | 90 } |
| 99 | 91 |
| 100 private: | 92 private: |
| 101 void SetFocusedTextInputClientInternal(TextInputClient* client); | 93 void SetFocusedTextInputClientInternal(TextInputClient* client); |
| 102 | 94 |
| 103 // Deferred callbacks for signalling TextInputClient about candidate window | |
| 104 // appearance changes. | |
| 105 void CandidateWindowShownCallback(); | |
| 106 void CandidateWindowUpdatedCallback(); | |
| 107 void CandidateWindowHiddenCallback(); | |
| 108 | |
| 109 internal::InputMethodDelegate* delegate_; | 95 internal::InputMethodDelegate* delegate_; |
| 110 TextInputClient* text_input_client_; | 96 TextInputClient* text_input_client_; |
| 111 | 97 |
| 112 ObserverList<InputMethodObserver> observer_list_; | 98 ObserverList<InputMethodObserver> observer_list_; |
| 113 | 99 |
| 114 bool system_toplevel_window_focused_; | 100 bool system_toplevel_window_focused_; |
| 115 | 101 |
| 116 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); | 102 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); |
| 117 }; | 103 }; |
| 118 | 104 |
| 119 } // namespace ui | 105 } // namespace ui |
| 120 | 106 |
| 121 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ | 107 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ |
| OLD | NEW |