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

Unified Diff: content/browser/renderer_host/text_input_manager.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/text_input_manager.cc
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc
index eed20121103d96cdaaec68cdcafea5ecacc241a6..07c5de9f65fc2367565ab37e3dce5874eb56369c 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -52,23 +52,23 @@ RenderWidgetHostImpl* TextInputManager::GetActiveWidget() const {
: nullptr;
}
-const TextInputState* TextInputManager::GetTextInputState() {
- return !!active_view_ ? &text_input_state_map_[active_view_] : nullptr;
+const TextInputState* TextInputManager::GetTextInputState() const {
+ return !!active_view_ ? &text_input_state_map_.at(active_view_) : nullptr;
}
-gfx::Rect TextInputManager::GetSelectionBoundsRect() {
+gfx::Rect TextInputManager::GetSelectionBoundsRect() const {
if (!active_view_)
return gfx::Rect();
return gfx::RectBetweenSelectionBounds(
- selection_region_map_[active_view_].anchor,
- selection_region_map_[active_view_].focus);
+ selection_region_map_.at(active_view_).anchor,
+ selection_region_map_.at(active_view_).focus);
}
-const std::vector<gfx::Rect>*
-TextInputManager::GetCompositionCharacterBounds() {
+const std::vector<gfx::Rect>* TextInputManager::GetCompositionCharacterBounds()
+ const {
return !!active_view_
- ? &composition_range_info_map_[active_view_].character_bounds
+ ? &composition_range_info_map_.at(active_view_).character_bounds
: nullptr;
}
@@ -178,12 +178,17 @@ void TextInputManager::Register(RenderWidgetHostViewBase* view) {
DCHECK(!IsRegistered(view));
text_input_state_map_[view] = TextInputState();
+ selection_region_map_[view] = SelectionRegion();
+ composition_range_info_map_[view] = CompositionRangeInfo();
}
void TextInputManager::Unregister(RenderWidgetHostViewBase* view) {
DCHECK(IsRegistered(view));
text_input_state_map_.erase(view);
+ selection_region_map_.erase(view);
+ composition_range_info_map_.erase(view);
+
if (active_view_ == view) {
active_view_ = nullptr;
NotifyObserversAboutInputStateUpdate(view, true);
@@ -233,4 +238,4 @@ TextInputManager::CompositionRangeInfo::CompositionRangeInfo(
TextInputManager::CompositionRangeInfo::~CompositionRangeInfo() {}
-} // namespace content
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698