OLD | NEW |
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_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/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/string16.h" | |
16 #include "base/task.h" | 15 #include "base/task.h" |
17 #include "base/time.h" | 16 #include "base/time.h" |
18 #include "net/base/auth.h" | 17 #include "net/base/auth.h" |
19 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
20 #include "net/base/cookie_store.h" | 19 #include "net/base/cookie_store.h" |
21 #include "net/http/http_request_info.h" | 20 #include "net/http/http_request_info.h" |
22 #include "net/url_request/url_request_job.h" | 21 #include "net/url_request/url_request_job.h" |
23 #include "net/url_request/url_request_throttler_entry_interface.h" | 22 #include "net/url_request/url_request_throttler_entry_interface.h" |
24 | 23 |
25 namespace net { | 24 namespace net { |
(...skipping 29 matching lines...) Expand all Loading... |
55 | 54 |
56 // Process the Strict-Transport-Security header, if one exists. | 55 // Process the Strict-Transport-Security header, if one exists. |
57 void ProcessStrictTransportSecurityHeader(); | 56 void ProcessStrictTransportSecurityHeader(); |
58 | 57 |
59 // |result| should be net::OK, or the request is canceled. | 58 // |result| should be net::OK, or the request is canceled. |
60 void OnHeadersReceivedCallback(int result); | 59 void OnHeadersReceivedCallback(int result); |
61 void OnStartCompleted(int result); | 60 void OnStartCompleted(int result); |
62 void OnReadCompleted(int result); | 61 void OnReadCompleted(int result); |
63 void NotifyBeforeSendHeadersCallback(int result); | 62 void NotifyBeforeSendHeadersCallback(int result); |
64 | 63 |
65 void RestartTransactionWithAuth(const string16& username, | 64 void RestartTransactionWithAuth(const AuthCredentials& credentials); |
66 const string16& password); | |
67 | 65 |
68 // Overridden from URLRequestJob: | 66 // Overridden from URLRequestJob: |
69 virtual void SetUpload(UploadData* upload) OVERRIDE; | 67 virtual void SetUpload(UploadData* upload) OVERRIDE; |
70 virtual void SetExtraRequestHeaders( | 68 virtual void SetExtraRequestHeaders( |
71 const HttpRequestHeaders& headers) OVERRIDE; | 69 const HttpRequestHeaders& headers) OVERRIDE; |
72 virtual void Start() OVERRIDE; | 70 virtual void Start() OVERRIDE; |
73 virtual void Kill() OVERRIDE; | 71 virtual void Kill() OVERRIDE; |
74 virtual LoadState GetLoadState() const OVERRIDE; | 72 virtual LoadState GetLoadState() const OVERRIDE; |
75 virtual uint64 GetUploadProgress() const OVERRIDE; | 73 virtual uint64 GetUploadProgress() const OVERRIDE; |
76 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 74 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
77 virtual bool GetCharset(std::string* charset) OVERRIDE; | 75 virtual bool GetCharset(std::string* charset) OVERRIDE; |
78 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; | 76 virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; |
79 virtual bool GetResponseCookies(std::vector<std::string>* cookies) OVERRIDE; | 77 virtual bool GetResponseCookies(std::vector<std::string>* cookies) OVERRIDE; |
80 virtual int GetResponseCode() const OVERRIDE; | 78 virtual int GetResponseCode() const OVERRIDE; |
81 virtual Filter* SetupFilter() const OVERRIDE; | 79 virtual Filter* SetupFilter() const OVERRIDE; |
82 virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; | 80 virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; |
83 virtual bool NeedsAuth() OVERRIDE; | 81 virtual bool NeedsAuth() OVERRIDE; |
84 virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) OVERRIDE; | 82 virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) OVERRIDE; |
85 virtual void SetAuth(const string16& username, | 83 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; |
86 const string16& password) OVERRIDE; | |
87 virtual void CancelAuth() OVERRIDE; | 84 virtual void CancelAuth() OVERRIDE; |
88 virtual void ContinueWithCertificate(X509Certificate* client_cert) OVERRIDE; | 85 virtual void ContinueWithCertificate(X509Certificate* client_cert) OVERRIDE; |
89 virtual void ContinueDespiteLastError() OVERRIDE; | 86 virtual void ContinueDespiteLastError() OVERRIDE; |
90 virtual bool ReadRawData(IOBuffer* buf, int buf_size, | 87 virtual bool ReadRawData(IOBuffer* buf, int buf_size, |
91 int *bytes_read) OVERRIDE; | 88 int *bytes_read) OVERRIDE; |
92 virtual void StopCaching() OVERRIDE; | 89 virtual void StopCaching() OVERRIDE; |
93 virtual void DoneReading() OVERRIDE; | 90 virtual void DoneReading() OVERRIDE; |
94 virtual HostPortPair GetSocketAddress() const OVERRIDE; | 91 virtual HostPortPair GetSocketAddress() const OVERRIDE; |
95 virtual void NotifyURLRequestDestroyed() OVERRIDE; | 92 virtual void NotifyURLRequestDestroyed() OVERRIDE; |
96 | 93 |
97 // Keep a reference to the url request context to be sure it's not deleted | 94 // Keep a reference to the url request context to be sure it's not deleted |
98 // before us. | 95 // before us. |
99 scoped_refptr<const URLRequestContext> context_; | 96 scoped_refptr<const URLRequestContext> context_; |
100 | 97 |
101 HttpRequestInfo request_info_; | 98 HttpRequestInfo request_info_; |
102 const HttpResponseInfo* response_info_; | 99 const HttpResponseInfo* response_info_; |
103 | 100 |
104 std::vector<std::string> response_cookies_; | 101 std::vector<std::string> response_cookies_; |
105 size_t response_cookies_save_index_; | 102 size_t response_cookies_save_index_; |
106 | 103 |
107 // Auth states for proxy and origin server. | 104 // Auth states for proxy and origin server. |
108 AuthState proxy_auth_state_; | 105 AuthState proxy_auth_state_; |
109 AuthState server_auth_state_; | 106 AuthState server_auth_state_; |
110 | 107 AuthCredentials auth_credentials_; |
111 string16 username_; | |
112 string16 password_; | |
113 | 108 |
114 OldCompletionCallbackImpl<URLRequestHttpJob> start_callback_; | 109 OldCompletionCallbackImpl<URLRequestHttpJob> start_callback_; |
115 OldCompletionCallbackImpl<URLRequestHttpJob> read_callback_; | 110 OldCompletionCallbackImpl<URLRequestHttpJob> read_callback_; |
116 OldCompletionCallbackImpl<URLRequestHttpJob> | 111 OldCompletionCallbackImpl<URLRequestHttpJob> |
117 notify_before_headers_sent_callback_; | 112 notify_before_headers_sent_callback_; |
118 | 113 |
119 bool read_in_progress_; | 114 bool read_in_progress_; |
120 | 115 |
121 // An URL for an SDCH dictionary as suggested in a Get-Dictionary HTTP header. | 116 // An URL for an SDCH dictionary as suggested in a Get-Dictionary HTTP header. |
122 GURL sdch_dictionary_url_; | 117 GURL sdch_dictionary_url_; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // NetworkDelegate::NotifyURLRequestDestroyed has not been called, yet, | 228 // NetworkDelegate::NotifyURLRequestDestroyed has not been called, yet, |
234 // to inform the NetworkDelegate that it may not call back. | 229 // to inform the NetworkDelegate that it may not call back. |
235 bool awaiting_callback_; | 230 bool awaiting_callback_; |
236 | 231 |
237 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 232 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
238 }; | 233 }; |
239 | 234 |
240 } // namespace net | 235 } // namespace net |
241 | 236 |
242 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 237 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
OLD | NEW |