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

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

Issue 2536943004: Fix a crash occuring during the destruction of TextInputManager on Android. (Closed)
Patch Set: Addressed creis@'s comments Created 4 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
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 #include <utility> 9 #include <utility>
10 10
(...skipping 19 matching lines...) Expand all
30 class CONTENT_EXPORT TextInputManager { 30 class CONTENT_EXPORT TextInputManager {
31 public: 31 public:
32 // The tab's top-level RWHV should be an observer of TextInputManager to get 32 // The tab's top-level RWHV should be an observer of TextInputManager to get
33 // notifications about changes in TextInputState or other IME related state 33 // notifications about changes in TextInputState or other IME related state
34 // for child frames. 34 // for child frames.
35 class CONTENT_EXPORT Observer { 35 class CONTENT_EXPORT Observer {
36 public: 36 public:
37 // Called when a view has called UpdateTextInputState on TextInputManager. 37 // Called when a view has called UpdateTextInputState on TextInputManager.
38 // If the call has led to a change in TextInputState, |did_update_state| is 38 // If the call has led to a change in TextInputState, |did_update_state| is
39 // true. In some plaforms, we need this update even when the state has not 39 // true. In some plaforms, we need this update even when the state has not
40 // changed (e.g., Aura for updating IME). 40 // changed (e.g., Aura for updating IME). Also note that |updated_view| is
41 // the view which has most recently received an update in TextInputState.
42 // |updated_view| should not be used to obtain any IME state since this
43 // observer method might have been called in the process of unregistering
44 // |active_view_| from TextInputManager (which in turn is a result of either
45 // destroying |active_view_| or TextInputManager).
41 virtual void OnUpdateTextInputStateCalled( 46 virtual void OnUpdateTextInputStateCalled(
42 TextInputManager* text_input_manager, 47 TextInputManager* text_input_manager,
43 RenderWidgetHostViewBase* updated_view, 48 RenderWidgetHostViewBase* updated_view,
44 bool did_update_state) {} 49 bool did_update_state) {}
45 // Called when |updated_view| has called ImeCancelComposition on 50 // Called when |updated_view| has called ImeCancelComposition on
46 // TextInputManager. 51 // TextInputManager.
47 virtual void OnImeCancelComposition( 52 virtual void OnImeCancelComposition(
48 TextInputManager* text_input_manager, 53 TextInputManager* text_input_manager,
49 RenderWidgetHostViewBase* updated_view) {} 54 RenderWidgetHostViewBase* updated_view) {}
50 // Called when |updated_view| has changed its SelectionRegion. 55 // Called when |updated_view| has changed its SelectionRegion.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // |active_view_|. 121 // |active_view_|.
117 RenderWidgetHostImpl* GetActiveWidget() const; 122 RenderWidgetHostImpl* GetActiveWidget() const;
118 123
119 // --------------------------------------------------------------------------- 124 // ---------------------------------------------------------------------------
120 // The following methods can be used to obtain information about IME-related 125 // The following methods can be used to obtain information about IME-related
121 // state for the active RenderWidgetHost. If the active widget is nullptr, the 126 // state for the active RenderWidgetHost. If the active widget is nullptr, the
122 // methods below will return nullptr as well. 127 // methods below will return nullptr as well.
123 // Users of these methods should not hold on to the pointers as they become 128 // Users of these methods should not hold on to the pointers as they become
124 // dangling if the TextInputManager or |active_view_| are destroyed. 129 // dangling if the TextInputManager or |active_view_| are destroyed.
125 130
126 // Returns the currently stored TextInputState for |view|. A state of nullptr 131 // Returns the currently stored TextInputState for |active_view_|. A state of
127 // can be interpreted as a ui::TextInputType of ui::TEXT_INPUT_TYPE_NONE for 132 // nullptr can be interpreted as a ui::TextInputType of
128 // the view. If |view| is null and there is an |active_view_|, the state for 133 // ui::TEXT_INPUT_TYPE_NONE..
Charlie Reis 2016/11/30 00:57:51 nit: Two periods.
EhsanK 2016/11/30 01:08:21 Thanks! Done.
129 // |active_view_| is returned. 134 const TextInputState* GetTextInputState() const;
130 const TextInputState* GetTextInputState(
131 RenderWidgetHostViewBase* view = nullptr) const;
132 135
133 // Returns the selection bounds information for |view|. If |view| == nullptr, 136 // Returns the selection bounds information for |view|. If |view| == nullptr,
134 // it will return the corresponding information for |active_view_| or nullptr 137 // it will return the corresponding information for |active_view_| or nullptr
135 // if there are no active views. 138 // if there are no active views.
136 const SelectionRegion* GetSelectionRegion( 139 const SelectionRegion* GetSelectionRegion(
137 RenderWidgetHostViewBase* view = nullptr) const; 140 RenderWidgetHostViewBase* view = nullptr) const;
138 141
139 // Returns the composition range and character bounds information for the 142 // Returns the composition range and character bounds information for the
140 // |view|. If |view| == nullptr, it will assume |active_view_| and return its 143 // |view|. If |view| == nullptr, it will assume |active_view_| and return its
141 // state. If |active_view_| == nullptr, this method will return nullptr. 144 // state. If |active_view_| == nullptr, this method will return nullptr.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ViewMap<CompositionRangeInfo> composition_range_info_map_; 233 ViewMap<CompositionRangeInfo> composition_range_info_map_;
231 ViewMap<TextSelection> text_selection_map_; 234 ViewMap<TextSelection> text_selection_map_;
232 235
233 base::ObserverList<Observer> observer_list_; 236 base::ObserverList<Observer> observer_list_;
234 237
235 DISALLOW_COPY_AND_ASSIGN(TextInputManager); 238 DISALLOW_COPY_AND_ASSIGN(TextInputManager);
236 }; 239 };
237 } 240 }
238 241
239 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ 242 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/browser/renderer_host/text_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698