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

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

Issue 1241583009: Async Safe Browsing check, on mobile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to reviews Created 5 years, 4 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 (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/safe_browsing_resource_throttle_factory.h " 5 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle_factory.h "
6 6
7 #include "content/public/browser/resource_context.h" 7 #include "content/public/browser/resource_context.h"
8 8
9 // Compiling this file only makes sense if SAFE_BROWSING_SERVICE is enabled. 9 // Compiling this file only makes sense if SAFE_BROWSING_SERVICE is enabled.
10 // If the build is breaking here, it probably means that a gyp or gn file has 10 // If the build is breaking here, it probably means that a gyp or gn file has
(...skipping 22 matching lines...) Expand all
33 // static 33 // static
34 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create( 34 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create(
35 net::URLRequest* request, 35 net::URLRequest* request,
36 content::ResourceContext* resource_context, 36 content::ResourceContext* resource_context,
37 content::ResourceType resource_type, 37 content::ResourceType resource_type,
38 SafeBrowsingService* service) { 38 SafeBrowsingService* service) {
39 if (factory_) 39 if (factory_)
40 return factory_->CreateResourceThrottle( 40 return factory_->CreateResourceThrottle(
41 request, resource_context, resource_type, service); 41 request, resource_context, resource_type, service);
42 42
43 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 43 return CreateWithoutRegisteredFactory(request, resource_type, service);
44 // Throttle consults a local or remote database before proceeding. 44 }
45 return new SafeBrowsingResourceThrottle(request, resource_type, service); 45
46 ResourceThrottle*
47 SafeBrowsingResourceThrottleFactory::CreateWithoutRegisteredFactory(
48 net::URLRequest* request,
49 content::ResourceType resource_type,
50 SafeBrowsingService* service) {
51 #if defined(SAFE_BROWSING_DB_LOCAL)
52 // Throttle consults a local database before starting the resource request.
53 return new SafeBrowsingResourceThrottle(request, resource_type, service,
54 true /* defer_at_start */);
55 #elif defined(SAFE_BROWSING_DB_REMOTE)
56 // Throttle consults a remote database before processing the response.
57 return new SafeBrowsingResourceThrottle(request, resource_type, service,
58 false /* defer_at_start */);
46 #else 59 #else
47 return NULL; 60 return NULL;
48 #endif 61 #endif
49 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698