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

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: fixed nit 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/content_browser.gypi » ('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 <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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 content::GetContentClient()->SetActiveURL(entry.GetURL()); 1142 content::GetContentClient()->SetActiveURL(entry.GetURL());
1140 CHECK(0); 1143 CHECK(0);
1141 } 1144 }
1142 1145
1143 // Tell DevTools agent that it is attached prior to the navigation. 1146 // Tell DevTools agent that it is attached prior to the navigation.
1144 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry( 1147 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry(
1145 GetRenderViewHost(), 1148 GetRenderViewHost(),
1146 dest_render_view_host, 1149 dest_render_view_host,
1147 entry.GetURL()); 1150 entry.GetURL());
1148 1151
1152 // Tell BrowserPluginHost about the pending cross-process navigation.
1153 // TODO(fsamuel): Remove this once this issue is addressed:
1154 // https://code.google.com/p/chromium/issues/detail?id=128976
1155 browser_plugin_host()->OnPendingNavigation(dest_render_view_host);
1156
1149 // Used for page load time metrics. 1157 // Used for page load time metrics.
1150 current_load_start_ = base::TimeTicks::Now(); 1158 current_load_start_ = base::TimeTicks::Now();
1151 1159
1152 // Navigate in the desired RenderViewHost. 1160 // Navigate in the desired RenderViewHost.
1153 ViewMsg_Navigate_Params navigate_params; 1161 ViewMsg_Navigate_Params navigate_params;
1154 MakeNavigateParams(entry, controller_, delegate_, reload_type, 1162 MakeNavigateParams(entry, controller_, delegate_, reload_type,
1155 &navigate_params); 1163 &navigate_params);
1156 dest_render_view_host->Navigate(navigate_params); 1164 dest_render_view_host->Navigate(navigate_params);
1157 1165
1158 if (entry.GetPageID() == -1) { 1166 if (entry.GetPageID() == -1) {
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 2731
2724 // Now that the RenderView has been created, we need to tell it its size. 2732 // Now that the RenderView has been created, we need to tell it its size.
2725 if (rwh_view) 2733 if (rwh_view)
2726 rwh_view->SetSize(view_->GetContainerSize()); 2734 rwh_view->SetSize(view_->GetContainerSize());
2727 2735
2728 // Make sure we use the correct starting page_id in the new RenderView. 2736 // Make sure we use the correct starting page_id in the new RenderView.
2729 UpdateMaxPageIDIfNecessary(render_view_host); 2737 UpdateMaxPageIDIfNecessary(render_view_host);
2730 int32 max_page_id = 2738 int32 max_page_id =
2731 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 2739 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
2732 2740
2741 content::RenderProcessHost* embedder_render_process_host =
2742 browser_plugin_host()->embedder_render_process_host();
2743 int embedder_process_id =
2744 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
2733 if (!static_cast<RenderViewHostImpl*>( 2745 if (!static_cast<RenderViewHostImpl*>(
2734 render_view_host)->CreateRenderView(string16(), 2746 render_view_host)->CreateRenderView(string16(),
2735 opener_route_id, 2747 opener_route_id,
2736 max_page_id, 2748 max_page_id,
2737 -1)) { 2749 embedder_process_id)) {
2738 return false; 2750 return false;
2739 } 2751 }
2740 2752
2741 #if defined(OS_LINUX) || defined(OS_OPENBSD) 2753 #if defined(OS_LINUX) || defined(OS_OPENBSD)
2742 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 2754 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
2743 // linux. See crbug.com/83941. 2755 // linux. See crbug.com/83941.
2744 if (rwh_view) { 2756 if (rwh_view) {
2745 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 2757 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
2746 render_widget_host->WasResized(); 2758 render_widget_host->WasResized();
2747 } 2759 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2811 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2800 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2812 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2801 // Can be NULL during tests. 2813 // Can be NULL during tests.
2802 if (rwh_view) 2814 if (rwh_view)
2803 rwh_view->SetSize(GetView()->GetContainerSize()); 2815 rwh_view->SetSize(GetView()->GetContainerSize());
2804 } 2816 }
2805 2817
2806 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2818 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2807 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2819 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2808 } 2820 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698