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

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

Issue 397853002: Refactor safe-browsing build-config definitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to satiate trybots Created 6 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 | Annotate | Revision Log
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 #if defined(FULL_SAFE_BROWSING) 8
9 #if defined(SAFE_BROWSING_DATABASE)
9 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" 10 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
10 #endif 11 #endif
11 12
12 using content::ResourceThrottle; 13 using content::ResourceThrottle;
13 14
14 // static 15 // static
15 SafeBrowsingResourceThrottleFactory* 16 SafeBrowsingResourceThrottleFactory*
16 SafeBrowsingResourceThrottleFactory::factory_ = NULL; 17 SafeBrowsingResourceThrottleFactory::factory_ = NULL;
17 18
18 // static 19 // static
19 void SafeBrowsingResourceThrottleFactory::RegisterFactory( 20 void SafeBrowsingResourceThrottleFactory::RegisterFactory(
20 SafeBrowsingResourceThrottleFactory* factory) { 21 SafeBrowsingResourceThrottleFactory* factory) {
21 factory_ = factory; 22 factory_ = factory;
22 } 23 }
23 24
24 // static 25 // static
25 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create( 26 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create(
26 net::URLRequest* request, 27 net::URLRequest* request,
27 content::ResourceContext* resource_context, 28 content::ResourceContext* resource_context,
28 bool is_subresource, 29 bool is_subresource,
29 SafeBrowsingService* service) { 30 SafeBrowsingService* service) {
31 #if defined(SAFE_BROWSING_SERVICE)
30 if (factory_) 32 if (factory_)
31 return factory_->CreateResourceThrottle( 33 return factory_->CreateResourceThrottle(
32 request, resource_context, is_subresource, service); 34 request, resource_context, is_subresource, service);
33 35
34 #if defined(FULL_SAFE_BROWSING) 36 #if defined(SAFE_BROWSING_DATABASE)
37 // Throttle consults a local database before proceeding.
35 return new SafeBrowsingResourceThrottle(request, is_subresource, service); 38 return new SafeBrowsingResourceThrottle(request, is_subresource, service);
36 #elif defined(MOBILE_SAFE_BROWSING) 39 #else
37 return NULL; 40 return NULL;
41 #endif // SAFE_BROWSING_DATABASE
42
38 #else 43 #else
39 #error Need to define {FULL|MOBILE} SAFE_BROWSING mode. 44 // Compiling this file only makes sense if SAFE_BROWSING_SERVICE is enabled.
40 #endif 45 // If the build is breaking here, it probably means that a gyp or gn file has
46 // been modified to build this file with safe_browsing=0 (gn
47 // safe_browsing_mode=0).
48 #error Need to define safe_browsing mode.
49 #endif // SAFE_BROWSING_SERVICE
41 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698