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

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

Issue 1241583009: Async Safe Browsing check, on mobile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove logging, fixup comments Created 5 years, 5 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 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/renderer_host/safe_browsing_resource_throttle_factory.h " 10 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h "
(...skipping 25 matching lines...) Expand all
36 const char* DataReductionProxyResourceThrottle::kUnsafeUrlProceedHeader = 36 const char* DataReductionProxyResourceThrottle::kUnsafeUrlProceedHeader =
37 "X-Unsafe-Url-Proceed"; 37 "X-Unsafe-Url-Proceed";
38 38
39 ResourceThrottle* 39 ResourceThrottle*
40 DataReductionProxyResourceThrottleFactory::CreateResourceThrottle( 40 DataReductionProxyResourceThrottleFactory::CreateResourceThrottle(
41 net::URLRequest* request, 41 net::URLRequest* request,
42 content::ResourceContext* resource_context, 42 content::ResourceContext* resource_context,
43 content::ResourceType resource_type, 43 content::ResourceType resource_type,
44 SafeBrowsingService* service) { 44 SafeBrowsingService* service) {
45 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 45 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
46 // Send requests through Safe Browsing if we can't process them.
46 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 47 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
47 if (io_data->IsOffTheRecord() || !io_data->IsDataReductionProxyEnabled() || 48 if (io_data->IsOffTheRecord() || !io_data->IsDataReductionProxyEnabled() ||
48 request->url().SchemeIsSecure()) 49 request->url().SchemeIsSecure()) {
49 return new SafeBrowsingResourceThrottle(request, resource_type, service); 50 return SafeBrowsingResourceThrottleFactory::CreateWithoutFactory(
mattm 2015/07/24 23:24:11 This is kinda confusing at first glance.. maybe ha
Nathan Parker 2015/07/28 17:42:12 Done.
51 request, resource_type, service);
52 }
50 #endif 53 #endif
51 return new DataReductionProxyResourceThrottle(request, resource_type, 54 return new DataReductionProxyResourceThrottle(request, resource_type,
52 service); 55 service);
53 } 56 }
54 57
55 DataReductionProxyResourceThrottle::DataReductionProxyResourceThrottle( 58 DataReductionProxyResourceThrottle::DataReductionProxyResourceThrottle(
56 net::URLRequest* request, 59 net::URLRequest* request,
57 content::ResourceType resource_type, 60 content::ResourceType resource_type,
58 SafeBrowsingService* safe_browsing) 61 SafeBrowsingService* safe_browsing)
59 : state_(STATE_NONE), 62 : state_(STATE_NONE),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return result; 175 return result;
173 } 176 }
174 177
175 void DataReductionProxyResourceThrottle::ResumeRequest() { 178 void DataReductionProxyResourceThrottle::ResumeRequest() {
176 CHECK(state_ == STATE_NONE); 179 CHECK(state_ == STATE_NONE);
177 180
178 // Inject the header before resuming the request. 181 // Inject the header before resuming the request.
179 request_->SetExtraRequestHeaderByName(kUnsafeUrlProceedHeader, "1", true); 182 request_->SetExtraRequestHeaderByName(kUnsafeUrlProceedHeader, "1", true);
180 controller()->Resume(); 183 controller()->Resume();
181 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698