| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/data_reduction_proxy_resource_throttle_an
droid.h" | 5 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an
droid.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prerender/prerender_contents.h" | 9 #include "chrome/browser/prerender/prerender_contents.h" |
| 10 #include "chrome/browser/profiles/profile_io_data.h" | 10 #include "chrome/browser/profiles/profile_io_data.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // static | 34 // static |
| 35 DataReductionProxyResourceThrottle* | 35 DataReductionProxyResourceThrottle* |
| 36 DataReductionProxyResourceThrottle::MaybeCreate( | 36 DataReductionProxyResourceThrottle::MaybeCreate( |
| 37 net::URLRequest* request, | 37 net::URLRequest* request, |
| 38 content::ResourceContext* resource_context, | 38 content::ResourceContext* resource_context, |
| 39 content::ResourceType resource_type, | 39 content::ResourceType resource_type, |
| 40 SafeBrowsingService* sb_service) { | 40 SafeBrowsingService* sb_service) { |
| 41 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 41 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| 42 // Don't create the throttle if we can't handle the request. | 42 // Don't create the throttle if we can't handle the request. |
| 43 if (io_data->IsOffTheRecord() || !io_data->IsDataReductionProxyEnabled() || | 43 if (io_data->IsOffTheRecord() || !io_data->IsDataReductionProxyEnabled() || |
| 44 request->url().SchemeIsSecure()) { | 44 request->url().SchemeIsCryptographic()) { |
| 45 return NULL; | 45 return NULL; |
| 46 } | 46 } |
| 47 | 47 |
| 48 return new DataReductionProxyResourceThrottle(request, resource_type, | 48 return new DataReductionProxyResourceThrottle(request, resource_type, |
| 49 sb_service); | 49 sb_service); |
| 50 } | 50 } |
| 51 | 51 |
| 52 DataReductionProxyResourceThrottle::DataReductionProxyResourceThrottle( | 52 DataReductionProxyResourceThrottle::DataReductionProxyResourceThrottle( |
| 53 net::URLRequest* request, | 53 net::URLRequest* request, |
| 54 content::ResourceType resource_type, | 54 content::ResourceType resource_type, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return result; | 170 return result; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void DataReductionProxyResourceThrottle::ResumeRequest() { | 173 void DataReductionProxyResourceThrottle::ResumeRequest() { |
| 174 CHECK(state_ == STATE_NONE); | 174 CHECK(state_ == STATE_NONE); |
| 175 | 175 |
| 176 // Inject the header before resuming the request. | 176 // Inject the header before resuming the request. |
| 177 request_->SetExtraRequestHeaderByName(kUnsafeUrlProceedHeader, "1", true); | 177 request_->SetExtraRequestHeaderByName(kUnsafeUrlProceedHeader, "1", true); |
| 178 controller()->Resume(); | 178 controller()->Resume(); |
| 179 } | 179 } |
| OLD | NEW |