Fix build break
[chromium-blink-merge.git] / chrome / browser / renderer_host / safe_browsing_resource_throttle_factory.h
blob9343538becaf7f4b4e4000556688eb602444a192
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;
12 namespace content {
13 class ResourceThrottle;
16 namespace net {
17 class URLRequest;
20 // Factory for creating a SafeBrowsingResourceThrottle. When FULL_SAFE_BROWSING
21 // is enabled, creates a SafeBrowsingResourceThrottle. When MOBILE_SAFE_BROWSING
22 // is enabled, the default implementation creates a null resource throttle,
23 // therefore, a factory has to be registered before using this.
24 class SafeBrowsingResourceThrottleFactory {
25 public:
26 #if defined(MOBILE_SAFE_BROWSING)
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) {
30 factory_ = factory;
32 #endif
34 // Creates a new resource throttle for safe browsing
35 static content::ResourceThrottle* Create(
36 net::URLRequest* request,
37 int render_process_host_id,
38 int render_view_id,
39 bool is_subresource,
40 SafeBrowsingService* service);
42 protected:
43 SafeBrowsingResourceThrottleFactory() { }
44 virtual ~SafeBrowsingResourceThrottleFactory() { }
46 virtual content::ResourceThrottle* CreateResourceThrottle(
47 net::URLRequest* request,
48 int render_process_host_id,
49 int render_view_id,
50 bool is_subresource,
51 SafeBrowsingService* service) = 0;
53 private:
54 static SafeBrowsingResourceThrottleFactory* factory_;
56 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingResourceThrottleFactory);
59 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_RESOURCE_THROTTLE_FACTORY_H_