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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a DCHECK and Changed Pointer to WeakPtr Created 4 years, 8 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 | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/text_input_state.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); 2233 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
2234 if (rwhv) { 2234 if (rwhv) {
2235 SendPageMessage(new PageMsg_UpdateWindowScreenRect( 2235 SendPageMessage(new PageMsg_UpdateWindowScreenRect(
2236 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); 2236 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow()));
2237 } 2237 }
2238 2238
2239 if (browser_plugin_embedder_) 2239 if (browser_plugin_embedder_)
2240 browser_plugin_embedder_->DidSendScreenRects(); 2240 browser_plugin_embedder_->DidSendScreenRects();
2241 } 2241 }
2242 2242
2243 TextInputState WebContentsImpl::GetTextInputState() {
2244 if (GetOuterWebContents())
2245 return GetOuterWebContents()->GetTextInputState();
2246 // A RWHV should update WebContentsImpl in its destruction path so that that
Charlie Reis 2016/03/31 05:59:16 nit: s/that that/that its/
EhsanK 2016/04/01 00:59:17 Done.
2247 // state type is reset to none.
2248 DCHECK(!view_with_active_text_input_ &&
EhsanK 2016/04/01 00:59:17 Not sure if having a DCHECK like this a good pract
Charlie Reis 2016/04/01 21:24:09 Yes, seems like a good thing to have.
2249 text_input_state_.type != ui::TEXT_INPUT_TYPE_NONE);
Charlie Reis 2016/03/31 05:59:17 This doesn't look right-- it's saying that we'll c
EhsanK 2016/04/01 00:59:17 You are right. I keep forgetting DCHECK(false) cra
2250 return text_input_state_;
2251 }
2252
2253 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
2254 bool text_input_state_changed) {
2255 // If there is an outer WebContents, let it process this update.
2256 if (GetOuterWebContents()) {
2257 return GetOuterWebContents()->UpdateTextInputState(
2258 rwhv, text_input_state_changed);
2259 }
2260
2261 // If this RWHV has a text input type of NONE, then there is nothing to
2262 // report to the tab RWHV.
2263 if (view_with_active_text_input_.get() != rwhv &&
2264 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE)
2265 return;
2266
2267 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE)
2268 view_with_active_text_input_ = rwhv->GetWeakPtr();
2269 else
2270 view_with_active_text_input_.reset();
2271
2272 text_input_state_ = *rwhv->text_input_state();
2273
2274 // The top level RWHV should know about the change.
2275 RenderWidgetHostViewBase* tab_rwhv =
2276 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
2277 if (tab_rwhv)
2278 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed);
2279 }
2280
2243 BrowserAccessibilityManager* 2281 BrowserAccessibilityManager*
2244 WebContentsImpl::GetRootBrowserAccessibilityManager() { 2282 WebContentsImpl::GetRootBrowserAccessibilityManager() {
2245 RenderFrameHostImpl* rfh = GetMainFrame(); 2283 RenderFrameHostImpl* rfh = GetMainFrame();
2246 return rfh ? rfh->browser_accessibility_manager() : nullptr; 2284 return rfh ? rfh->browser_accessibility_manager() : nullptr;
2247 } 2285 }
2248 2286
2249 BrowserAccessibilityManager* 2287 BrowserAccessibilityManager*
2250 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { 2288 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
2251 RenderFrameHostImpl* rfh = GetMainFrame(); 2289 RenderFrameHostImpl* rfh = GetMainFrame();
2252 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; 2290 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr;
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 else 4874 else
4837 WasHidden(); 4875 WasHidden();
4838 } 4876 }
4839 4877
4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4878 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4841 JavaScriptDialogManager* dialog_manager) { 4879 JavaScriptDialogManager* dialog_manager) {
4842 dialog_manager_ = dialog_manager; 4880 dialog_manager_ = dialog_manager;
4843 } 4881 }
4844 4882
4845 } // namespace content 4883 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/text_input_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698