| 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 #if defined(FULL_SAFE_BROWSING) |
| 9 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 9 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 using content::ResourceThrottle; | 12 using content::ResourceThrottle; |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 SafeBrowsingResourceThrottleFactory* | 15 SafeBrowsingResourceThrottleFactory* |
| 16 SafeBrowsingResourceThrottleFactory::factory_ = NULL; | 16 SafeBrowsingResourceThrottleFactory::factory_ = NULL; |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void SafeBrowsingResourceThrottleFactory::RegisterFactory( |
| 20 SafeBrowsingResourceThrottleFactory* factory) { |
| 21 factory_ = factory; |
| 22 } |
| 23 |
| 24 // static |
| 19 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create( | 25 ResourceThrottle* SafeBrowsingResourceThrottleFactory::Create( |
| 20 net::URLRequest* request, | 26 net::URLRequest* request, |
| 21 content::ResourceContext* resource_context, | 27 content::ResourceContext* resource_context, |
| 22 bool is_subresource, | 28 bool is_subresource, |
| 23 SafeBrowsingService* service) { | 29 SafeBrowsingService* service) { |
| 24 | |
| 25 #if defined(FULL_SAFE_BROWSING) | |
| 26 if (factory_) | 30 if (factory_) |
| 27 return factory_->CreateResourceThrottle( | 31 return factory_->CreateResourceThrottle( |
| 28 request, resource_context, is_subresource, service); | 32 request, resource_context, is_subresource, service); |
| 33 |
| 34 #if defined(FULL_SAFE_BROWSING) |
| 29 return new SafeBrowsingResourceThrottle(request, is_subresource, service); | 35 return new SafeBrowsingResourceThrottle(request, is_subresource, service); |
| 30 #elif defined(MOBILE_SAFE_BROWSING) | 36 #elif defined(MOBILE_SAFE_BROWSING) |
| 31 if (factory_) | |
| 32 return factory_->CreateResourceThrottle( | |
| 33 request, resource_context, is_subresource, service); | |
| 34 return NULL; | 37 return NULL; |
| 35 #else | 38 #else |
| 36 #error Need to define {FULL|MOBILE} SAFE_BROWSING mode. | 39 #error Need to define {FULL|MOBILE} SAFE_BROWSING mode. |
| 37 #endif | 40 #endif |
| 38 } | 41 } |
| OLD | NEW |