| 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 | 10 |
| 10 class SafeBrowsingService; | 11 class SafeBrowsingService; |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 class ResourceContext; | 14 class ResourceContext; |
| 14 class ResourceThrottle; | 15 class ResourceThrottle; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 class URLRequest; | 19 class URLRequest; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is | 22 // Factory for creating a SafeBrowsingResourceThrottle. If a factory is |
| 22 // registered, the factory's CreateResourceThrottle() is called. Otherwise, | 23 // registered, the factory's CreateResourceThrottle() is called. Otherwise, |
| 23 // when FULL_SAFE_BROWSING is enabled, a new SafeBrowsingResourceThrottle is | 24 // when FULL_SAFE_BROWSING is enabled, a new SafeBrowsingResourceThrottle is |
| 24 // returned, or NULL if MOBILE_SAFE_BROWSING is enabled. | 25 // returned, or NULL if MOBILE_SAFE_BROWSING is enabled. |
| 25 class SafeBrowsingResourceThrottleFactory { | 26 class SafeBrowsingResourceThrottleFactory { |
| 26 public: | 27 public: |
| 27 // Registers a factory. Does not take the ownership of the factory. The | 28 // 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 // caller has to make sure the factory stays alive and properly destroyed. |
| 29 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory); | 30 static void RegisterFactory(SafeBrowsingResourceThrottleFactory* factory); |
| 30 | 31 |
| 31 // Creates a new resource throttle for safe browsing | 32 // Creates a new resource throttle for safe browsing |
| 32 static content::ResourceThrottle* Create( | 33 static content::ResourceThrottle* Create( |
| 33 net::URLRequest* request, | 34 net::URLRequest* request, |
| 34 content::ResourceContext* resource_context, | 35 content::ResourceContext* resource_context, |
| 35 bool is_subresource, | 36 content::ResourceType resource_type, |
| 36 SafeBrowsingService* service); | 37 SafeBrowsingService* service); |
| 37 | 38 |
| 38 protected: | 39 protected: |
| 39 SafeBrowsingResourceThrottleFactory() { } | 40 SafeBrowsingResourceThrottleFactory() { } |
| 40 virtual ~SafeBrowsingResourceThrottleFactory() { } | 41 virtual ~SafeBrowsingResourceThrottleFactory() { } |
| 41 | 42 |
| 42 virtual content::ResourceThrottle* CreateResourceThrottle( | 43 virtual content::ResourceThrottle* CreateResourceThrottle( |
| 43 net::URLRequest* request, | 44 net::URLRequest* request, |
| 44 content::ResourceContext* resource_context, | 45 content::ResourceContext* resource_context, |
| 45 bool is_subresource, | 46 content::ResourceType resource_type, |
| 46 SafeBrowsingService* service) = 0; | 47 SafeBrowsingService* service) = 0; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 static SafeBrowsingResourceThrottleFactory* factory_; | 50 static SafeBrowsingResourceThrottleFactory* factory_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); | 52 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_
H_ | 55 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_
H_ |
| OLD | NEW |