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

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

Issue 2170463002: [refactor] content::TextInputManager - Make some methods const and initialize/cleanup IME maps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a comment to .h file 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
« no previous file with comments | « no previous file | content/browser/renderer_host/text_input_manager.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 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // --------------------------------------------------------------------------- 70 // ---------------------------------------------------------------------------
71 // The following methods can be used to obtain information about IME-related 71 // The following methods can be used to obtain information about IME-related
72 // state for the active RenderWidgetHost. If the active widget is nullptr, the 72 // state for the active RenderWidgetHost. If the active widget is nullptr, the
73 // methods below will return nullptr as well. 73 // methods below will return nullptr as well.
74 // Users of these methods should not hold on to the pointers as they become 74 // Users of these methods should not hold on to the pointers as they become
75 // dangling if the TextInputManager or |active_view_| are destroyed. 75 // dangling if the TextInputManager or |active_view_| are destroyed.
76 76
77 // Returns the currently stored TextInputState. An state of nullptr can be 77 // Returns the currently stored TextInputState. An state of nullptr can be
78 // interpreted as a ui::TextInputType of ui::TEXT_INPUT_TYPE_NONE. 78 // interpreted as a ui::TextInputType of ui::TEXT_INPUT_TYPE_NONE.
79 const TextInputState* GetTextInputState(); 79 const TextInputState* GetTextInputState() const;
80 80
81 // Returns the rect between selection bounds. 81 // Returns the rect between selection bounds.
82 gfx::Rect GetSelectionBoundsRect(); 82 gfx::Rect GetSelectionBoundsRect() const;
83 83
84 // Returns a vector of rects representing the character bounds. 84 // Returns a vector of rects representing the character bounds.
85 const std::vector<gfx::Rect>* GetCompositionCharacterBounds(); 85 const std::vector<gfx::Rect>* GetCompositionCharacterBounds() const;
86 86
87 // --------------------------------------------------------------------------- 87 // ---------------------------------------------------------------------------
88 // The following methods are called by RWHVs on the tab to update their IME- 88 // The following methods are called by RWHVs on the tab to update their IME-
89 // related state. 89 // related state.
90 90
91 // Updates the TextInputState for |view|. 91 // Updates the TextInputState for |view|.
92 void UpdateTextInputState(RenderWidgetHostViewBase* view, 92 void UpdateTextInputState(RenderWidgetHostViewBase* view,
93 const TextInputState& state); 93 const TextInputState& state);
94 94
95 // The current IME composition has been cancelled on the renderer side for 95 // The current IME composition has been cancelled on the renderer side for
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 }; 164 };
165 165
166 void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view, 166 void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view,
167 bool did_update_state); 167 bool did_update_state);
168 168
169 // The view with active text input state, i.e., a focused <input> element. 169 // The view with active text input state, i.e., a focused <input> element.
170 // It will be nullptr if no such view exists. Note that the active view 170 // It will be nullptr if no such view exists. Note that the active view
171 // cannot have a |TextInputState.type| of ui::TEXT_INPUT_TYPE_NONE. 171 // cannot have a |TextInputState.type| of ui::TEXT_INPUT_TYPE_NONE.
172 RenderWidgetHostViewBase* active_view_; 172 RenderWidgetHostViewBase* active_view_;
173 173
174 // The following maps track corresponding IME state for views. For each view,
175 // the values in the map are initialized and cleared in Register and
176 // Unregister methods, respectively.
174 ViewMap<TextInputState> text_input_state_map_; 177 ViewMap<TextInputState> text_input_state_map_;
175
176 // Text selection bounds information for registered views.
177 ViewMap<SelectionRegion> selection_region_map_; 178 ViewMap<SelectionRegion> selection_region_map_;
178 ViewMap<CompositionRangeInfo> composition_range_info_map_; 179 ViewMap<CompositionRangeInfo> composition_range_info_map_;
179 180
180 base::ObserverList<Observer> observer_list_; 181 base::ObserverList<Observer> observer_list_;
181 182
182 DISALLOW_COPY_AND_ASSIGN(TextInputManager); 183 DISALLOW_COPY_AND_ASSIGN(TextInputManager);
183 }; 184 };
184 } 185 }
185 186
186 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ 187 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/text_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698