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

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

Issue 80583002: [FYI] All-in-one OnCandidateWindow{Show,Update,Hide} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 7 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 | « no previous file | 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
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/observer_list.h" 11 #include "base/observer_list.h"
11 #include "ui/base/ime/input_method.h" 12 #include "ui/base/ime/input_method.h"
12 #include "ui/base/ui_export.h" 13 #include "ui/base/ui_export.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 class Rect; 16 class Rect;
16 } // namespace gfx 17 } // namespace gfx
17 18
18 namespace ui { 19 namespace ui {
19 20
20 class InputMethodObserver; 21 class InputMethodObserver;
21 class KeyEvent; 22 class KeyEvent;
22 class TextInputClient; 23 class TextInputClient;
23 24
24 // A helper class providing functionalities shared among ui::InputMethod 25 // A helper class providing functionalities shared among ui::InputMethod
25 // implementations. 26 // implementations.
26 class UI_EXPORT InputMethodBase : NON_EXPORTED_BASE(public InputMethod) { 27 class UI_EXPORT InputMethodBase
28 : NON_EXPORTED_BASE(public InputMethod),
29 public base::SupportsWeakPtr<InputMethodBase> {
27 public: 30 public:
28 InputMethodBase(); 31 InputMethodBase();
29 virtual ~InputMethodBase(); 32 virtual ~InputMethodBase();
30 33
31 // Overriden from InputMethod. 34 // Overriden from InputMethod.
32 virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; 35 virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE;
33 virtual void Init(bool focused) OVERRIDE; 36 virtual void Init(bool focused) OVERRIDE;
34 // If a derived class overrides OnFocus()/OnBlur(), it should call parent's 37 // If a derived class overrides OnFocus()/OnBlur(), it should call parent's
35 // implementation first, to make sure |system_toplevel_window_focused_| flag 38 // implementation first, to make sure |system_toplevel_window_focused_| flag
36 // can be updated correctly. 39 // can be updated correctly.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // input type is not TEXT_INPUT_TYPE_NONE. 73 // input type is not TEXT_INPUT_TYPE_NONE.
71 void OnInputMethodChanged() const; 74 void OnInputMethodChanged() const;
72 75
73 // Convenience method to call delegate_->DispatchKeyEventPostIME(). 76 // Convenience method to call delegate_->DispatchKeyEventPostIME().
74 // Returns true if the event was processed 77 // Returns true if the event was processed
75 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) const; 78 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) const;
76 79
77 // Convenience method to notify all observers of TextInputClient changes. 80 // Convenience method to notify all observers of TextInputClient changes.
78 void NotifyTextInputStateChanged(const TextInputClient* client); 81 void NotifyTextInputStateChanged(const TextInputClient* client);
79 82
83 // Interface for for signalling candidate window events.
84 // See also *Callback functions below. To avoid reentrancy issue that
85 // TextInputClient manipulates IME state during even handling, these methods
86 // defer sending actual signals to renderer.
87 void OnCandidateWindowShown();
88 void OnCandidateWindowUpdated();
89 void OnCandidateWindowHidden();
90
80 bool system_toplevel_window_focused() const { 91 bool system_toplevel_window_focused() const {
81 return system_toplevel_window_focused_; 92 return system_toplevel_window_focused_;
82 } 93 }
83 94
84 private: 95 private:
85 void SetFocusedTextInputClientInternal(TextInputClient* client); 96 void SetFocusedTextInputClientInternal(TextInputClient* client);
86 97
98 // Deferred callbacks for signalling TextInputClient about candidate window
99 // appearance changes.
100 void CandidateWindowShownCallback();
101 void CandidateWindowUpdatedCallback();
102 void CandidateWindowHiddenCallback();
103
87 internal::InputMethodDelegate* delegate_; 104 internal::InputMethodDelegate* delegate_;
88 TextInputClient* text_input_client_; 105 TextInputClient* text_input_client_;
89 106
90 ObserverList<InputMethodObserver> observer_list_; 107 ObserverList<InputMethodObserver> observer_list_;
91 108
92 bool system_toplevel_window_focused_; 109 bool system_toplevel_window_focused_;
93 110
94 DISALLOW_COPY_AND_ASSIGN(InputMethodBase); 111 DISALLOW_COPY_AND_ASSIGN(InputMethodBase);
95 }; 112 };
96 113
97 } // namespace ui 114 } // namespace ui
98 115
99 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_ 116 #endif // UI_BASE_IME_INPUT_METHOD_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/ime/input_method_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698