Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: net/url_request/url_request_job_factory.h

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_FACTORY_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace net { 17 namespace net {
18 18
19 class NetworkDelegate;
19 class URLRequest; 20 class URLRequest;
20 class URLRequestJob; 21 class URLRequestJob;
21 22
22 class NET_EXPORT URLRequestJobFactory 23 class NET_EXPORT URLRequestJobFactory
23 : NON_EXPORTED_BASE(public base::NonThreadSafe) { 24 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
24 public: 25 public:
25 class NET_EXPORT ProtocolHandler { 26 class NET_EXPORT ProtocolHandler {
26 public: 27 public:
27 virtual ~ProtocolHandler(); 28 virtual ~ProtocolHandler();
28 29
29 virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const = 0; 30 virtual URLRequestJob* MaybeCreateJob(
31 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
30 }; 32 };
31 33
32 class NET_EXPORT Interceptor { 34 class NET_EXPORT Interceptor {
33 public: 35 public:
34 virtual ~Interceptor(); 36 virtual ~Interceptor();
35 37
36 // Called for every request made. Should return a new job to handle the 38 // Called for every request made. Should return a new job to handle the
37 // request if it should be intercepted, or NULL to allow the request to 39 // request if it should be intercepted, or NULL to allow the request to
38 // be handled in the normal manner. 40 // be handled in the normal manner.
39 virtual URLRequestJob* MaybeIntercept(URLRequest* request) const = 0; 41 virtual URLRequestJob* MaybeIntercept(URLRequest* request) const = 0;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // URLRequestJobFactory takes ownership of |protocol_handler|. 75 // URLRequestJobFactory takes ownership of |protocol_handler|.
74 bool SetProtocolHandler(const std::string& scheme, 76 bool SetProtocolHandler(const std::string& scheme,
75 ProtocolHandler* protocol_handler); 77 ProtocolHandler* protocol_handler);
76 78
77 // Takes ownership of |interceptor|. Adds it to the end of the Interceptor 79 // Takes ownership of |interceptor|. Adds it to the end of the Interceptor
78 // list. 80 // list.
79 void AddInterceptor(Interceptor* interceptor); 81 void AddInterceptor(Interceptor* interceptor);
80 82
81 URLRequestJob* MaybeCreateJobWithInterceptor(URLRequest* request) const; 83 URLRequestJob* MaybeCreateJobWithInterceptor(URLRequest* request) const;
82 84
83 URLRequestJob* MaybeCreateJobWithProtocolHandler(const std::string& scheme, 85 URLRequestJob* MaybeCreateJobWithProtocolHandler(
84 URLRequest* request) const; 86 const std::string& scheme,
87 URLRequest* request,
88 NetworkDelegate* network_delegate) const;
85 89
86 URLRequestJob* MaybeInterceptRedirect(const GURL& location, 90 URLRequestJob* MaybeInterceptRedirect(const GURL& location,
87 URLRequest* request) const; 91 URLRequest* request) const;
88 92
89 URLRequestJob* MaybeInterceptResponse(URLRequest* request) const; 93 URLRequestJob* MaybeInterceptResponse(URLRequest* request) const;
90 94
91 bool IsHandledProtocol(const std::string& scheme) const; 95 bool IsHandledProtocol(const std::string& scheme) const;
92 96
93 bool IsHandledURL(const GURL& url) const; 97 bool IsHandledURL(const GURL& url) const;
94 98
95 private: 99 private:
96 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap; 100 typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap;
97 typedef std::vector<Interceptor*> InterceptorList; 101 typedef std::vector<Interceptor*> InterceptorList;
98 102
99 ProtocolHandlerMap protocol_handler_map_; 103 ProtocolHandlerMap protocol_handler_map_;
100 InterceptorList interceptors_; 104 InterceptorList interceptors_;
101 105
102 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory); 106 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory);
103 }; 107 };
104 108
105 } // namespace net 109 } // namespace net
106 110
107 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ 111 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698