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

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

Issue 12217095: Remove unused pieces of URLRequestJobFactory API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 // TODO(shalev): Move this to URLRequestJobFactoryImpl. 26 // TODO(shalev): Move this to URLRequestJobFactoryImpl.
27 class NET_EXPORT ProtocolHandler { 27 class NET_EXPORT ProtocolHandler {
28 public: 28 public:
29 virtual ~ProtocolHandler(); 29 virtual ~ProtocolHandler();
30 30
31 virtual URLRequestJob* MaybeCreateJob( 31 virtual URLRequestJob* MaybeCreateJob(
32 URLRequest* request, NetworkDelegate* network_delegate) const = 0; 32 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
33 }; 33 };
34 34
35 // TODO(shalev): Move this to URLRequestJobFactoryImpl.
36 class NET_EXPORT Interceptor {
37 public:
38 virtual ~Interceptor();
39
40 // Called for every request made. Should return a new job to handle the
41 // request if it should be intercepted, or NULL to allow the request to
42 // be handled in the normal manner.
43 virtual URLRequestJob* MaybeIntercept(
44 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
45
46 // Called after having received a redirect response, but prior to the
47 // the request delegate being informed of the redirect. Can return a new
48 // job to replace the existing job if it should be intercepted, or NULL
49 // to allow the normal handling to continue. If a new job is provided,
50 // the delegate never sees the original redirect response, instead the
51 // response produced by the intercept job will be returned.
52 virtual URLRequestJob* MaybeInterceptRedirect(
53 const GURL& location,
54 URLRequest* request,
55 NetworkDelegate* network_delegate) const = 0;
56
57 // Called after having received a final response, but prior to the
58 // the request delegate being informed of the response. This is also
59 // called when there is no server response at all to allow interception
60 // on DNS or network errors. Can return a new job to replace the existing
61 // job if it should be intercepted, or NULL to allow the normal handling to
62 // continue. If a new job is provided, the delegate never sees the original
63 // response, instead the response produced by the intercept job will be
64 // returned.
65 virtual URLRequestJob* MaybeInterceptResponse(
66 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
67
68 // Returns true if this interceptor handles requests for URLs with the
69 // given protocol. Returning false does not imply that this interceptor
70 // can't or won't handle requests with the given protocol.
71 virtual bool WillHandleProtocol(const std::string& protocol) const;
72 };
73
74 URLRequestJobFactory(); 35 URLRequestJobFactory();
75 virtual ~URLRequestJobFactory(); 36 virtual ~URLRequestJobFactory();
76 37
77 // TODO(shalev): Remove this from the interface.
78 // Sets the ProtocolHandler for a scheme. Returns true on success, false on
79 // failure (a ProtocolHandler already exists for |scheme|). On success,
80 // URLRequestJobFactory takes ownership of |protocol_handler|.
81 virtual bool SetProtocolHandler(const std::string& scheme,
82 ProtocolHandler* protocol_handler) = 0;
83
84 // TODO(shalev): Remove this from the interface.
85 // Takes ownership of |interceptor|. Adds it to the end of the Interceptor
86 // list.
87 virtual void AddInterceptor(Interceptor* interceptor) = 0;
88
89 // TODO(shalev): Consolidate MaybeCreateJobWithInterceptor and
90 // MaybeCreateJobWithProtocolHandler into a single method.
91 virtual URLRequestJob* MaybeCreateJobWithInterceptor(
92 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
93
94 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( 38 virtual URLRequestJob* MaybeCreateJobWithProtocolHandler(
95 const std::string& scheme, 39 const std::string& scheme,
96 URLRequest* request, 40 URLRequest* request,
97 NetworkDelegate* network_delegate) const = 0; 41 NetworkDelegate* network_delegate) const = 0;
98 42
99 virtual URLRequestJob* MaybeInterceptRedirect(
100 const GURL& location,
101 URLRequest* request,
102 NetworkDelegate* network_delegate) const = 0;
103
104 virtual URLRequestJob* MaybeInterceptResponse(
105 URLRequest* request, NetworkDelegate* network_delegate) const = 0;
106
107 virtual bool IsHandledProtocol(const std::string& scheme) const = 0; 43 virtual bool IsHandledProtocol(const std::string& scheme) const = 0;
108 44
109 virtual bool IsHandledURL(const GURL& url) const = 0; 45 virtual bool IsHandledURL(const GURL& url) const = 0;
110 46
111 private: 47 private:
112 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory); 48 DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactory);
113 }; 49 };
114 50
115 } // namespace net 51 } // namespace net
116 52
117 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_ 53 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698