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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "components/google/core/browser/google_util.h" 37 #include "components/google/core/browser/google_util.h"
38 #include "components/variations/variations_http_header_provider.h" 38 #include "components/variations/variations_http_header_provider.h"
39 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/notification_service.h" 40 #include "content/public/browser/notification_service.h"
41 #include "content/public/browser/render_process_host.h" 41 #include "content/public/browser/render_process_host.h"
42 #include "content/public/browser/render_view_host.h" 42 #include "content/public/browser/render_view_host.h"
43 #include "content/public/browser/resource_context.h" 43 #include "content/public/browser/resource_context.h"
44 #include "content/public/browser/resource_dispatcher_host.h" 44 #include "content/public/browser/resource_dispatcher_host.h"
45 #include "content/public/browser/resource_request_info.h" 45 #include "content/public/browser/resource_request_info.h"
46 #include "content/public/browser/stream_handle.h" 46 #include "content/public/browser/stream_info.h"
47 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
48 #include "content/public/common/resource_response.h" 48 #include "content/public/common/resource_response.h"
49 #include "net/base/load_flags.h" 49 #include "net/base/load_flags.h"
50 #include "net/base/load_timing_info.h" 50 #include "net/base/load_timing_info.h"
51 #include "net/base/request_priority.h" 51 #include "net/base/request_priority.h"
52 #include "net/http/http_response_headers.h" 52 #include "net/http/http_response_headers.h"
53 #include "net/url_request/url_request.h" 53 #include "net/url_request/url_request.h"
54 54
55 #if !defined(DISABLE_NACL) 55 #if !defined(DISABLE_NACL)
56 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" 56 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (prerender_contents) 159 if (prerender_contents)
160 prerender_contents->AddNetworkBytes(bytes); 160 prerender_contents->AddNetworkBytes(bytes);
161 161
162 prerender::PrerenderManager* prerender_manager = 162 prerender::PrerenderManager* prerender_manager =
163 GetPrerenderManager(render_process_id, render_view_id); 163 GetPrerenderManager(render_process_id, render_view_id);
164 if (prerender_manager) 164 if (prerender_manager)
165 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); 165 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes);
166 } 166 }
167 167
168 #if defined(ENABLE_EXTENSIONS) 168 #if defined(ENABLE_EXTENSIONS)
169 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamHandle> stream, 169 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
170 int64 expected_content_size, 170 int64 expected_content_size,
171 int render_process_id, 171 int render_process_id,
172 int render_view_id, 172 int render_view_id,
173 const std::string& extension_id, 173 const std::string& extension_id,
174 const std::string& view_id) { 174 const std::string& view_id) {
175 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 175 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
176 176
177 content::WebContents* web_contents = 177 content::WebContents* web_contents =
178 tab_util::GetWebContentsByID(render_process_id, render_view_id); 178 tab_util::GetWebContentsByID(render_process_id, render_view_id);
179 if (!web_contents) 179 if (!web_contents)
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 stream_target_info_[request] = target_info; 604 stream_target_info_[request] = target_info;
605 return true; 605 return true;
606 } 606 }
607 } 607 }
608 #endif 608 #endif
609 return false; 609 return false;
610 } 610 }
611 611
612 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( 612 void ChromeResourceDispatcherHostDelegate::OnStreamCreated(
613 net::URLRequest* request, 613 net::URLRequest* request,
614 scoped_ptr<content::StreamHandle> stream) { 614 scoped_ptr<content::StreamInfo> stream) {
615 #if defined(ENABLE_EXTENSIONS) 615 #if defined(ENABLE_EXTENSIONS)
616 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 616 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
617 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = 617 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix =
618 stream_target_info_.find(request); 618 stream_target_info_.find(request);
619 CHECK(ix != stream_target_info_.end()); 619 CHECK(ix != stream_target_info_.end());
620 content::BrowserThread::PostTask( 620 content::BrowserThread::PostTask(
621 content::BrowserThread::UI, FROM_HERE, 621 content::BrowserThread::UI, FROM_HERE,
622 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), 622 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream),
clamy 2014/09/12 20:51:25 StreamInfo now contains a scoped_refptr of a Resou
davidben 2014/09/19 18:30:49 Apparently the answer is no, it's not thread-safe.
623 request->GetExpectedContentSize(), 623 request->GetExpectedContentSize(),
624 info->GetChildID(), info->GetRouteID(), 624 info->GetChildID(), info->GetRouteID(),
625 ix->second.extension_id, ix->second.view_id)); 625 ix->second.extension_id, ix->second.view_id));
626 stream_target_info_.erase(request); 626 stream_target_info_.erase(request);
627 #endif 627 #endif
628 } 628 }
629 629
630 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( 630 void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
631 net::URLRequest* request, 631 net::URLRequest* request,
632 content::ResourceContext* resource_context, 632 content::ResourceContext* resource_context,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 url_request->GetTotalReceivedBytes())); 735 url_request->GetTotalReceivedBytes()));
736 } 736 }
737 } 737 }
738 738
739 // static 739 // static
740 void ChromeResourceDispatcherHostDelegate:: 740 void ChromeResourceDispatcherHostDelegate::
741 SetExternalProtocolHandlerDelegateForTesting( 741 SetExternalProtocolHandlerDelegateForTesting(
742 ExternalProtocolHandler::Delegate* delegate) { 742 ExternalProtocolHandler::Delegate* delegate) {
743 g_external_protocol_handler_delegate = delegate; 743 g_external_protocol_handler_delegate = delegate;
744 } 744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698