| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 stream_target_info_[request] = target_info; | 608 stream_target_info_[request] = target_info; |
| 609 return true; | 609 return true; |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 #endif | 612 #endif |
| 613 return false; | 613 return false; |
| 614 } | 614 } |
| 615 | 615 |
| 616 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( | 616 void ChromeResourceDispatcherHostDelegate::OnStreamCreated( |
| 617 net::URLRequest* request, | 617 net::URLRequest* request, |
| 618 scoped_ptr<content::StreamHandle> stream) { | 618 scoped_ptr<content::StreamInfo> stream) { |
| 619 #if defined(ENABLE_EXTENSIONS) | 619 #if defined(ENABLE_EXTENSIONS) |
| 620 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 620 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 621 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = | 621 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = |
| 622 stream_target_info_.find(request); | 622 stream_target_info_.find(request); |
| 623 CHECK(ix != stream_target_info_.end()); | 623 CHECK(ix != stream_target_info_.end()); |
| 624 content::BrowserThread::PostTask( | 624 content::BrowserThread::PostTask( |
| 625 content::BrowserThread::UI, FROM_HERE, | 625 content::BrowserThread::UI, FROM_HERE, |
| 626 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), | 626 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), |
| 627 request->GetExpectedContentSize(), | 627 request->GetExpectedContentSize(), |
| 628 info->GetChildID(), info->GetRouteID(), | 628 info->GetChildID(), info->GetRouteID(), |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 url_request->GetTotalReceivedBytes())); | 749 url_request->GetTotalReceivedBytes())); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 // static | 753 // static |
| 754 void ChromeResourceDispatcherHostDelegate:: | 754 void ChromeResourceDispatcherHostDelegate:: |
| 755 SetExternalProtocolHandlerDelegateForTesting( | 755 SetExternalProtocolHandlerDelegateForTesting( |
| 756 ExternalProtocolHandler::Delegate* delegate) { | 756 ExternalProtocolHandler::Delegate* delegate) { |
| 757 g_external_protocol_handler_delegate = delegate; | 757 g_external_protocol_handler_delegate = delegate; |
| 758 } | 758 } |
| OLD | NEW |