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

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

Issue 10377170: Browser Plugin: browser process side changes (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated according to creis@ Created 8 years, 7 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 | Annotate | Revision Log
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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/metrics/stats_counters.h" 11 #include "base/metrics/stats_counters.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "content/browser/browser_plugin/browser_plugin_host.h"
17 #include "content/browser/child_process_security_policy_impl.h" 18 #include "content/browser/child_process_security_policy_impl.h"
18 #include "content/browser/debugger/devtools_manager_impl.h" 19 #include "content/browser/debugger/devtools_manager_impl.h"
19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 20 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
20 #include "content/browser/download/download_stats.h" 21 #include "content/browser/download/download_stats.h"
21 #include "content/browser/download/mhtml_generation_manager.h" 22 #include "content/browser/download/mhtml_generation_manager.h"
22 #include "content/browser/download/save_package.h" 23 #include "content/browser/download/save_package.h"
23 #include "content/browser/gpu/gpu_data_manager_impl.h" 24 #include "content/browser/gpu/gpu_data_manager_impl.h"
24 #include "content/browser/gpu/gpu_process_host.h" 25 #include "content/browser/gpu/gpu_process_host.h"
25 #include "content/browser/host_zoom_map_impl.h" 26 #include "content/browser/host_zoom_map_impl.h"
26 #include "content/browser/intents/web_intents_dispatcher_impl.h" 27 #include "content/browser/intents/web_intents_dispatcher_impl.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // Listen for whether our opener gets destroyed. 314 // Listen for whether our opener gets destroyed.
314 if (opener_) { 315 if (opener_) {
315 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 316 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
316 content::Source<WebContents>(opener_)); 317 content::Source<WebContents>(opener_));
317 } 318 }
318 319
319 #if defined(ENABLE_JAVA_BRIDGE) 320 #if defined(ENABLE_JAVA_BRIDGE)
320 java_bridge_dispatcher_host_manager_.reset( 321 java_bridge_dispatcher_host_manager_.reset(
321 new JavaBridgeDispatcherHostManager(this)); 322 new JavaBridgeDispatcherHostManager(this));
322 #endif 323 #endif
324
325 browser_plugin_host_.reset(new content::BrowserPluginHost(this));
323 } 326 }
324 327
325 WebContentsImpl::~WebContentsImpl() { 328 WebContentsImpl::~WebContentsImpl() {
326 is_being_destroyed_ = true; 329 is_being_destroyed_ = true;
327 330
328 // Clear out any JavaScript state. 331 // Clear out any JavaScript state.
329 if (dialog_creator_) 332 if (dialog_creator_)
330 dialog_creator_->ResetJavaScriptState(this); 333 dialog_creator_->ResetJavaScriptState(this);
331 334
332 if (color_chooser_) 335 if (color_chooser_)
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } else { 1076 } else {
1074 GotResponseToLockMouseRequest(false); 1077 GotResponseToLockMouseRequest(false);
1075 } 1078 }
1076 } 1079 }
1077 1080
1078 void WebContentsImpl::LostMouseLock() { 1081 void WebContentsImpl::LostMouseLock() {
1079 if (delegate_) 1082 if (delegate_)
1080 delegate_->LostMouseLock(); 1083 delegate_->LostMouseLock();
1081 } 1084 }
1082 1085
1086 void WebContentsImpl::ConnectEmbedderToChannel(
1087 content::RenderViewHost* render_view_host,
1088 const IPC::ChannelHandle& channel_handle) {
1089 browser_plugin_host()->ConnectEmbedderToChannel(
1090 render_view_host,
1091 channel_handle);
1092 }
1093
1094 void WebContentsImpl::NavigateGuestFromEmbedder(
1095 content::RenderViewHost* render_view_host,
1096 int container_instance_id,
1097 long long frame_id,
1098 const std::string& src,
1099 const gfx::Size& size) {
1100 browser_plugin_host()->NavigateGuestFromEmbedder(render_view_host,
1101 container_instance_id,
1102 frame_id,
1103 src,
1104 size);
1105 }
1106
1083 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { 1107 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) {
1084 preferred_size_ = pref_size; 1108 preferred_size_ = pref_size;
1085 if (delegate_) 1109 if (delegate_)
1086 delegate_->UpdatePreferredSize(this, pref_size); 1110 delegate_->UpdatePreferredSize(this, pref_size);
1087 } 1111 }
1088 1112
1089 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { 1113 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) {
1090 if (delegate_) 1114 if (delegate_)
1091 delegate_->ResizeDueToAutoResize(this, new_size); 1115 delegate_->ResizeDueToAutoResize(this, new_size);
1092 } 1116 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 content::GetContentClient()->SetActiveURL(entry.GetURL()); 1163 content::GetContentClient()->SetActiveURL(entry.GetURL());
1140 CHECK(0); 1164 CHECK(0);
1141 } 1165 }
1142 1166
1143 // Tell DevTools agent that it is attached prior to the navigation. 1167 // Tell DevTools agent that it is attached prior to the navigation.
1144 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry( 1168 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry(
1145 GetRenderViewHost(), 1169 GetRenderViewHost(),
1146 dest_render_view_host, 1170 dest_render_view_host,
1147 entry.GetURL()); 1171 entry.GetURL());
1148 1172
1173 // Tell BrowserPluginHost about the pending cross-process navigation.
1174 browser_plugin_host()->OnPendingNavigation(dest_render_view_host);
1175
1149 // Used for page load time metrics. 1176 // Used for page load time metrics.
1150 current_load_start_ = base::TimeTicks::Now(); 1177 current_load_start_ = base::TimeTicks::Now();
1151 1178
1152 // Navigate in the desired RenderViewHost. 1179 // Navigate in the desired RenderViewHost.
1153 ViewMsg_Navigate_Params navigate_params; 1180 ViewMsg_Navigate_Params navigate_params;
1154 MakeNavigateParams(entry, controller_, delegate_, reload_type, 1181 MakeNavigateParams(entry, controller_, delegate_, reload_type,
1155 &navigate_params); 1182 &navigate_params);
1156 dest_render_view_host->Navigate(navigate_params); 1183 dest_render_view_host->Navigate(navigate_params);
1157 1184
1158 if (entry.GetPageID() == -1) { 1185 if (entry.GetPageID() == -1) {
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 2750
2724 // Now that the RenderView has been created, we need to tell it its size. 2751 // Now that the RenderView has been created, we need to tell it its size.
2725 if (rwh_view) 2752 if (rwh_view)
2726 rwh_view->SetSize(view_->GetContainerSize()); 2753 rwh_view->SetSize(view_->GetContainerSize());
2727 2754
2728 // Make sure we use the correct starting page_id in the new RenderView. 2755 // Make sure we use the correct starting page_id in the new RenderView.
2729 UpdateMaxPageIDIfNecessary(render_view_host); 2756 UpdateMaxPageIDIfNecessary(render_view_host);
2730 int32 max_page_id = 2757 int32 max_page_id =
2731 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 2758 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
2732 2759
2760 content::RenderProcessHost* embedder_render_process_host =
2761 browser_plugin_host()->embedder_render_process_host();
2762 int embedder_process_id =
2763 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
2733 if (!static_cast<RenderViewHostImpl*>( 2764 if (!static_cast<RenderViewHostImpl*>(
2734 render_view_host)->CreateRenderView(string16(), 2765 render_view_host)->CreateRenderView(string16(),
2735 opener_route_id, 2766 opener_route_id,
2736 max_page_id, 2767 max_page_id,
2737 -1)) { 2768 embedder_process_id)) {
2738 return false; 2769 return false;
2739 } 2770 }
2740 2771
2741 #if defined(OS_LINUX) || defined(OS_OPENBSD) 2772 #if defined(OS_LINUX) || defined(OS_OPENBSD)
2742 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 2773 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
2743 // linux. See crbug.com/83941. 2774 // linux. See crbug.com/83941.
2744 if (rwh_view) { 2775 if (rwh_view) {
2745 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 2776 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
2746 render_widget_host->WasResized(); 2777 render_widget_host->WasResized();
2747 } 2778 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2830 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2800 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2831 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2801 // Can be NULL during tests. 2832 // Can be NULL during tests.
2802 if (rwh_view) 2833 if (rwh_view)
2803 rwh_view->SetSize(GetView()->GetContainerSize()); 2834 rwh_view->SetSize(GetView()->GetContainerSize());
2804 } 2835 }
2805 2836
2806 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2837 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2807 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2838 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2808 } 2839 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698