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

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

Issue 2536943004: Fix a crash occuring during the destruction of TextInputManager on Android. (Closed)
Patch Set: Fixed a typo. 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
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | no next file » | 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 #include "content/browser/renderer_host/text_input_manager.h" 5 #include "content/browser/renderer_host/text_input_manager.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "content/browser/renderer_host/render_widget_host_impl.h" 8 #include "content/browser/renderer_host/render_widget_host_impl.h"
9 #include "content/browser/renderer_host/render_widget_host_view_base.h" 9 #include "content/browser/renderer_host/render_widget_host_view_base.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 for (auto* view : views) 53 for (auto* view : views)
54 Unregister(view); 54 Unregister(view);
55 } 55 }
56 56
57 RenderWidgetHostImpl* TextInputManager::GetActiveWidget() const { 57 RenderWidgetHostImpl* TextInputManager::GetActiveWidget() const {
58 return !!active_view_ ? static_cast<RenderWidgetHostImpl*>( 58 return !!active_view_ ? static_cast<RenderWidgetHostImpl*>(
59 active_view_->GetRenderWidgetHost()) 59 active_view_->GetRenderWidgetHost())
60 : nullptr; 60 : nullptr;
61 } 61 }
62 62
63 const TextInputState* TextInputManager::GetTextInputState( 63 const TextInputState* TextInputManager::GetTextInputState() const {
64 RenderWidgetHostViewBase* view) const { 64 return !!active_view_ ? &text_input_state_map_.at(active_view_) : nullptr;
65 DCHECK(!view || IsRegistered(view));
66 if (!view)
67 view = active_view_;
68 return !!view ? &text_input_state_map_.at(view) : nullptr;
69 } 65 }
70 66
71 const TextInputManager::SelectionRegion* TextInputManager::GetSelectionRegion( 67 const TextInputManager::SelectionRegion* TextInputManager::GetSelectionRegion(
72 RenderWidgetHostViewBase* view) const { 68 RenderWidgetHostViewBase* view) const {
73 DCHECK(!view || IsRegistered(view)); 69 DCHECK(!view || IsRegistered(view));
74 if (!view) 70 if (!view)
75 view = active_view_; 71 view = active_view_;
76 return view ? &selection_region_map_.at(view) : nullptr; 72 return view ? &selection_region_map_.at(view) : nullptr;
77 } 73 }
78 74
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 "point exceeds text length)."; 344 "point exceeds text length).";
349 return false; 345 return false;
350 } 346 }
351 347
352 selected_text->clear(); 348 selected_text->clear();
353 selected_text->append(text.substr(pos, n)); 349 selected_text->append(text.substr(pos, n));
354 return true; 350 return true;
355 } 351 }
356 352
357 } // namespace content 353 } // namespace content
OLDNEW
« 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