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 NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 // (i.e., it is safe to call SupportsScheme on any thread). | 29 // (i.e., it is safe to call SupportsScheme on any thread). |
30 // | 30 // |
31 class URLRequestJobManager { | 31 class URLRequestJobManager { |
32 public: | 32 public: |
33 // Returns the singleton instance. | 33 // Returns the singleton instance. |
34 static URLRequestJobManager* GetInstance(); | 34 static URLRequestJobManager* GetInstance(); |
35 | 35 |
36 // Instantiate an URLRequestJob implementation based on the registered | 36 // Instantiate an URLRequestJob implementation based on the registered |
37 // interceptors and protocol factories. This will always succeed in | 37 // interceptors and protocol factories. This will always succeed in |
38 // returning a job unless we are--in the extreme case--out of memory. | 38 // returning a job unless we are--in the extreme case--out of memory. |
39 URLRequestJob* CreateJob(URLRequest* request) const; | 39 URLRequestJob* CreateJob(URLRequest* request, |
| 40 NetworkDelegate* network_delegate) const; |
40 | 41 |
41 // Allows interceptors to hijack the request after examining the new location | 42 // Allows interceptors to hijack the request after examining the new location |
42 // of a redirect. Returns NULL if no interceptor intervenes. | 43 // of a redirect. Returns NULL if no interceptor intervenes. |
43 URLRequestJob* MaybeInterceptRedirect(URLRequest* request, | 44 URLRequestJob* MaybeInterceptRedirect(URLRequest* request, |
44 const GURL& location) const; | 45 NetworkDelegate* network_delegate, |
| 46 const GURL& location) const; |
45 | 47 |
46 // Allows interceptors to hijack the request after examining the response | 48 // Allows interceptors to hijack the request after examining the response |
47 // status and headers. This is also called when there is no server response | 49 // status and headers. This is also called when there is no server response |
48 // at all to allow interception of failed requests due to network errors. | 50 // at all to allow interception of failed requests due to network errors. |
49 // Returns NULL if no interceptor intervenes. | 51 // Returns NULL if no interceptor intervenes. |
50 URLRequestJob* MaybeInterceptResponse(URLRequest* request) const; | 52 URLRequestJob* MaybeInterceptResponse( |
| 53 URLRequest* request, NetworkDelegate* network_delegate) const; |
51 | 54 |
52 // Returns true if there is a protocol factory registered for the given | 55 // Returns true if there is a protocol factory registered for the given |
53 // scheme. Note: also returns true if there is a built-in handler for the | 56 // scheme. Note: also returns true if there is a built-in handler for the |
54 // given scheme. | 57 // given scheme. |
55 bool SupportsScheme(const std::string& scheme) const; | 58 bool SupportsScheme(const std::string& scheme) const; |
56 | 59 |
57 // Register a protocol factory associated with the given scheme. The factory | 60 // Register a protocol factory associated with the given scheme. The factory |
58 // parameter may be null to clear any existing association. Returns the | 61 // parameter may be null to clear any existing association. Returns the |
59 // previously registered protocol factory if any. | 62 // previously registered protocol factory if any. |
60 URLRequest::ProtocolFactory* RegisterProtocolFactory( | 63 URLRequest::ProtocolFactory* RegisterProtocolFactory( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 mutable base::Lock lock_; | 107 mutable base::Lock lock_; |
105 FactoryMap factories_; | 108 FactoryMap factories_; |
106 InterceptorList interceptors_; | 109 InterceptorList interceptors_; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); | 111 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); |
109 }; | 112 }; |
110 | 113 |
111 } // namespace net | 114 } // namespace net |
112 | 115 |
113 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 116 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
OLD | NEW |