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