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.
5 #ifndef CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_
6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_
8 #include "base/basictypes.h"
10 class SafeBrowsingService
;
13 class ResourceContext
;
14 class ResourceThrottle
;
21 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is
22 // registered, the factory's CreateResourceThrottle() is called. Otherwise,
23 // when FULL_SAFE_BROWSING is enabled, a new SafeBrowsingResourceThrottle is
24 // returned, or NULL if MOBILE_SAFE_BROWSING is enabled.
25 class SafeBrowsingResourceThrottleFactory
{
27 // Registers a factory. Does not take the ownership of the factory. The
28 // caller has to make sure the factory stays alive and properly destroyed.
29 static void RegisterFactory(SafeBrowsingResourceThrottleFactory
* factory
);
31 // Creates a new resource throttle for safe browsing
32 static content::ResourceThrottle
* Create(
33 net::URLRequest
* request
,
34 content::ResourceContext
* resource_context
,
36 SafeBrowsingService
* service
);
39 SafeBrowsingResourceThrottleFactory() { }
40 virtual ~SafeBrowsingResourceThrottleFactory() { }
42 virtual content::ResourceThrottle
* CreateResourceThrottle(
43 net::URLRequest
* request
,
44 content::ResourceContext
* resource_context
,
46 SafeBrowsingService
* service
) = 0;
49 static SafeBrowsingResourceThrottleFactory
* factory_
;
51 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory
);
54 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_