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