Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / renderer_host / safe_browsing_resource_throttle_factory.h
blob5c3c78eb913d76939f2beaf1e07379b1f93c6a39
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"
9 #include "content/public/common/resource_type.h"
11 class SafeBrowsingService;
13 namespace content {
14 class ResourceContext;
15 class ResourceThrottle;
18 namespace net {
19 class URLRequest;
22 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is
23 // registered, the factory's CreateResourceThrottle() is called. Otherwise,
24 // if SAFE_BROWSING_DB_LOCAL || SAFE_BROWSING_DB_REMOTE is enabled, a new
25 // SafeBrowsingResourceThrottle is returned, or NULL if only
26 // SAFE_BROWSING_SERVICE is enabled.
27 class SafeBrowsingResourceThrottleFactory {
28 public:
29 // Registers a factory. Does not take the ownership of the factory. The
30 // caller has to make sure the factory stays alive and properly destroyed.
31 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory);
33 // Creates a new resource throttle for safe browsing
34 static content::ResourceThrottle* Create(
35 net::URLRequest* request,
36 content::ResourceContext* resource_context,
37 content::ResourceType resource_type,
38 SafeBrowsingService* service);
40 protected:
41 SafeBrowsingResourceThrottleFactory() { }
42 virtual ~SafeBrowsingResourceThrottleFactory() { }
44 virtual content::ResourceThrottle* CreateResourceThrottle(
45 net::URLRequest* request,
46 content::ResourceContext* resource_context,
47 content::ResourceType resource_type,
48 SafeBrowsingService* service) = 0;
50 private:
51 static SafeBrowsingResourceThrottleFactory* factory_;
53 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory);
56 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_