| 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 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 content::Source<RenderViewHost>(rvh), | 67 content::Source<RenderViewHost>(rvh), |
| 68 content::NotificationService::NoDetails()); | 68 content::NotificationService::NoDetails()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // end namespace | 71 } // end namespace |
| 72 | 72 |
| 73 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate( | 73 ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate( |
| 74 prerender::PrerenderTracker* prerender_tracker) | 74 prerender::PrerenderTracker* prerender_tracker) |
| 75 : download_request_limiter_(g_browser_process->download_request_limiter()), | 75 : download_request_limiter_(g_browser_process->download_request_limiter()), |
| 76 safe_browsing_(g_browser_process->safe_browsing_service()), | 76 safe_browsing_(g_browser_process->safe_browsing_service()), |
| 77 user_script_listener_(new UserScriptListener()), | 77 user_script_listener_(new extensions::UserScriptListener()), |
| 78 prerender_tracker_(prerender_tracker), | 78 prerender_tracker_(prerender_tracker), |
| 79 variation_ids_cache_initialized_(false) { | 79 variation_ids_cache_initialized_(false) { |
| 80 } | 80 } |
| 81 | 81 |
| 82 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { | 82 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( | 85 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( |
| 86 int child_id, | 86 int child_id, |
| 87 int route_id, | 87 int route_id, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (!variation_ids_header_.empty()) { | 314 if (!variation_ids_header_.empty()) { |
| 315 request->SetExtraRequestHeaderByName("X-Chrome-Variations", | 315 request->SetExtraRequestHeaderByName("X-Chrome-Variations", |
| 316 variation_ids_header_, | 316 variation_ids_header_, |
| 317 false); | 317 false); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( | 321 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( |
| 322 const GURL& url, const std::string& mime_type) { | 322 const GURL& url, const std::string& mime_type) { |
| 323 // Special-case user scripts to get downloaded instead of viewed. | 323 // Special-case user scripts to get downloaded instead of viewed. |
| 324 return UserScript::IsURLUserScript(url, mime_type); | 324 return extensions::UserScript::IsURLUserScript(url, mime_type); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( | 327 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( |
| 328 net::URLRequest* request, | 328 net::URLRequest* request, |
| 329 content::ResourceContext* resource_context, | 329 content::ResourceContext* resource_context, |
| 330 content::ResourceResponse* response, | 330 content::ResourceResponse* response, |
| 331 IPC::Sender* sender) { | 331 IPC::Sender* sender) { |
| 332 LoadTimingObserver::PopulateTimingInfo(request, response); | 332 LoadTimingObserver::PopulateTimingInfo(request, response); |
| 333 | 333 |
| 334 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 334 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if (base::Base64Encode(serialized, &hashed)) { | 433 if (base::Base64Encode(serialized, &hashed)) { |
| 434 // If successful, swap the header value with the new one. | 434 // If successful, swap the header value with the new one. |
| 435 // Note that the list of IDs and the header could be temporarily out of sync | 435 // Note that the list of IDs and the header could be temporarily out of sync |
| 436 // if IDs are added as we are recreating the header, but we're OK with those | 436 // if IDs are added as we are recreating the header, but we're OK with those |
| 437 // descrepancies. | 437 // descrepancies. |
| 438 variation_ids_header_ = hashed; | 438 variation_ids_header_ = hashed; |
| 439 } else { | 439 } else { |
| 440 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 440 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |