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

Unified Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 1485693002: PlzNavigate: make StreamPrivate API work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@downloads-fix
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/loader/navigation_resource_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index 351d35a985508162f152020cee1f22be9fe04bae..206fa6db144b8a359afc5d2876ab8bc0fa3ad1dd 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/base64.h"
+#include "base/command_line.h"
#include "base/guid.h"
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
@@ -50,6 +51,7 @@
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/stream_info.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/resource_response.h"
#include "net/base/load_flags.h"
#include "net/base/load_timing_info.h"
@@ -174,20 +176,27 @@ void UpdatePrerenderNetworkBytesCallback(int render_process_id,
}
#if defined(ENABLE_EXTENSIONS)
-void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
- int64 expected_content_size,
- int render_process_id,
- int render_frame_id,
- const std::string& extension_id,
- const std::string& view_id,
- bool embedded) {
+void SendExecuteMimeTypeHandlerEvent(
+ scoped_ptr<content::StreamInfo> stream,
+ int64 expected_content_size,
+ const ResourceRequestInfo::WebContentsGetter& web_contents_getter,
+ int render_process_id,
+ int render_frame_id,
+ const std::string& extension_id,
+ const std::string& view_id,
+ bool embedded) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- content::WebContents* web_contents =
- tab_util::GetWebContentsByFrameID(render_process_id, render_frame_id);
+ content::WebContents* web_contents = web_contents_getter.Run();
if (!web_contents)
return;
+ // TODO(clamy): update this code for PlzNavigate when extensions have
+ // switched to FrameTreeNode IDs, so that unclaimed streams are not leaked.
davidben 2015/12/09 23:53:44 Probably worth a bug number?
+ DCHECK((render_process_id != -1 && render_frame_id != -1) ||
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation));
+
// If the request was for a prerender, abort the prerender and do not
// continue.
prerender::PrerenderContents* prerender_contents =
@@ -626,7 +635,8 @@ void ChromeResourceDispatcherHostDelegate::OnStreamCreated(
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream),
- request->GetExpectedContentSize(), info->GetChildID(),
+ request->GetExpectedContentSize(),
+ info->GetWebContentsGetterForRequest(), info->GetChildID(),
info->GetRenderFrameID(), ix->second.extension_id,
ix->second.view_id, embedded));
stream_target_info_.erase(request);
« no previous file with comments | « no previous file | content/browser/loader/navigation_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698