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

Side by Side Diff: content/browser/renderer_host/text_input_manager.h

Issue 2098353005: Implement RenderWidgetHostViewBase::ImeCancelComposition for all Views (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ 6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
7 7
8 #include <unordered_map> 8 #include <unordered_map>
9 9
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 18 matching lines...) Expand all
29 class CONTENT_EXPORT Observer { 29 class CONTENT_EXPORT Observer {
30 public: 30 public:
31 // Called when a view has called UpdateTextInputState on TextInputManager. 31 // Called when a view has called UpdateTextInputState on TextInputManager.
32 // If the call has led to a change in TextInputState, |did_update_state| is 32 // If the call has led to a change in TextInputState, |did_update_state| is
33 // true. In some plaforms, we need this update even when the state has not 33 // true. In some plaforms, we need this update even when the state has not
34 // changed (e.g., Aura for updating IME). 34 // changed (e.g., Aura for updating IME).
35 virtual void OnUpdateTextInputStateCalled( 35 virtual void OnUpdateTextInputStateCalled(
36 TextInputManager* text_input_manager, 36 TextInputManager* text_input_manager,
37 RenderWidgetHostViewBase* updated_view, 37 RenderWidgetHostViewBase* updated_view,
38 bool did_update_state) {} 38 bool did_update_state) {}
39 // Called when |updated_view| has called ImeCancelComposition on
40 // TextInputManager.
41 virtual void OnImeCancelComposition(
42 TextInputManager* text_input_manager,
43 RenderWidgetHostViewBase* updated_view) {}
39 }; 44 };
40 45
41 TextInputManager(); 46 TextInputManager();
42 ~TextInputManager(); 47 ~TextInputManager();
43 48
44 // --------------------------------------------------------------------------- 49 // ---------------------------------------------------------------------------
45 // The following methods can be used to obtain information about IME-related 50 // The following methods can be used to obtain information about IME-related
46 // state for the active RenderWidget. 51 // state for the active RenderWidget.
47 52
48 // Returns the currently active widget, i.e., the RWH which is associated with 53 // Returns the currently active widget, i.e., the RWH which is associated with
49 // |active_view_|. 54 // |active_view_|.
50 RenderWidgetHostImpl* GetActiveWidget() const; 55 RenderWidgetHostImpl* GetActiveWidget() const;
51 56
52 // Returns the TextInputState corresponding to |active_view_|. 57 // Returns the TextInputState corresponding to |active_view_|.
53 // Users of this method should not hold on to the pointer as it might become 58 // Users of this method should not hold on to the pointer as it might become
54 // dangling if the TextInputManager or |active_view_| might go away. 59 // dangling if the TextInputManager or |active_view_| might go away.
55 const TextInputState* GetTextInputState(); 60 const TextInputState* GetTextInputState();
56 61
57 // --------------------------------------------------------------------------- 62 // ---------------------------------------------------------------------------
58 // The following methods are called by RWHVs on the tab to update their IME- 63 // The following methods are called by RWHVs on the tab to update their IME-
59 // related state. 64 // related state.
60 65
61 // Updates the TextInputState for |view|. 66 // Updates the TextInputState for |view|.
62 void UpdateTextInputState(RenderWidgetHostViewBase* view, 67 void UpdateTextInputState(RenderWidgetHostViewBase* view,
63 const TextInputState& state); 68 const TextInputState& state);
64 69
70 // The current IME composition has been cancelled on the renderer side for
71 // the widget corresponding to |view|.
72 void ImeCancelComposition(RenderWidgetHostViewBase* view);
73
65 // Registers the given |view| for tracking its TextInputState. This is called 74 // Registers the given |view| for tracking its TextInputState. This is called
66 // by any view which has updates in its TextInputState (whether tab's RWHV or 75 // by any view which has updates in its TextInputState (whether tab's RWHV or
67 // that of a child frame). The |view| must unregister itself before being 76 // that of a child frame). The |view| must unregister itself before being
68 // destroyed (i.e., call TextInputManager::Unregister). 77 // destroyed (i.e., call TextInputManager::Unregister).
69 void Register(RenderWidgetHostViewBase* view); 78 void Register(RenderWidgetHostViewBase* view);
70 79
71 // Clears the TextInputState from the |view|. If |view == active_view_|, this 80 // Clears the TextInputState from the |view|. If |view == active_view_|, this
72 // call will lead to a TextInputState update since the TextInputState.type 81 // call will lead to a TextInputState update since the TextInputState.type
73 // should be reset to none. 82 // should be reset to none.
74 void Unregister(RenderWidgetHostViewBase* view); 83 void Unregister(RenderWidgetHostViewBase* view);
(...skipping 28 matching lines...) Expand all
103 std::unordered_map<RenderWidgetHostViewBase*, TextInputState> 112 std::unordered_map<RenderWidgetHostViewBase*, TextInputState>
104 text_input_state_map_; 113 text_input_state_map_;
105 114
106 base::ObserverList<Observer> observer_list_; 115 base::ObserverList<Observer> observer_list_;
107 116
108 DISALLOW_COPY_AND_ASSIGN(TextInputManager); 117 DISALLOW_COPY_AND_ASSIGN(TextInputManager);
109 }; 118 };
110 } 119 }
111 120
112 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ 121 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698