| 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_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // | 297 // |
| 298 // If an error occurred, request->status() will contain the error, | 298 // If an error occurred, request->status() will contain the error, |
| 299 // and bytes read will be -1. | 299 // and bytes read will be -1. |
| 300 virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0; | 300 virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0; |
| 301 | 301 |
| 302 protected: | 302 protected: |
| 303 virtual ~Delegate() {} | 303 virtual ~Delegate() {} |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 // Initialize an URL request. | 306 // Initialize an URL request. |
| 307 URLRequest(const GURL& url, Delegate* delegate); | 307 URLRequest(const GURL& url, |
| 308 Delegate* delegate, |
| 309 const URLRequestContext* context); |
| 308 | 310 |
| 309 // If destroyed after Start() has been called but while IO is pending, | 311 // If destroyed after Start() has been called but while IO is pending, |
| 310 // then the request will be effectively canceled and the delegate | 312 // then the request will be effectively canceled and the delegate |
| 311 // will not have any more of its methods called. | 313 // will not have any more of its methods called. |
| 312 virtual ~URLRequest(); | 314 virtual ~URLRequest(); |
| 313 | 315 |
| 314 // Changes the default cookie policy from allowing all cookies to blocking all | 316 // Changes the default cookie policy from allowing all cookies to blocking all |
| 315 // cookies. Embedders that want to implement a more flexible policy should | 317 // cookies. Embedders that want to implement a more flexible policy should |
| 316 // change the default to blocking all cookies, and provide a NetworkDelegate | 318 // change the default to blocking all cookies, and provide a NetworkDelegate |
| 317 // with the URLRequestContext that maintains the CookieStore. | 319 // with the URLRequestContext that maintains the CookieStore. |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // certificate. Pass NULL if the user doesn't have a client certificate. | 585 // certificate. Pass NULL if the user doesn't have a client certificate. |
| 584 void ContinueWithCertificate(X509Certificate* client_cert); | 586 void ContinueWithCertificate(X509Certificate* client_cert); |
| 585 | 587 |
| 586 // This method can be called after some error notifications to instruct this | 588 // This method can be called after some error notifications to instruct this |
| 587 // URLRequest to ignore the current error and continue with the request. To | 589 // URLRequest to ignore the current error and continue with the request. To |
| 588 // cancel the request instead, call Cancel(). | 590 // cancel the request instead, call Cancel(). |
| 589 void ContinueDespiteLastError(); | 591 void ContinueDespiteLastError(); |
| 590 | 592 |
| 591 // Used to specify the context (cookie store, cache) for this request. | 593 // Used to specify the context (cookie store, cache) for this request. |
| 592 const URLRequestContext* context() const; | 594 const URLRequestContext* context() const; |
| 593 void set_context(const URLRequestContext* context); | |
| 594 | 595 |
| 595 const BoundNetLog& net_log() const { return net_log_; } | 596 const BoundNetLog& net_log() const { return net_log_; } |
| 596 | 597 |
| 597 // Returns the expected content size if available | 598 // Returns the expected content size if available |
| 598 int64 GetExpectedContentSize() const; | 599 int64 GetExpectedContentSize() const; |
| 599 | 600 |
| 600 // Returns the priority level for this request. | 601 // Returns the priority level for this request. |
| 601 RequestPriority priority() const { return priority_; } | 602 RequestPriority priority() const { return priority_; } |
| 602 void set_priority(RequestPriority priority) { | 603 void set_priority(RequestPriority priority) { |
| 603 DCHECK_GE(priority, MINIMUM_PRIORITY); | 604 DCHECK_GE(priority, MINIMUM_PRIORITY); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 base::TimeTicks creation_time_; | 801 base::TimeTicks creation_time_; |
| 801 | 802 |
| 802 scoped_ptr<const base::debug::StackTrace> stack_trace_; | 803 scoped_ptr<const base::debug::StackTrace> stack_trace_; |
| 803 | 804 |
| 804 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 805 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 805 }; | 806 }; |
| 806 | 807 |
| 807 } // namespace net | 808 } // namespace net |
| 808 | 809 |
| 809 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 810 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |