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

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

Issue 2808923003: Revert of Enable find-in-page across GuestViews. (Closed)
Patch Set: Fixed patch conflicts. Created 3 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
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // when there are no more references to this object. 250 // when there are no more references to this object.
251 ~AXTreeSnapshotCombiner() { 251 ~AXTreeSnapshotCombiner() {
252 combiner_.Combine(); 252 combiner_.Combine();
253 callback_.Run(combiner_.combined()); 253 callback_.Run(combiner_.combined());
254 } 254 }
255 255
256 ui::AXTreeCombiner combiner_; 256 ui::AXTreeCombiner combiner_;
257 AXTreeSnapshotCallback callback_; 257 AXTreeSnapshotCallback callback_;
258 }; 258 };
259 259
260 // Helper for GetInnerWebContents().
261 bool GetInnerWebContentsHelper(
262 std::vector<WebContentsImpl*>* all_guest_contents,
263 WebContents* guest_contents) {
264 all_guest_contents->push_back(static_cast<WebContentsImpl*>(guest_contents));
265 return false;
266 }
267
268 } // namespace 260 } // namespace
269 261
270 WebContents* WebContents::Create(const WebContents::CreateParams& params) { 262 WebContents* WebContents::Create(const WebContents::CreateParams& params) {
271 FrameTreeNode* opener_node = nullptr; 263 FrameTreeNode* opener_node = nullptr;
272 if (params.opener_render_frame_id != MSG_ROUTING_NONE) { 264 if (params.opener_render_frame_id != MSG_ROUTING_NONE) {
273 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( 265 RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID(
274 params.opener_render_process_id, params.opener_render_frame_id); 266 params.opener_render_process_id, params.opener_render_frame_id);
275 if (opener_rfh) 267 if (opener_rfh)
276 opener_node = opener_rfh->frame_tree_node(); 268 opener_node = opener_rfh->frame_tree_node();
277 } 269 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 WebContentsImpl* current_web_contents) 374 WebContentsImpl* current_web_contents)
383 : current_web_contents_(current_web_contents), 375 : current_web_contents_(current_web_contents),
384 outer_web_contents_(nullptr), 376 outer_web_contents_(nullptr),
385 outer_contents_frame_tree_node_id_( 377 outer_contents_frame_tree_node_id_(
386 FrameTreeNode::kFrameTreeNodeInvalidId), 378 FrameTreeNode::kFrameTreeNodeInvalidId),
387 focused_web_contents_(current_web_contents) {} 379 focused_web_contents_(current_web_contents) {}
388 380
389 WebContentsImpl::WebContentsTreeNode::~WebContentsTreeNode() { 381 WebContentsImpl::WebContentsTreeNode::~WebContentsTreeNode() {
390 if (OuterContentsFrameTreeNode()) 382 if (OuterContentsFrameTreeNode())
391 OuterContentsFrameTreeNode()->RemoveObserver(this); 383 OuterContentsFrameTreeNode()->RemoveObserver(this);
392
393 if (outer_web_contents_)
394 outer_web_contents_->node_.DetachInnerWebContents(current_web_contents_);
395 } 384 }
396 385
397 void WebContentsImpl::WebContentsTreeNode::ConnectToOuterWebContents( 386 void WebContentsImpl::WebContentsTreeNode::ConnectToOuterWebContents(
398 WebContentsImpl* outer_web_contents, 387 WebContentsImpl* outer_web_contents,
399 RenderFrameHostImpl* outer_contents_frame) { 388 RenderFrameHostImpl* outer_contents_frame) {
400 focused_web_contents_ = nullptr; 389 focused_web_contents_ = nullptr;
401 outer_web_contents_ = outer_web_contents; 390 outer_web_contents_ = outer_web_contents;
402 outer_contents_frame_tree_node_id_ = 391 outer_contents_frame_tree_node_id_ =
403 outer_contents_frame->frame_tree_node()->frame_tree_node_id(); 392 outer_contents_frame->frame_tree_node()->frame_tree_node_id();
404 393
405 outer_web_contents_->node_.AttachInnerWebContents(current_web_contents_);
406 outer_contents_frame->frame_tree_node()->AddObserver(this); 394 outer_contents_frame->frame_tree_node()->AddObserver(this);
407 } 395 }
408 396
409 void WebContentsImpl::WebContentsTreeNode::AttachInnerWebContents(
410 WebContentsImpl* inner_web_contents) {
411 inner_web_contents_.push_back(inner_web_contents);
412 }
413
414 void WebContentsImpl::WebContentsTreeNode::DetachInnerWebContents(
415 WebContentsImpl* inner_web_contents) {
416 DCHECK(std::find(inner_web_contents_.begin(), inner_web_contents_.end(),
417 inner_web_contents) != inner_web_contents_.end());
418 inner_web_contents_.erase(
419 std::remove(inner_web_contents_.begin(), inner_web_contents_.end(),
420 inner_web_contents),
421 inner_web_contents_.end());
422 }
423
424 FrameTreeNode* 397 FrameTreeNode*
425 WebContentsImpl::WebContentsTreeNode::OuterContentsFrameTreeNode() const { 398 WebContentsImpl::WebContentsTreeNode::OuterContentsFrameTreeNode() const {
426 return FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id_); 399 return FrameTreeNode::GloballyFindByID(outer_contents_frame_tree_node_id_);
427 } 400 }
428 401
429 void WebContentsImpl::WebContentsTreeNode::OnFrameTreeNodeDestroyed( 402 void WebContentsImpl::WebContentsTreeNode::OnFrameTreeNodeDestroyed(
430 FrameTreeNode* node) { 403 FrameTreeNode* node) {
431 DCHECK_EQ(outer_contents_frame_tree_node_id_, node->frame_tree_node_id()) 404 DCHECK_EQ(outer_contents_frame_tree_node_id_, node->frame_tree_node_id())
432 << "WebContentsTreeNode should only receive notifications for the " 405 << "WebContentsTreeNode should only receive notifications for the "
433 "FrameTreeNode in its outer WebContents that hosts it."; 406 "FrameTreeNode in its outer WebContents that hosts it.";
434 delete current_web_contents_; // deletes |this| too. 407 delete current_web_contents_; // deletes |this| too.
435 } 408 }
436 409
437 void WebContentsImpl::WebContentsTreeNode::SetFocusedWebContents( 410 void WebContentsImpl::WebContentsTreeNode::SetFocusedWebContents(
438 WebContentsImpl* web_contents) { 411 WebContentsImpl* web_contents) {
439 DCHECK(!outer_web_contents()) 412 DCHECK(!outer_web_contents())
440 << "Only the outermost WebContents tracks focus."; 413 << "Only the outermost WebContents tracks focus.";
441 focused_web_contents_ = web_contents; 414 focused_web_contents_ = web_contents;
442 } 415 }
443 416
444 WebContentsImpl*
445 WebContentsImpl::WebContentsTreeNode::GetInnerWebContentsInFrame(
446 const FrameTreeNode* frame) {
447 auto ftn_id = frame->frame_tree_node_id();
448 for (WebContentsImpl* contents : inner_web_contents_) {
449 if (contents->node_.outer_contents_frame_tree_node_id() == ftn_id) {
450 return contents;
451 }
452 }
453 return nullptr;
454 }
455
456 const std::vector<WebContentsImpl*>&
457 WebContentsImpl::WebContentsTreeNode::inner_web_contents() const {
458 return inner_web_contents_;
459 }
460
461 // WebContentsImpl ------------------------------------------------------------- 417 // WebContentsImpl -------------------------------------------------------------
462 418
463 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context) 419 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
464 : delegate_(NULL), 420 : delegate_(NULL),
465 controller_(this, browser_context), 421 controller_(this, browser_context),
466 render_view_host_delegate_view_(NULL), 422 render_view_host_delegate_view_(NULL),
467 created_with_opener_(false), 423 created_with_opener_(false),
468 frame_tree_(new NavigatorImpl(&controller_, this), 424 frame_tree_(new NavigatorImpl(&controller_, this),
469 this, 425 this,
470 this, 426 this,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 continue; 657 continue;
702 // Because a WebContents can only have one current RVH at a time, there will 658 // Because a WebContents can only have one current RVH at a time, there will
703 // be no duplicate WebContents here. 659 // be no duplicate WebContents here.
704 result.push_back(static_cast<WebContentsImpl*>(web_contents)); 660 result.push_back(static_cast<WebContentsImpl*>(web_contents));
705 } 661 }
706 return result; 662 return result;
707 } 663 }
708 664
709 // static 665 // static
710 WebContentsImpl* WebContentsImpl::FromFrameTreeNode( 666 WebContentsImpl* WebContentsImpl::FromFrameTreeNode(
711 const FrameTreeNode* frame_tree_node) { 667 FrameTreeNode* frame_tree_node) {
712 return static_cast<WebContentsImpl*>( 668 return static_cast<WebContentsImpl*>(
713 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host())); 669 WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host()));
714 } 670 }
715 671
716 // static 672 // static
717 WebContents* WebContentsImpl::FromRenderFrameHostID(int render_process_host_id, 673 WebContents* WebContentsImpl::FromRenderFrameHostID(int render_process_host_id,
718 int render_frame_host_id) { 674 int render_frame_host_id) {
719 DCHECK_CURRENTLY_ON(BrowserThread::UI); 675 DCHECK_CURRENTLY_ON(BrowserThread::UI);
720 RenderFrameHost* render_frame_host = 676 RenderFrameHost* render_frame_host =
721 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id); 677 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id);
722 if (!render_frame_host) 678 if (!render_frame_host)
723 return nullptr; 679 return nullptr;
724 680
725 return WebContents::FromRenderFrameHost(render_frame_host); 681 return WebContents::FromRenderFrameHost(render_frame_host);
726 } 682 }
727 683
728 // static
729 WebContentsImpl* WebContentsImpl::FromOuterFrameTreeNode(
730 const FrameTreeNode* frame_tree_node) {
731 return WebContentsImpl::FromFrameTreeNode(frame_tree_node)
732 ->node_.GetInnerWebContentsInFrame(frame_tree_node);
733 }
734
735 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { 684 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() {
736 return GetRenderManager(); 685 return GetRenderManager();
737 } 686 }
738 687
739 bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host, 688 bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host,
740 const IPC::Message& message) { 689 const IPC::Message& message) {
741 RenderFrameHost* main_frame = render_view_host->GetMainFrame(); 690 RenderFrameHost* main_frame = render_view_host->GetMainFrame();
742 if (main_frame) { 691 if (main_frame) {
743 WebUIImpl* web_ui = static_cast<RenderFrameHostImpl*>(main_frame)->web_ui(); 692 WebUIImpl* web_ui = static_cast<RenderFrameHostImpl*>(main_frame)->web_ui();
744 if (web_ui && web_ui->OnMessageReceived(message)) 693 if (web_ui && web_ui->OnMessageReceived(message))
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 } 1031 }
1083 1032
1084 WebContentsBindingSet* WebContentsImpl::GetBindingSet( 1033 WebContentsBindingSet* WebContentsImpl::GetBindingSet(
1085 const std::string& interface_name) { 1034 const std::string& interface_name) {
1086 auto it = binding_sets_.find(interface_name); 1035 auto it = binding_sets_.find(interface_name);
1087 if (it == binding_sets_.end()) 1036 if (it == binding_sets_.end())
1088 return nullptr; 1037 return nullptr;
1089 return it->second; 1038 return it->second;
1090 } 1039 }
1091 1040
1092 std::vector<WebContentsImpl*> WebContentsImpl::GetInnerWebContents() {
1093 if (browser_plugin_embedder_) {
1094 std::vector<WebContentsImpl*> inner_contents;
1095 GetBrowserContext()->GetGuestManager()->ForEachGuest(
1096 this, base::Bind(&GetInnerWebContentsHelper, &inner_contents));
1097 return inner_contents;
1098 }
1099
1100 return node_.inner_web_contents();
1101 }
1102
1103 std::vector<WebContentsImpl*> WebContentsImpl::GetWebContentsAndAllInner() {
1104 std::vector<WebContentsImpl*> all_contents(1, this);
1105
1106 for (size_t i = 0; i != all_contents.size(); ++i) {
1107 for (auto* inner_contents : all_contents[i]->GetInnerWebContents()) {
1108 all_contents.push_back(inner_contents);
1109 }
1110 }
1111
1112 return all_contents;
1113 }
1114
1115 void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) { 1041 void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) {
1116 SendPageMessage( 1042 SendPageMessage(
1117 new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor)); 1043 new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor));
1118 } 1044 }
1119 1045
1120 void WebContentsImpl::GetScreenInfo(ScreenInfo* screen_info) { 1046 void WebContentsImpl::GetScreenInfo(ScreenInfo* screen_info) {
1121 if (GetView()) 1047 if (GetView())
1122 GetView()->GetScreenInfo(screen_info); 1048 GetView()->GetScreenInfo(screen_info);
1123 } 1049 }
1124 1050
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost( 1844 RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
1919 RenderWidgetHostImpl* receiving_widget) { 1845 RenderWidgetHostImpl* receiving_widget) {
1920 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) 1846 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
1921 return receiving_widget; 1847 return receiving_widget;
1922 1848
1923 // Events for widgets other than the main frame (e.g., popup menus) should be 1849 // Events for widgets other than the main frame (e.g., popup menus) should be
1924 // forwarded directly to the widget they arrived on. 1850 // forwarded directly to the widget they arrived on.
1925 if (receiving_widget != GetMainFrame()->GetRenderWidgetHost()) 1851 if (receiving_widget != GetMainFrame()->GetRenderWidgetHost())
1926 return receiving_widget; 1852 return receiving_widget;
1927 1853
1928 // If the focused WebContents is a guest WebContents, then get the focused 1854 FrameTreeNode* focused_frame =
1929 // frame in the embedder WebContents instead. 1855 GetFocusedWebContents()->frame_tree_.GetFocusedFrame();
1930 FrameTreeNode* focused_frame = nullptr;
1931 WebContentsImpl* focused_contents = GetFocusedWebContents();
1932 if (focused_contents->browser_plugin_guest_ &&
1933 !GuestMode::IsCrossProcessFrameGuest(focused_contents)) {
1934 focused_frame = frame_tree_.GetFocusedFrame();
1935 } else {
1936 focused_frame = GetFocusedWebContents()->frame_tree_.GetFocusedFrame();
1937 }
1938 if (!focused_frame) 1856 if (!focused_frame)
1939 return receiving_widget; 1857 return receiving_widget;
1940 1858
1941 // The view may be null if a subframe's renderer process has crashed while 1859 // The view may be null if a subframe's renderer process has crashed while
1942 // the subframe has focus. Drop the event in that case. Do not give 1860 // the subframe has focus. Drop the event in that case. Do not give
1943 // it to the main frame, so that the user doesn't unexpectedly type into the 1861 // it to the main frame, so that the user doesn't unexpectedly type into the
1944 // wrong frame if a focused subframe renderer crashes while they type. 1862 // wrong frame if a focused subframe renderer crashes while they type.
1945 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); 1863 RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView();
1946 if (!view) 1864 if (!view)
1947 return nullptr; 1865 return nullptr;
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 3271
3354 void WebContentsImpl::Find(int request_id, 3272 void WebContentsImpl::Find(int request_id,
3355 const base::string16& search_text, 3273 const base::string16& search_text,
3356 const blink::WebFindOptions& options) { 3274 const blink::WebFindOptions& options) {
3357 // Cowardly refuse to search for no text. 3275 // Cowardly refuse to search for no text.
3358 if (search_text.empty()) { 3276 if (search_text.empty()) {
3359 NOTREACHED(); 3277 NOTREACHED();
3360 return; 3278 return;
3361 } 3279 }
3362 3280
3281 // See if a top level browser plugin handles the find request first.
3282 // TODO(paulmeyer): Remove this after find-in-page works across GuestViews.
3283 if (browser_plugin_embedder_ &&
3284 browser_plugin_embedder_->Find(request_id, search_text, options)) {
3285 return;
3286 }
3287
3363 GetOrCreateFindRequestManager()->Find(request_id, search_text, options); 3288 GetOrCreateFindRequestManager()->Find(request_id, search_text, options);
3364 } 3289 }
3365 3290
3366 void WebContentsImpl::StopFinding(StopFindAction action) { 3291 void WebContentsImpl::StopFinding(StopFindAction action) {
3367 if (FindRequestManager* manager = GetFindRequestManager()) 3292 // See if a top level browser plugin handles the stop finding request first.
3368 manager->StopFinding(action); 3293 // TODO(paulmeyer): Remove this after find-in-page works across GuestViews.
3294 if (browser_plugin_embedder_ &&
3295 browser_plugin_embedder_->StopFinding(action)) {
3296 return;
3297 }
3298
3299 GetOrCreateFindRequestManager()->StopFinding(action);
3369 } 3300 }
3370 3301
3371 bool WebContentsImpl::WasRecentlyAudible() { 3302 bool WebContentsImpl::WasRecentlyAudible() {
3372 return audio_stream_monitor_.WasRecentlyAudible() || 3303 return audio_stream_monitor_.WasRecentlyAudible() ||
3373 (browser_plugin_embedder_ && 3304 (browser_plugin_embedder_ &&
3374 browser_plugin_embedder_->WereAnyGuestsRecentlyAudible()); 3305 browser_plugin_embedder_->WereAnyGuestsRecentlyAudible());
3375 } 3306 }
3376 3307
3377 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { 3308 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) {
3378 manifest_manager_host_->GetManifest(GetMainFrame(), callback); 3309 manifest_manager_host_->GetManifest(GetMainFrame(), callback);
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after
4838 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true); 4769 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
4839 GetOutermostWebContents()->node_.SetFocusedWebContents(this); 4770 GetOutermostWebContents()->node_.SetFocusedWebContents(this);
4840 } 4771 }
4841 4772
4842 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node, 4773 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
4843 SiteInstance* source) { 4774 SiteInstance* source) {
4844 // The PDF plugin still runs as a BrowserPlugin and must go through the 4775 // The PDF plugin still runs as a BrowserPlugin and must go through the
4845 // input redirection mechanism. It must not become focused direcly. 4776 // input redirection mechanism. It must not become focused direcly.
4846 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) { 4777 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) {
4847 frame_tree_.SetFocusedFrame(node, source); 4778 frame_tree_.SetFocusedFrame(node, source);
4848 if (GetFocusedWebContents() != this)
4849 GetOutermostWebContents()->node_.SetFocusedWebContents(this);
4850 return; 4779 return;
4851 } 4780 }
4852 4781
4853 SetAsFocusedWebContentsIfNecessary(); 4782 SetAsFocusedWebContentsIfNecessary();
4854 4783
4855 frame_tree_.SetFocusedFrame(node, source); 4784 frame_tree_.SetFocusedFrame(node, source);
4856 } 4785 }
4857 4786
4858 void WebContentsImpl::OnFocusedElementChangedInFrame( 4787 void WebContentsImpl::OnFocusedElementChangedInFrame(
4859 RenderFrameHostImpl* frame, 4788 RenderFrameHostImpl* frame,
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5287 ->CreateWebUIControllerForURL(web_ui.get(), url); 5216 ->CreateWebUIControllerForURL(web_ui.get(), url);
5288 if (controller) { 5217 if (controller) {
5289 web_ui->AddMessageHandler(base::MakeUnique<GenericHandler>()); 5218 web_ui->AddMessageHandler(base::MakeUnique<GenericHandler>());
5290 web_ui->SetController(controller); 5219 web_ui->SetController(controller);
5291 return web_ui; 5220 return web_ui;
5292 } 5221 }
5293 5222
5294 return nullptr; 5223 return nullptr;
5295 } 5224 }
5296 5225
5297 FindRequestManager* WebContentsImpl::GetFindRequestManager() {
5298 for (WebContentsImpl* contents = this; contents;
5299 contents = contents->GetOuterWebContents()) {
5300 if (contents->find_request_manager_)
5301 return contents->find_request_manager_.get();
5302 }
5303
5304 return nullptr;
5305 }
5306
5307 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() { 5226 FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() {
5308 if (FindRequestManager* manager = GetFindRequestManager()) 5227 // TODO(paulmeyer): This method will need to access (or potentially create)
5309 return manager; 5228 // the FindRequestManager in the outermost WebContents once find-in-page
5310 5229 // across GuestViews is implemented.
5311 // No existing FindRequestManager found, so one must be created. 5230 if (!find_request_manager_)
5312 find_request_manager_.reset(new FindRequestManager(this)); 5231 find_request_manager_.reset(new FindRequestManager(this));
5313
5314 // Concurrent find sessions must not overlap, so destroy any existing
5315 // FindRequestManagers in any inner WebContentses.
5316 for (WebContentsImpl* contents : GetWebContentsAndAllInner()) {
5317 if (contents == this)
5318 continue;
5319 if (contents->find_request_manager_) {
5320 contents->find_request_manager_->StopFinding(
5321 content::STOP_FIND_ACTION_CLEAR_SELECTION);
5322 contents->find_request_manager_.release();
5323 }
5324 }
5325 5232
5326 return find_request_manager_.get(); 5233 return find_request_manager_.get();
5327 } 5234 }
5328 5235
5329 void WebContentsImpl::NotifyFindReply(int request_id, 5236 void WebContentsImpl::NotifyFindReply(int request_id,
5330 int number_of_matches, 5237 int number_of_matches,
5331 const gfx::Rect& selection_rect, 5238 const gfx::Rect& selection_rect,
5332 int active_match_ordinal, 5239 int active_match_ordinal,
5333 bool final_update) { 5240 bool final_update) {
5334 if (delegate_ && !is_being_destroyed_) { 5241 if (delegate_ && !is_being_destroyed_) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5366 5273
5367 void WebContentsImpl::SetHasPersistentVideo(bool has_persistent_video) { 5274 void WebContentsImpl::SetHasPersistentVideo(bool has_persistent_video) {
5368 if (has_persistent_video_ == has_persistent_video) 5275 if (has_persistent_video_ == has_persistent_video)
5369 return; 5276 return;
5370 5277
5371 has_persistent_video_ = has_persistent_video; 5278 has_persistent_video_ = has_persistent_video;
5372 NotifyPreferencesChanged(); 5279 NotifyPreferencesChanged();
5373 media_web_contents_observer()->RequestPersistentVideo(has_persistent_video); 5280 media_web_contents_observer()->RequestPersistentVideo(has_persistent_video);
5374 } 5281 }
5375 5282
5376 void WebContentsImpl::BrowserPluginGuestWillDestroy() {
5377 WebContentsImpl* outermost = GetOutermostWebContents();
5378 if (this != outermost && ContainsOrIsFocusedWebContents())
5379 outermost->SetAsFocusedWebContentsIfNecessary();
5380 }
5381
5382 #if defined(OS_ANDROID) 5283 #if defined(OS_ANDROID)
5383 void WebContentsImpl::NotifyFindMatchRectsReply( 5284 void WebContentsImpl::NotifyFindMatchRectsReply(
5384 int version, 5285 int version,
5385 const std::vector<gfx::RectF>& rects, 5286 const std::vector<gfx::RectF>& rects,
5386 const gfx::RectF& active_rect) { 5287 const gfx::RectF& active_rect) {
5387 if (delegate_) 5288 if (delegate_)
5388 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 5289 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
5389 } 5290 }
5390 #endif 5291 #endif
5391 5292
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5519 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5420 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5520 if (!render_view_host) 5421 if (!render_view_host)
5521 continue; 5422 continue;
5522 render_view_host_set.insert(render_view_host); 5423 render_view_host_set.insert(render_view_host);
5523 } 5424 }
5524 for (RenderViewHost* render_view_host : render_view_host_set) 5425 for (RenderViewHost* render_view_host : render_view_host_set)
5525 render_view_host->OnWebkitPreferencesChanged(); 5426 render_view_host->OnWebkitPreferencesChanged();
5526 } 5427 }
5527 5428
5528 } // namespace content 5429 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/browser_plugin_guest_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698