| 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_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/system_monitor/system_monitor.h" | 14 #include "base/system_monitor/system_monitor.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "net/base/filter.h" | 16 #include "net/base/filter.h" |
| 17 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
| 19 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
| 20 #include "net/base/request_priority.h" |
| 20 #include "net/base/upload_progress.h" | 21 #include "net/base/upload_progress.h" |
| 21 #include "net/cookies/canonical_cookie.h" | 22 #include "net/cookies/canonical_cookie.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class AuthChallengeInfo; | 26 class AuthChallengeInfo; |
| 26 class AuthCredentials; | 27 class AuthCredentials; |
| 27 class CookieOptions; | 28 class CookieOptions; |
| 28 class HttpRequestHeaders; | 29 class HttpRequestHeaders; |
| 29 class HttpResponseInfo; | 30 class HttpResponseInfo; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the | 47 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the |
| 47 // request was destroyed. | 48 // request was destroyed. |
| 48 URLRequest* request() const { | 49 URLRequest* request() const { |
| 49 return request_; | 50 return request_; |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Sets the upload data, most requests have no upload data, so this is a NOP. | 53 // Sets the upload data, most requests have no upload data, so this is a NOP. |
| 53 // Job types supporting upload data will override this. | 54 // Job types supporting upload data will override this. |
| 54 virtual void SetUpload(UploadDataStream* upload_data_stream); | 55 virtual void SetUpload(UploadDataStream* upload_data_stream); |
| 55 | 56 |
| 56 // Sets extra request headers for Job types that support request headers. | 57 // Sets extra request headers for Job types that support request |
| 58 // headers. Called once before Start() is called. |
| 57 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers); | 59 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers); |
| 58 | 60 |
| 61 // Sets the priority of the job. Called once before Start() is |
| 62 // called, but also when the priority of the parent request changes. |
| 63 virtual void SetPriority(RequestPriority priority); |
| 64 |
| 59 // If any error occurs while starting the Job, NotifyStartError should be | 65 // If any error occurs while starting the Job, NotifyStartError should be |
| 60 // called. | 66 // called. |
| 61 // This helps ensure that all errors follow more similar notification code | 67 // This helps ensure that all errors follow more similar notification code |
| 62 // paths, which should simplify testing. | 68 // paths, which should simplify testing. |
| 63 virtual void Start() = 0; | 69 virtual void Start() = 0; |
| 64 | 70 |
| 65 // This function MUST somehow call NotifyDone/NotifyCanceled or some requests | 71 // This function MUST somehow call NotifyDone/NotifyCanceled or some requests |
| 66 // will get leaked. Certain callers use that message to know when they can | 72 // will get leaked. Certain callers use that message to know when they can |
| 67 // delete their URLRequest object, even when doing a cancel. The default | 73 // delete their URLRequest object, even when doing a cancel. The default |
| 68 // Kill implementation calls NotifyCanceled, so it is recommended that | 74 // Kill implementation calls NotifyCanceled, so it is recommended that |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 NetworkDelegate* network_delegate_; | 392 NetworkDelegate* network_delegate_; |
| 387 | 393 |
| 388 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 394 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
| 389 | 395 |
| 390 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 396 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 391 }; | 397 }; |
| 392 | 398 |
| 393 } // namespace net | 399 } // namespace net |
| 394 | 400 |
| 395 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 401 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| OLD | NEW |