OLD | NEW |
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 Loading... |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if (prerender_contents) | 160 if (prerender_contents) |
161 prerender_contents->AddNetworkBytes(bytes); | 161 prerender_contents->AddNetworkBytes(bytes); |
162 | 162 |
163 prerender::PrerenderManager* prerender_manager = | 163 prerender::PrerenderManager* prerender_manager = |
164 GetPrerenderManager(render_process_id, render_view_id); | 164 GetPrerenderManager(render_process_id, render_view_id); |
165 if (prerender_manager) | 165 if (prerender_manager) |
166 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); | 166 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); |
167 } | 167 } |
168 | 168 |
169 #if defined(ENABLE_EXTENSIONS) | 169 #if defined(ENABLE_EXTENSIONS) |
170 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamHandle> stream, | 170 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream, |
171 int64 expected_content_size, | 171 int64 expected_content_size, |
172 int render_process_id, | 172 int render_process_id, |
173 int render_view_id, | 173 int render_view_id, |
174 const std::string& extension_id, | 174 const std::string& extension_id, |
175 const std::string& view_id) { | 175 const std::string& view_id) { |
176 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 176 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
177 | 177 |
178 content::WebContents* web_contents = | 178 content::WebContents* web_contents = |
179 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 179 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
180 if (!web_contents) | 180 if (!web_contents) |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 stream_target_info_[request] = target_info; | 610 stream_target_info_[request] = target_info; |
611 return true; | 611 return true; |
612 } | 612 } |
613 } | 613 } |
614 #endif | 614 #endif |
615 return false; | 615 return false; |
616 } | 616 } |
617 | 617 |
618 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( | 618 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( |
619 net::URLRequest* request, | 619 net::URLRequest* request, |
620 scoped_ptr<content::StreamHandle> stream) { | 620 scoped_ptr<content::StreamInfo> stream) { |
621 #if defined(ENABLE_EXTENSIONS) | 621 #if defined(ENABLE_EXTENSIONS) |
622 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 622 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
623 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = | 623 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = |
624 stream_target_info_.find(request); | 624 stream_target_info_.find(request); |
625 CHECK(ix != stream_target_info_.end()); | 625 CHECK(ix != stream_target_info_.end()); |
626 content::BrowserThread::PostTask( | 626 content::BrowserThread::PostTask( |
627 content::BrowserThread::UI, FROM_HERE, | 627 content::BrowserThread::UI, FROM_HERE, |
628 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), | 628 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), |
629 request->GetExpectedContentSize(), | 629 request->GetExpectedContentSize(), |
630 info->GetChildID(), info->GetRouteID(), | 630 info->GetChildID(), info->GetRouteID(), |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 url_request->GetTotalReceivedBytes())); | 751 url_request->GetTotalReceivedBytes())); |
752 } | 752 } |
753 } | 753 } |
754 | 754 |
755 // static | 755 // static |
756 void ChromeResourceDispatcherHostDelegate:: | 756 void ChromeResourceDispatcherHostDelegate:: |
757 SetExternalProtocolHandlerDelegateForTesting( | 757 SetExternalProtocolHandlerDelegateForTesting( |
758 ExternalProtocolHandler::Delegate* delegate) { | 758 ExternalProtocolHandler::Delegate* delegate) { |
759 g_external_protocol_handler_delegate = delegate; | 759 g_external_protocol_handler_delegate = delegate; |
760 } | 760 } |
OLD | NEW |