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

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: Merged 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "content/browser/webui/generic_handler.h" 70 #include "content/browser/webui/generic_handler.h"
71 #include "content/browser/webui/web_ui_controller_factory_registry.h" 71 #include "content/browser/webui/web_ui_controller_factory_registry.h"
72 #include "content/browser/webui/web_ui_impl.h" 72 #include "content/browser/webui/web_ui_impl.h"
73 #include "content/common/browser_plugin/browser_plugin_constants.h" 73 #include "content/common/browser_plugin/browser_plugin_constants.h"
74 #include "content/common/browser_plugin/browser_plugin_messages.h" 74 #include "content/common/browser_plugin/browser_plugin_messages.h"
75 #include "content/common/frame_messages.h" 75 #include "content/common/frame_messages.h"
76 #include "content/common/input_messages.h" 76 #include "content/common/input_messages.h"
77 #include "content/common/page_messages.h" 77 #include "content/common/page_messages.h"
78 #include "content/common/site_isolation_policy.h" 78 #include "content/common/site_isolation_policy.h"
79 #include "content/common/ssl_status_serialization.h" 79 #include "content/common/ssl_status_serialization.h"
80 #include "content/common/text_input_state.h"
80 #include "content/common/view_messages.h" 81 #include "content/common/view_messages.h"
81 #include "content/public/browser/ax_event_notification_details.h" 82 #include "content/public/browser/ax_event_notification_details.h"
82 #include "content/public/browser/browser_context.h" 83 #include "content/public/browser/browser_context.h"
83 #include "content/public/browser/browser_plugin_guest_manager.h" 84 #include "content/public/browser/browser_plugin_guest_manager.h"
84 #include "content/public/browser/content_browser_client.h" 85 #include "content/public/browser/content_browser_client.h"
85 #include "content/public/browser/devtools_agent_host.h" 86 #include "content/public/browser/devtools_agent_host.h"
86 #include "content/public/browser/download_manager.h" 87 #include "content/public/browser/download_manager.h"
87 #include "content/public/browser/download_url_parameters.h" 88 #include "content/public/browser/download_url_parameters.h"
88 #include "content/public/browser/invalidate_type.h" 89 #include "content/public/browser/invalidate_type.h"
89 #include "content/public/browser/javascript_dialog_manager.h" 90 #include "content/public/browser/javascript_dialog_manager.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 is_subframe_(false), 355 is_subframe_(false),
355 force_disable_overscroll_content_(false), 356 force_disable_overscroll_content_(false),
356 last_dialog_suppressed_(false), 357 last_dialog_suppressed_(false),
357 geolocation_service_context_(new GeolocationServiceContext()), 358 geolocation_service_context_(new GeolocationServiceContext()),
358 accessibility_mode_( 359 accessibility_mode_(
359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), 360 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()),
360 audio_stream_monitor_(this), 361 audio_stream_monitor_(this),
361 bluetooth_device_connected_(false), 362 bluetooth_device_connected_(false),
362 virtual_keyboard_requested_(false), 363 virtual_keyboard_requested_(false),
363 page_scale_factor_is_one_(true), 364 page_scale_factor_is_one_(true),
365 text_input_state_(new TextInputState()),
364 loading_weak_factory_(this), 366 loading_weak_factory_(this),
365 weak_factory_(this) { 367 weak_factory_(this) {
366 frame_tree_.SetFrameRemoveListener( 368 frame_tree_.SetFrameRemoveListener(
367 base::Bind(&WebContentsImpl::OnFrameRemoved, 369 base::Bind(&WebContentsImpl::OnFrameRemoved,
368 base::Unretained(this))); 370 base::Unretained(this)));
369 #if defined(OS_ANDROID) 371 #if defined(OS_ANDROID)
370 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); 372 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this));
371 #else 373 #else
372 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 374 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
373 #endif 375 #endif
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); 2239 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
2238 if (rwhv) { 2240 if (rwhv) {
2239 SendPageMessage(new PageMsg_UpdateWindowScreenRect( 2241 SendPageMessage(new PageMsg_UpdateWindowScreenRect(
2240 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); 2242 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow()));
2241 } 2243 }
2242 2244
2243 if (browser_plugin_embedder_) 2245 if (browser_plugin_embedder_)
2244 browser_plugin_embedder_->DidSendScreenRects(); 2246 browser_plugin_embedder_->DidSendScreenRects();
2245 } 2247 }
2246 2248
2249 const TextInputState* WebContentsImpl::GetTextInputState() {
2250 if (GetOuterWebContents())
2251 return GetOuterWebContents()->GetTextInputState();
2252 // A RWHV should update WebContentsImpl in its destruction path so that state
2253 // type is reset to none.
2254 DCHECK(view_with_active_text_input_ ||
2255 text_input_state_->type == ui::TEXT_INPUT_TYPE_NONE);
2256 return text_input_state_.get();
2257 }
2258
2259 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
2260 bool text_input_state_changed) {
2261 // If there is an outer WebContents, let it process this update.
2262 if (GetOuterWebContents()) {
2263 return GetOuterWebContents()->UpdateTextInputState(
2264 rwhv, text_input_state_changed);
2265 }
2266
2267 // If this RWHV has a text input type of NONE, then there is nothing to
2268 // report to the tab RWHV.
2269 if (view_with_active_text_input_.get() != rwhv &&
2270 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE)
2271 return;
2272
2273 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE)
2274 view_with_active_text_input_ = rwhv->GetWeakPtr();
2275 else
2276 view_with_active_text_input_.reset();
2277
2278 *text_input_state_ = *rwhv->text_input_state();
2279
2280 // The top level RWHV should know about the change.
2281 RenderWidgetHostViewBase* tab_rwhv =
2282 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
2283 if (tab_rwhv)
2284 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed);
2285 }
2286
2247 BrowserAccessibilityManager* 2287 BrowserAccessibilityManager*
2248 WebContentsImpl::GetRootBrowserAccessibilityManager() { 2288 WebContentsImpl::GetRootBrowserAccessibilityManager() {
2249 RenderFrameHostImpl* rfh = GetMainFrame(); 2289 RenderFrameHostImpl* rfh = GetMainFrame();
2250 return rfh ? rfh->browser_accessibility_manager() : nullptr; 2290 return rfh ? rfh->browser_accessibility_manager() : nullptr;
2251 } 2291 }
2252 2292
2253 BrowserAccessibilityManager* 2293 BrowserAccessibilityManager*
2254 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { 2294 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
2255 RenderFrameHostImpl* rfh = GetMainFrame(); 2295 RenderFrameHostImpl* rfh = GetMainFrame();
2256 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; 2296 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr;
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4838 else 4878 else
4839 WasHidden(); 4879 WasHidden();
4840 } 4880 }
4841 4881
4842 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4882 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4843 JavaScriptDialogManager* dialog_manager) { 4883 JavaScriptDialogManager* dialog_manager) {
4844 dialog_manager_ = dialog_manager; 4884 dialog_manager_ = dialog_manager;
4845 } 4885 }
4846 4886
4847 } // namespace content 4887 } // 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