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

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

Issue 2310563002: Adds routed interface support between RenderFrameHost and RenderFrame (Closed)
Patch Set: nit Created 4 years, 3 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/child/child_thread_impl.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 #include "content/public/browser/navigation_details.h" 97 #include "content/public/browser/navigation_details.h"
98 #include "content/public/browser/notification_details.h" 98 #include "content/public/browser/notification_details.h"
99 #include "content/public/browser/notification_service.h" 99 #include "content/public/browser/notification_service.h"
100 #include "content/public/browser/notification_types.h" 100 #include "content/public/browser/notification_types.h"
101 #include "content/public/browser/render_widget_host_iterator.h" 101 #include "content/public/browser/render_widget_host_iterator.h"
102 #include "content/public/browser/resource_request_details.h" 102 #include "content/public/browser/resource_request_details.h"
103 #include "content/public/browser/screen_orientation_dispatcher_host.h" 103 #include "content/public/browser/screen_orientation_dispatcher_host.h"
104 #include "content/public/browser/security_style_explanations.h" 104 #include "content/public/browser/security_style_explanations.h"
105 #include "content/public/browser/storage_partition.h" 105 #include "content/public/browser/storage_partition.h"
106 #include "content/public/browser/user_metrics.h" 106 #include "content/public/browser/user_metrics.h"
107 #include "content/public/browser/web_contents_binding_set.h"
107 #include "content/public/browser/web_contents_delegate.h" 108 #include "content/public/browser/web_contents_delegate.h"
108 #include "content/public/common/bindings_policy.h" 109 #include "content/public/common/bindings_policy.h"
109 #include "content/public/common/browser_plugin_guest_mode.h" 110 #include "content/public/common/browser_plugin_guest_mode.h"
110 #include "content/public/common/browser_side_navigation_policy.h" 111 #include "content/public/common/browser_side_navigation_policy.h"
111 #include "content/public/common/child_process_host.h" 112 #include "content/public/common/child_process_host.h"
112 #include "content/public/common/content_constants.h" 113 #include "content/public/common/content_constants.h"
113 #include "content/public/common/content_switches.h" 114 #include "content/public/common/content_switches.h"
114 #include "content/public/common/page_zoom.h" 115 #include "content/public/common/page_zoom.h"
115 #include "content/public/common/result_codes.h" 116 #include "content/public/common/result_codes.h"
116 #include "content/public/common/url_constants.h" 117 #include "content/public/common/url_constants.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 #endif 453 #endif
453 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this)); 454 loader_io_thread_notifier_.reset(new LoaderIOThreadNotifier(this));
454 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); 455 wake_lock_service_context_.reset(new WakeLockServiceContext(this));
455 } 456 }
456 457
457 WebContentsImpl::~WebContentsImpl() { 458 WebContentsImpl::~WebContentsImpl() {
458 is_being_destroyed_ = true; 459 is_being_destroyed_ = true;
459 460
460 rwh_input_event_router_.reset(); 461 rwh_input_event_router_.reset();
461 462
463 for (auto& entry : binding_sets_)
464 entry.second->CloseAllBindings();
465
462 WebContentsImpl* outermost = GetOutermostWebContents(); 466 WebContentsImpl* outermost = GetOutermostWebContents();
463 if (GetFocusedWebContents() == this && this != outermost) { 467 if (GetFocusedWebContents() == this && this != outermost) {
464 // If the current WebContents is in focus, unset it. 468 // If the current WebContents is in focus, unset it.
465 outermost->node_->SetFocusedWebContents(outermost); 469 outermost->node_->SetFocusedWebContents(outermost);
466 } 470 }
467 471
468 for (FrameTreeNode* node : frame_tree_.Nodes()) { 472 for (FrameTreeNode* node : frame_tree_.Nodes()) {
469 // Delete all RFHs pending shutdown, which will lead the corresponding RVHs 473 // Delete all RFHs pending shutdown, which will lead the corresponding RVHs
470 // to be shutdown and be deleted as well. 474 // to be shutdown and be deleted as well.
471 node->render_manager()->ClearRFHsPendingShutdown(); 475 node->render_manager()->ClearRFHsPendingShutdown();
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 983
980 GURL url = HostZoomMap::GetURLFromEntry(entry); 984 GURL url = HostZoomMap::GetURLFromEntry(entry);
981 if (host != net::GetHostOrSpecFromURL(url) || 985 if (host != net::GetHostOrSpecFromURL(url) ||
982 (!scheme.empty() && !url.SchemeIs(scheme))) { 986 (!scheme.empty() && !url.SchemeIs(scheme))) {
983 return; 987 return;
984 } 988 }
985 989
986 UpdateZoom(level); 990 UpdateZoom(level);
987 } 991 }
988 992
993 base::Closure WebContentsImpl::AddBindingSet(
994 const std::string& interface_name,
995 WebContentsBindingSet* binding_set) {
996 auto result =
997 binding_sets_.insert(std::make_pair(interface_name, binding_set));
998 DCHECK(result.second);
999 return base::Bind(&WebContentsImpl::RemoveBindingSet,
1000 weak_factory_.GetWeakPtr(), interface_name);
1001 }
1002
989 void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) { 1003 void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) {
990 SendPageMessage( 1004 SendPageMessage(
991 new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor)); 1005 new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor));
992 } 1006 }
993 1007
994 void WebContentsImpl::GetScreenInfo(ScreenInfo* screen_info) { 1008 void WebContentsImpl::GetScreenInfo(ScreenInfo* screen_info) {
995 if (GetView()) 1009 if (GetView())
996 GetView()->GetScreenInfo(screen_info); 1010 GetView()->GetScreenInfo(screen_info);
997 } 1011 }
998 1012
(...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 const LoadCommittedDetails& load_details) { 4047 const LoadCommittedDetails& load_details) {
4034 FOR_EACH_OBSERVER( 4048 FOR_EACH_OBSERVER(
4035 WebContentsObserver, observers_, NavigationEntryCommitted(load_details)); 4049 WebContentsObserver, observers_, NavigationEntryCommitted(load_details));
4036 } 4050 }
4037 4051
4038 bool WebContentsImpl::OnMessageReceived(RenderFrameHost* render_frame_host, 4052 bool WebContentsImpl::OnMessageReceived(RenderFrameHost* render_frame_host,
4039 const IPC::Message& message) { 4053 const IPC::Message& message) {
4040 return OnMessageReceived(NULL, render_frame_host, message); 4054 return OnMessageReceived(NULL, render_frame_host, message);
4041 } 4055 }
4042 4056
4057 void WebContentsImpl::OnAssociatedInterfaceRequest(
4058 RenderFrameHost* render_frame_host,
4059 const std::string& interface_name,
4060 mojo::ScopedInterfaceEndpointHandle handle) {
4061 auto it = binding_sets_.find(interface_name);
4062 if (it != binding_sets_.end())
4063 it->second->OnRequestForFrame(render_frame_host, std::move(handle));
4064 }
4065
4043 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { 4066 const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const {
4044 return GetLastCommittedURL(); 4067 return GetLastCommittedURL();
4045 } 4068 }
4046 4069
4047 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { 4070 void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) {
4048 FOR_EACH_OBSERVER(WebContentsObserver, 4071 FOR_EACH_OBSERVER(WebContentsObserver,
4049 observers_, 4072 observers_,
4050 RenderFrameCreated(render_frame_host)); 4073 RenderFrameCreated(render_frame_host));
4051 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); 4074 SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host);
4052 4075
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
5202 } 5225 }
5203 for (RenderViewHost* render_view_host : render_view_host_set) 5226 for (RenderViewHost* render_view_host : render_view_host_set)
5204 render_view_host->OnWebkitPreferencesChanged(); 5227 render_view_host->OnWebkitPreferencesChanged();
5205 } 5228 }
5206 5229
5207 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5230 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5208 JavaScriptDialogManager* dialog_manager) { 5231 JavaScriptDialogManager* dialog_manager) {
5209 dialog_manager_ = dialog_manager; 5232 dialog_manager_ = dialog_manager;
5210 } 5233 }
5211 5234
5235 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5236 auto it = binding_sets_.find(interface_name);
5237 if (it != binding_sets_.end())
5238 binding_sets_.erase(it);
5239 }
5240
5212 } // namespace content 5241 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698