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 | 9 |
10 class SafeBrowsingService; | 10 class SafeBrowsingService; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class ResourceContext; | 13 class ResourceContext; |
14 class ResourceThrottle; | 14 class ResourceThrottle; |
15 } | 15 } |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class URLRequest; | 18 class URLRequest; |
19 } | 19 } |
20 | 20 |
21 // Factory for creating a SafeBrowsingResourceThrottle. When FULL_SAFE_BROWSING | 21 // Factory for creating a SafeBrowsingResourceThrottle. When |
22 // is enabled, creates a SafeBrowsingResourceThrottle. When MOBILE_SAFE_BROWSING | 22 // SAFE_BROWSING_DATABASE is enabled, creates a |
23 // is enabled, the default implementation creates a null resource throttle, | 23 // SafeBrowsingResourceThrottle. When only SAFE_BROWSING_SERVICE is enabled, the |
24 // therefore, a factory has to be registered before using this. | 24 // default implementation creates a null resource throttle, therefore, a factory |
25 // has to be registered before using this. | |
25 class SafeBrowsingResourceThrottleFactory { | 26 class SafeBrowsingResourceThrottleFactory { |
26 public: | 27 public: |
27 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 28 #if defined(SAFE_BROWSING_SERVICE) |
28 // 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 |
29 // 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. |
30 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory) { | 31 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory) { |
31 factory_ = factory; | 32 factory_ = factory; |
32 } | 33 } |
33 #endif | 34 #endif |
Ryan Sleevi
2014/07/24 22:47:50
Does it make sense to
1) Move the implementation t
Scott Hess - ex-Googler
2014/07/29 22:52:31
I cannot find anyone who calls this. I'm breaking
Scott Hess - ex-Googler
2014/07/30 21:29:57
OK, apparently Android uses it in some way, so I'v
| |
34 | 35 |
35 // Creates a new resource throttle for safe browsing | 36 // Creates a new resource throttle for safe browsing |
36 static content::ResourceThrottle* Create( | 37 static content::ResourceThrottle* Create( |
37 net::URLRequest* request, | 38 net::URLRequest* request, |
38 content::ResourceContext* resource_context, | 39 content::ResourceContext* resource_context, |
39 bool is_subresource, | 40 bool is_subresource, |
40 SafeBrowsingService* service); | 41 SafeBrowsingService* service); |
41 | 42 |
42 protected: | 43 protected: |
43 SafeBrowsingResourceThrottleFactory() { } | 44 SafeBrowsingResourceThrottleFactory() { } |
44 virtual ~SafeBrowsingResourceThrottleFactory() { } | 45 virtual ~SafeBrowsingResourceThrottleFactory() { } |
45 | 46 |
46 virtual content::ResourceThrottle* CreateResourceThrottle( | 47 virtual content::ResourceThrottle* CreateResourceThrottle( |
47 net::URLRequest* request, | 48 net::URLRequest* request, |
48 content::ResourceContext* resource_context, | 49 content::ResourceContext* resource_context, |
49 bool is_subresource, | 50 bool is_subresource, |
50 SafeBrowsingService* service) = 0; | 51 SafeBrowsingService* service) = 0; |
51 | 52 |
52 private: | 53 private: |
53 static SafeBrowsingResourceThrottleFactory* factory_; | 54 static SafeBrowsingResourceThrottleFactory* factory_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); | 56 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); |
56 }; | 57 }; |
57 | 58 |
58 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_ H_ | 59 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_ H_ |
OLD | NEW |