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

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

Issue 2045363002: Routing IME Result Calls to the Correct RenderWidgetHost (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a comment Created 4 years, 6 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 #include "content/browser/renderer_host/text_input_manager.h" 5 #include "content/browser/renderer_host/text_input_manager.h"
6 6
7 #include "content/browser/renderer_host/render_widget_host_impl.h"
7 #include "content/browser/renderer_host/render_widget_host_view_base.h" 8 #include "content/browser/renderer_host/render_widget_host_view_base.h"
8 9
9 namespace content { 10 namespace content {
10 11
11 namespace { 12 namespace {
12 13
13 bool AreDifferentTextInputStates(const content::TextInputState& old_state, 14 bool AreDifferentTextInputStates(const content::TextInputState& old_state,
14 const content::TextInputState& new_state) { 15 const content::TextInputState& new_state) {
15 #if defined(USE_AURA) 16 #if defined(USE_AURA)
16 return old_state.type != new_state.type || old_state.mode != new_state.mode || 17 return old_state.type != new_state.type || old_state.mode != new_state.mode ||
(...skipping 23 matching lines...) Expand all
40 views.push_back(pair.first); 41 views.push_back(pair.first);
41 42
42 for (auto view : views) 43 for (auto view : views)
43 Unregister(view); 44 Unregister(view);
44 } 45 }
45 46
46 const TextInputState* TextInputManager::GetTextInputState() { 47 const TextInputState* TextInputManager::GetTextInputState() {
47 return !!active_view_ ? &text_input_state_map_[active_view_] : nullptr; 48 return !!active_view_ ? &text_input_state_map_[active_view_] : nullptr;
48 } 49 }
49 50
50 RenderWidgetHostViewBase* TextInputManager::GetActiveView() const { 51 RenderWidgetHostImpl* TextInputManager::GetActiveWidget() const {
Charlie Reis 2016/06/21 21:13:56 There's a bunch of places that just call GetActive
EhsanK 2016/06/22 18:26:33 I found three instances: in 'text_input_test_utils
Charlie Reis 2016/06/22 19:19:15 Yes. Also, I missed this in the previous review,
kenrb 2016/06/22 19:39:50 Charlie: I had asked for removal of GetActiveView(
Charlie Reis 2016/06/22 20:23:08 Ok, I'm fine with steering people towards GetActiv
EhsanK 2016/06/22 20:56:44 I also agree with Ken on this. Views are used as k
EhsanK 2016/06/22 20:56:44 Charlie: I actually think |active_widget_| rather
51 return active_view_; 52 return !!active_view_ ? static_cast<RenderWidgetHostImpl*>(
53 active_view_->GetRenderWidgetHost())
54 : nullptr;
52 } 55 }
53 56
54 void TextInputManager::UpdateTextInputState( 57 void TextInputManager::UpdateTextInputState(
55 RenderWidgetHostViewBase* view, 58 RenderWidgetHostViewBase* view,
56 const TextInputState& text_input_state) { 59 const TextInputState& text_input_state) {
57 DCHECK(IsRegistered(view)); 60 DCHECK(IsRegistered(view));
58 61
59 // Since |view| is registgered, we already have a previous value for its 62 // Since |view| is registgered, we already have a previous value for its
60 // TextInputState. 63 // TextInputState.
61 bool changed = AreDifferentTextInputStates(text_input_state_map_[view], 64 bool changed = AreDifferentTextInputStates(text_input_state_map_[view],
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 void TextInputManager::NotifyObserversAboutInputStateUpdate( 110 void TextInputManager::NotifyObserversAboutInputStateUpdate(
108 RenderWidgetHostViewBase* updated_view, 111 RenderWidgetHostViewBase* updated_view,
109 bool did_update_state) { 112 bool did_update_state) {
110 FOR_EACH_OBSERVER( 113 FOR_EACH_OBSERVER(
111 Observer, observer_list_, 114 Observer, observer_list_,
112 OnUpdateTextInputStateCalled(this, updated_view, did_update_state)); 115 OnUpdateTextInputStateCalled(this, updated_view, did_update_state));
113 } 116 }
114 117
115 } // namespace content 118 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698