Chromium Code Reviews| 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/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 #error Need to define {FULL|MOBILE} SAFE_BROWSING mode. |
|
mattm
2014/07/31 00:51:43
update error message?
Scott Hess - ex-Googler
2014/07/31 20:50:14
Done.
| |
| 40 #endif | 45 #endif // SAFE_BROWSING_SERVICE |
| 41 } | 46 } |
| OLD | NEW |