Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

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

Issue 10412056: Browser Plugin: Remove MapInstance from BrowserPluginHost + More cross-process navigation work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed commented out code 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"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return ViewMsg_Navigate_Type::RESTORE; 191 return ViewMsg_Navigate_Type::RESTORE;
192 } 192 }
193 193
194 return ViewMsg_Navigate_Type::NORMAL; 194 return ViewMsg_Navigate_Type::NORMAL;
195 } 195 }
196 196
197 void MakeNavigateParams(const NavigationEntryImpl& entry, 197 void MakeNavigateParams(const NavigationEntryImpl& entry,
198 const NavigationControllerImpl& controller, 198 const NavigationControllerImpl& controller,
199 content::WebContentsDelegate* delegate, 199 content::WebContentsDelegate* delegate,
200 NavigationController::ReloadType reload_type, 200 NavigationController::ReloadType reload_type,
201 const std::string& embedder_channel_name,
202 int embedder_container_id,
201 ViewMsg_Navigate_Params* params) { 203 ViewMsg_Navigate_Params* params) {
202 params->page_id = entry.GetPageID(); 204 params->page_id = entry.GetPageID();
203 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); 205 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
204 params->current_history_list_offset = controller.GetLastCommittedEntryIndex(); 206 params->current_history_list_offset = controller.GetLastCommittedEntryIndex();
205 params->current_history_list_length = controller.GetEntryCount(); 207 params->current_history_list_length = controller.GetEntryCount();
206 params->url = entry.GetURL(); 208 params->url = entry.GetURL();
207 params->referrer = entry.GetReferrer(); 209 params->referrer = entry.GetReferrer();
208 params->transition = entry.GetTransitionType(); 210 params->transition = entry.GetTransitionType();
209 params->state = entry.GetContentState(); 211 params->state = entry.GetContentState();
210 params->navigation_type = 212 params->navigation_type =
211 GetNavigationType(controller.GetBrowserContext(), entry, reload_type); 213 GetNavigationType(controller.GetBrowserContext(), entry, reload_type);
212 params->request_time = base::Time::Now(); 214 params->request_time = base::Time::Now();
213 params->extra_headers = entry.extra_headers(); 215 params->extra_headers = entry.extra_headers();
214 params->transferred_request_child_id = 216 params->transferred_request_child_id =
215 entry.transferred_global_request_id().child_id; 217 entry.transferred_global_request_id().child_id;
216 params->transferred_request_request_id = 218 params->transferred_request_request_id =
217 entry.transferred_global_request_id().request_id; 219 entry.transferred_global_request_id().request_id;
218 // Avoid downloading when in view-source mode. 220 // Avoid downloading when in view-source mode.
219 params->allow_download = !entry.IsViewSourceMode(); 221 params->allow_download = !entry.IsViewSourceMode();
222 params->embedder_channel_name = embedder_channel_name;
223 params->embedder_container_id = embedder_container_id;
220 224
221 if (delegate) 225 if (delegate)
222 delegate->AddNavigationHeaders(params->url, &params->extra_headers); 226 delegate->AddNavigationHeaders(params->url, &params->extra_headers);
223 } 227 }
224 228
225 int GetSwitchValueAsInt( 229 int GetSwitchValueAsInt(
226 const CommandLine& command_line, 230 const CommandLine& command_line,
227 const std::string& switch_string, 231 const std::string& switch_string,
228 int min_value) { 232 int min_value) {
229 std::string string_value = command_line.GetSwitchValueASCII(switch_string); 233 std::string string_value = command_line.GetSwitchValueASCII(switch_string);
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 content::GetContentClient()->SetActiveURL(entry.GetURL()); 1148 content::GetContentClient()->SetActiveURL(entry.GetURL());
1145 CHECK(0); 1149 CHECK(0);
1146 } 1150 }
1147 1151
1148 // Tell DevTools agent that it is attached prior to the navigation. 1152 // Tell DevTools agent that it is attached prior to the navigation.
1149 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry( 1153 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry(
1150 GetRenderViewHost(), 1154 GetRenderViewHost(),
1151 dest_render_view_host, 1155 dest_render_view_host,
1152 entry.GetURL()); 1156 entry.GetURL());
1153 1157
1154 // Tell BrowserPluginHost about the pending cross-process navigation.
1155 // TODO(fsamuel): Remove this once this issue is addressed:
1156 // https://code.google.com/p/chromium/issues/detail?id=128976
1157 browser_plugin_host()->OnPendingNavigation(dest_render_view_host);
1158
1159 // Used for page load time metrics. 1158 // Used for page load time metrics.
1160 current_load_start_ = base::TimeTicks::Now(); 1159 current_load_start_ = base::TimeTicks::Now();
1161 1160
1162 // Navigate in the desired RenderViewHost. 1161 // Navigate in the desired RenderViewHost.
1162 content::RenderProcessHost* embedder_render_process_host =
1163 browser_plugin_host()->embedder_render_process_host();
1164 int embedder_process_id =
1165 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
1166 int embedder_container_id = browser_plugin_host()->instance_id();
1167 std::string embedder_channel_name;
1168 if (embedder_process_id != -1) {
1169 embedder_channel_name =
1170 StringPrintf("%d.r%d", dest_render_view_host->GetProcess()->GetID(),
1171 embedder_process_id);
Charlie Reis 2012/05/23 16:57:54 I remember this was discussed in an earlier CL but
Fady Samuel 2012/05/23 17:32:15 Yes, please see here: https://chromiumcodereview.a
Charlie Reis 2012/05/23 17:52:55 Great. Perhaps we can abstract this out so it's n
1172 }
1163 ViewMsg_Navigate_Params navigate_params; 1173 ViewMsg_Navigate_Params navigate_params;
1164 MakeNavigateParams(entry, controller_, delegate_, reload_type, 1174 MakeNavigateParams(entry, controller_, delegate_, reload_type,
1175 embedder_channel_name,
1176 embedder_container_id,
1165 &navigate_params); 1177 &navigate_params);
1166 dest_render_view_host->Navigate(navigate_params); 1178 dest_render_view_host->Navigate(navigate_params);
1167 1179
1168 if (entry.GetPageID() == -1) { 1180 if (entry.GetPageID() == -1) {
1169 // HACK!! This code suppresses javascript: URLs from being added to 1181 // HACK!! This code suppresses javascript: URLs from being added to
1170 // session history, which is what we want to do for javascript: URLs that 1182 // session history, which is what we want to do for javascript: URLs that
1171 // do not generate content. What we really need is a message from the 1183 // do not generate content. What we really need is a message from the
1172 // renderer telling us that a new page was not created. The same message 1184 // renderer telling us that a new page was not created. The same message
1173 // could be used for mailto: URLs and the like. 1185 // could be used for mailto: URLs and the like.
1174 if (entry.GetURL().SchemeIs(chrome::kJavaScriptScheme)) 1186 if (entry.GetURL().SchemeIs(chrome::kJavaScriptScheme))
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 2745
2734 // Make sure we use the correct starting page_id in the new RenderView. 2746 // Make sure we use the correct starting page_id in the new RenderView.
2735 UpdateMaxPageIDIfNecessary(render_view_host); 2747 UpdateMaxPageIDIfNecessary(render_view_host);
2736 int32 max_page_id = 2748 int32 max_page_id =
2737 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 2749 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
2738 2750
2739 content::RenderProcessHost* embedder_render_process_host = 2751 content::RenderProcessHost* embedder_render_process_host =
2740 browser_plugin_host()->embedder_render_process_host(); 2752 browser_plugin_host()->embedder_render_process_host();
2741 int embedder_process_id = 2753 int embedder_process_id =
2742 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; 2754 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
2755 int embedder_container_id = browser_plugin_host()->instance_id();
2743 if (!static_cast<RenderViewHostImpl*>( 2756 if (!static_cast<RenderViewHostImpl*>(
2744 render_view_host)->CreateRenderView(string16(), 2757 render_view_host)->CreateRenderView(string16(),
2745 opener_route_id, 2758 opener_route_id,
2746 max_page_id, 2759 max_page_id,
2747 embedder_process_id)) { 2760 embedder_process_id,
2761 embedder_container_id)) {
2748 return false; 2762 return false;
2749 } 2763 }
2750 2764
2751 #if defined(OS_LINUX) || defined(OS_OPENBSD) 2765 #if defined(OS_LINUX) || defined(OS_OPENBSD)
2752 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 2766 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
2753 // linux. See crbug.com/83941. 2767 // linux. See crbug.com/83941.
2754 if (rwh_view) { 2768 if (rwh_view) {
2755 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 2769 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
2756 render_widget_host->WasResized(); 2770 render_widget_host->WasResized();
2757 } 2771 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2823 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2810 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2824 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2811 // Can be NULL during tests. 2825 // Can be NULL during tests.
2812 if (rwh_view) 2826 if (rwh_view)
2813 rwh_view->SetSize(GetView()->GetContainerSize()); 2827 rwh_view->SetSize(GetView()->GetContainerSize());
2814 } 2828 }
2815 2829
2816 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2830 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2817 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2831 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2818 } 2832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698