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 #ifndef CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/public/common/resource_type.h" | 9 #include "content/public/common/resource_type.h" |
10 | 10 |
11 class SafeBrowsingService; | 11 class SafeBrowsingService; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class ResourceContext; | 14 class ResourceContext; |
15 class ResourceThrottle; | 15 class ResourceThrottle; |
16 } | 16 } |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 class URLRequest; | 19 class URLRequest; |
20 } | 20 } |
21 | 21 |
22 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is | 22 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is |
23 // registered, the factory's CreateResourceThrottle() is called. Otherwise, | 23 // registered, the factory's CreateResourceThrottle() is called. Otherwise, |
24 // when SAFE_BROWSING_DB_LOCAL is enabled, a new | 24 // if SAFE_BROWSING_DB_LOCAL || SAFE_BROWSING_DB_REMOTE is enabled, a new |
25 // SafeBrowsingResourceThrottle is returned, or NULL if only | 25 // SafeBrowsingResourceThrottle is returned, or NULL if only |
26 // SAFE_BROWSING_SERVICE is enabled. | 26 // SAFE_BROWSING_SERVICE is enabled. |
27 // TODO(nparker): Add support SAFE_BROWSING_DB_REMOTE | |
28 class SafeBrowsingResourceThrottleFactory { | 27 class SafeBrowsingResourceThrottleFactory { |
29 public: | 28 public: |
30 // Registers a factory. Does not take the ownership of the factory. The | 29 // Registers a factory. Does not take the ownership of the factory. The |
31 // caller has to make sure the factory stays alive and properly destroyed. | 30 // caller has to make sure the factory stays alive and properly destroyed. |
32 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory); | 31 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory); |
33 | 32 |
34 // Creates a new resource throttle for safe browsing | 33 // Creates a new resource throttle for safe browsing |
35 static content::ResourceThrottle* Create( | 34 static content::ResourceThrottle* Create( |
36 net::URLRequest* request, | 35 net::URLRequest* request, |
37 content::ResourceContext* resource_context, | 36 content::ResourceContext* resource_context, |
(...skipping 10 matching lines...) Expand all Loading... |
48 content::ResourceType resource_type, | 47 content::ResourceType resource_type, |
49 SafeBrowsingService* service) = 0; | 48 SafeBrowsingService* service) = 0; |
50 | 49 |
51 private: | 50 private: |
52 static SafeBrowsingResourceThrottleFactory* factory_; | 51 static SafeBrowsingResourceThrottleFactory* factory_; |
53 | 52 |
54 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); | 53 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); |
55 }; | 54 }; |
56 | 55 |
57 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_
H_ | 56 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_
H_ |
OLD | NEW |