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

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 to not expose GetPendingRenderViewHost 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Listen for whether our opener gets destroyed. 320 // Listen for whether our opener gets destroyed.
320 if (opener_) { 321 if (opener_) {
321 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 322 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
322 content::Source<WebContents>(opener_)); 323 content::Source<WebContents>(opener_));
323 } 324 }
324 325
325 #if defined(ENABLE_JAVA_BRIDGE) 326 #if defined(ENABLE_JAVA_BRIDGE)
326 java_bridge_dispatcher_host_manager_.reset( 327 java_bridge_dispatcher_host_manager_.reset(
327 new JavaBridgeDispatcherHostManager(this)); 328 new JavaBridgeDispatcherHostManager(this));
328 #endif 329 #endif
330
331 browser_plugin_host_.reset(new content::BrowserPluginHost(this));
329 } 332 }
330 333
331 WebContentsImpl::~WebContentsImpl() { 334 WebContentsImpl::~WebContentsImpl() {
332 is_being_destroyed_ = true; 335 is_being_destroyed_ = true;
333 336
334 // Clear out any JavaScript state. 337 // Clear out any JavaScript state.
335 if (dialog_creator_) 338 if (dialog_creator_)
336 dialog_creator_->ResetJavaScriptState(this); 339 dialog_creator_->ResetJavaScriptState(this);
337 340
338 if (color_chooser_) 341 if (color_chooser_)
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 content::GetContentClient()->SetActiveURL(entry.GetURL()); 1125 content::GetContentClient()->SetActiveURL(entry.GetURL());
1123 CHECK(0); 1126 CHECK(0);
1124 } 1127 }
1125 1128
1126 // Tell DevTools agent that it is attached prior to the navigation. 1129 // Tell DevTools agent that it is attached prior to the navigation.
1127 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry( 1130 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry(
1128 GetRenderViewHost(), 1131 GetRenderViewHost(),
1129 dest_render_view_host, 1132 dest_render_view_host,
1130 entry.GetURL()); 1133 entry.GetURL());
1131 1134
1135 // Tell BrowserPluginHost about the pending cross-process navigation.
1136 browser_plugin_host()->OnCrossProcessNavigation(dest_render_view_host);
Charlie Reis 2012/05/17 21:24:05 Should avoid this.
Fady Samuel 2012/05/18 17:37:52 See TODO above BrowserPluginHost::OnMapInstance. I
Charlie Reis 2012/05/18 20:35:24 Please put a TODO here as well, since we can't kee
1137
1132 // Used for page load time metrics. 1138 // Used for page load time metrics.
1133 current_load_start_ = base::TimeTicks::Now(); 1139 current_load_start_ = base::TimeTicks::Now();
1134 1140
1135 // Navigate in the desired RenderViewHost. 1141 // Navigate in the desired RenderViewHost.
1136 ViewMsg_Navigate_Params navigate_params; 1142 ViewMsg_Navigate_Params navigate_params;
1137 MakeNavigateParams(entry, controller_, delegate_, reload_type, 1143 MakeNavigateParams(entry, controller_, delegate_, reload_type,
1138 &navigate_params); 1144 &navigate_params);
1139 dest_render_view_host->Navigate(navigate_params); 1145 dest_render_view_host->Navigate(navigate_params);
1140 1146
1141 if (entry.GetPageID() == -1) { 1147 if (entry.GetPageID() == -1) {
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 2709
2704 // Now that the RenderView has been created, we need to tell it its size. 2710 // Now that the RenderView has been created, we need to tell it its size.
2705 if (rwh_view) 2711 if (rwh_view)
2706 rwh_view->SetSize(view_->GetContainerSize()); 2712 rwh_view->SetSize(view_->GetContainerSize());
2707 2713
2708 // Make sure we use the correct starting page_id in the new RenderView. 2714 // Make sure we use the correct starting page_id in the new RenderView.
2709 UpdateMaxPageIDIfNecessary(render_view_host); 2715 UpdateMaxPageIDIfNecessary(render_view_host);
2710 int32 max_page_id = 2716 int32 max_page_id =
2711 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 2717 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
2712 2718
2719 WebContentsImpl* embedder = browser_plugin_host()->embedder();
2720 int embedder_process_id =
2721 embedder ? embedder->GetRenderProcessHost()->GetID() : -1;
2713 if (!static_cast<RenderViewHostImpl*>( 2722 if (!static_cast<RenderViewHostImpl*>(
2714 render_view_host)->CreateRenderView(string16(), 2723 render_view_host)->CreateRenderView(string16(),
2715 opener_route_id, 2724 opener_route_id,
2716 max_page_id, 2725 max_page_id,
2717 -1)) { 2726 embedder_process_id)) {
2718 return false; 2727 return false;
2719 } 2728 }
2720 2729
2721 #if defined(OS_LINUX) || defined(OS_OPENBSD) 2730 #if defined(OS_LINUX) || defined(OS_OPENBSD)
2722 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 2731 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
2723 // linux. See crbug.com/83941. 2732 // linux. See crbug.com/83941.
2724 if (rwh_view) { 2733 if (rwh_view) {
2725 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 2734 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
2726 render_widget_host->WasResized(); 2735 render_widget_host->WasResized();
2727 } 2736 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2779 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2788 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2780 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2789 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2781 // Can be NULL during tests. 2790 // Can be NULL during tests.
2782 if (rwh_view) 2791 if (rwh_view)
2783 rwh_view->SetSize(GetView()->GetContainerSize()); 2792 rwh_view->SetSize(GetView()->GetContainerSize());
2784 } 2793 }
2785 2794
2786 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2795 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2787 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2796 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2788 } 2797 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698