OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HTTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
17 #include "net/http/http_request_info.h" | 17 #include "net/http/http_request_info.h" |
18 #include "net/url_request/url_request_job.h" | 18 #include "net/url_request/url_request_job.h" |
19 #include "net/url_request/url_request_throttler_entry_interface.h" | 19 #include "net/url_request/url_request_throttler_entry_interface.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class HttpResponseInfo; | 22 class HttpResponseInfo; |
23 class HttpTransaction; | 23 class HttpTransaction; |
24 } | 24 } |
25 class URLRequestContext; | 25 class URLRequestContext; |
26 | 26 |
27 // A URLRequestJob subclass that is built on top of HttpTransaction. It | 27 // A net::URLRequestJob subclass that is built on top of HttpTransaction. It |
28 // provides an implementation for both HTTP and HTTPS. | 28 // provides an implementation for both HTTP and HTTPS. |
29 class URLRequestHttpJob : public URLRequestJob { | 29 class URLRequestHttpJob : public net::URLRequestJob { |
30 public: | 30 public: |
31 static URLRequestJob* Factory(net::URLRequest* request, | 31 static net::URLRequestJob* Factory(net::URLRequest* request, |
32 const std::string& scheme); | 32 const std::string& scheme); |
33 | 33 |
34 protected: | 34 protected: |
35 explicit URLRequestHttpJob(net::URLRequest* request); | 35 explicit URLRequestHttpJob(net::URLRequest* request); |
36 | 36 |
37 // URLRequestJob methods: | 37 // net::URLRequestJob methods: |
38 virtual void SetUpload(net::UploadData* upload); | 38 virtual void SetUpload(net::UploadData* upload); |
39 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); | 39 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); |
40 virtual void Start(); | 40 virtual void Start(); |
41 virtual void Kill(); | 41 virtual void Kill(); |
42 virtual net::LoadState GetLoadState() const; | 42 virtual net::LoadState GetLoadState() const; |
43 virtual uint64 GetUploadProgress() const; | 43 virtual uint64 GetUploadProgress() const; |
44 virtual bool GetMimeType(std::string* mime_type) const; | 44 virtual bool GetMimeType(std::string* mime_type) const; |
45 virtual bool GetCharset(std::string* charset); | 45 virtual bool GetCharset(std::string* charset); |
46 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 46 virtual void GetResponseInfo(net::HttpResponseInfo* info); |
47 virtual bool GetResponseCookies(std::vector<std::string>* cookies); | 47 virtual bool GetResponseCookies(std::vector<std::string>* cookies); |
48 virtual int GetResponseCode() const; | 48 virtual int GetResponseCode() const; |
49 virtual bool GetContentEncodings( | 49 virtual bool GetContentEncodings( |
50 std::vector<Filter::FilterType>* encoding_type); | 50 std::vector<Filter::FilterType>* encoding_type); |
51 virtual bool IsCachedContent() const { return is_cached_content_; } | 51 virtual bool IsCachedContent() const { return is_cached_content_; } |
52 virtual bool IsSdchResponse() const; | 52 virtual bool IsSdchResponse() const; |
53 virtual bool IsSafeRedirect(const GURL& location); | 53 virtual bool IsSafeRedirect(const GURL& location); |
54 virtual bool NeedsAuth(); | 54 virtual bool NeedsAuth(); |
55 virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*); | 55 virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*); |
56 virtual void SetAuth(const string16& username, | 56 virtual void SetAuth(const string16& username, |
57 const string16& password); | 57 const string16& password); |
58 virtual void CancelAuth(); | 58 virtual void CancelAuth(); |
59 virtual void ContinueWithCertificate(net::X509Certificate* client_cert); | 59 virtual void ContinueWithCertificate(net::X509Certificate* client_cert); |
60 virtual void ContinueDespiteLastError(); | 60 virtual void ContinueDespiteLastError(); |
61 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 61 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
62 virtual void StopCaching(); | 62 virtual void StopCaching(); |
63 | 63 |
64 // Shadows URLRequestJob's version of this method so we can grab cookies. | 64 // Shadows net::URLRequestJob's version of this method so we can grab cookies. |
65 void NotifyHeadersComplete(); | 65 void NotifyHeadersComplete(); |
66 | 66 |
67 void DestroyTransaction(); | 67 void DestroyTransaction(); |
68 void StartTransaction(); | 68 void StartTransaction(); |
69 void AddExtraHeaders(); | 69 void AddExtraHeaders(); |
70 void AddCookieHeaderAndStart(); | 70 void AddCookieHeaderAndStart(); |
71 void SaveCookiesAndNotifyHeadersComplete(); | 71 void SaveCookiesAndNotifyHeadersComplete(); |
72 void SaveNextCookie(); | 72 void SaveNextCookie(); |
73 void FetchResponseCookies(const net::HttpResponseInfo* response_info, | 73 void FetchResponseCookies(const net::HttpResponseInfo* response_info, |
74 std::vector<std::string>* cookies); | 74 std::vector<std::string>* cookies); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 private: | 136 private: |
137 virtual ~URLRequestHttpJob(); | 137 virtual ~URLRequestHttpJob(); |
138 | 138 |
139 ScopedRunnableMethodFactory<URLRequestHttpJob> method_factory_; | 139 ScopedRunnableMethodFactory<URLRequestHttpJob> method_factory_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 141 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
142 }; | 142 }; |
143 | 143 |
144 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 144 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
OLD | NEW |