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

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

Issue 1523433002: Remove support for a URLRequest having a NULL Delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge, remove if in file_writer_delegate Created 5 years 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
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // may only be changed before Start() is called. 296 // may only be changed before Start() is called.
297 const std::string& referrer() const { return referrer_; } 297 const std::string& referrer() const { return referrer_; }
298 // Referrer is sanitized to remove URL fragment, user name and password. 298 // Referrer is sanitized to remove URL fragment, user name and password.
299 void SetReferrer(const std::string& referrer); 299 void SetReferrer(const std::string& referrer);
300 300
301 // The referrer policy to apply when updating the referrer during redirects. 301 // The referrer policy to apply when updating the referrer during redirects.
302 // The referrer policy may only be changed before Start() is called. 302 // The referrer policy may only be changed before Start() is called.
303 ReferrerPolicy referrer_policy() const { return referrer_policy_; } 303 ReferrerPolicy referrer_policy() const { return referrer_policy_; }
304 void set_referrer_policy(ReferrerPolicy referrer_policy); 304 void set_referrer_policy(ReferrerPolicy referrer_policy);
305 305
306 // Sets the delegate of the request. This value may be changed at any time, 306 // Sets the delegate of the request. This is only to allow creating a request
307 // and it is permissible for it to be null. 307 // before creating its delegate. |delegate| must be non-NULL and the request
308 // must not yet have a Delegate set.
308 void set_delegate(Delegate* delegate); 309 void set_delegate(Delegate* delegate);
309 310
310 // Indicates that the request body should be sent using chunked transfer 311 // Indicates that the request body should be sent using chunked transfer
311 // encoding. This method may only be called before Start() is called. 312 // encoding. This method may only be called before Start() is called.
312 void EnableChunkedUpload(); 313 void EnableChunkedUpload();
313 314
314 // Appends the given bytes to the request's upload data to be sent 315 // Appends the given bytes to the request's upload data to be sent
315 // immediately via chunked transfer encoding. When all data has been added, 316 // immediately via chunked transfer encoding. When all data has been added,
316 // set |is_last_chunk| to true to indicate the end of upload data. All chunks 317 // set |is_last_chunk| to true to indicate the end of upload data. All chunks
317 // but the last must have |bytes_len| > 0. 318 // but the last must have |bytes_len| > 0.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // URL but has not yet initiated the new request. 517 // URL but has not yet initiated the new request.
517 bool is_redirecting() const { return is_redirecting_; } 518 bool is_redirecting() const { return is_redirecting_; }
518 519
519 // Returns the error status of the request. 520 // Returns the error status of the request.
520 const URLRequestStatus& status() const { return status_; } 521 const URLRequestStatus& status() const { return status_; }
521 522
522 // Returns a globally unique identifier for this request. 523 // Returns a globally unique identifier for this request.
523 uint64 identifier() const { return identifier_; } 524 uint64 identifier() const { return identifier_; }
524 525
525 // This method is called to start the request. The delegate will receive 526 // This method is called to start the request. The delegate will receive
526 // a OnResponseStarted callback when the request is started. 527 // a OnResponseStarted callback when the request is started. The request
528 // must have a delegate set before this method is called.
527 void Start(); 529 void Start();
528 530
529 // This method may be called at any time after Start() has been called to 531 // This method may be called at any time after Start() has been called to
530 // cancel the request. This method may be called many times, and it has 532 // cancel the request. This method may be called many times, and it has
531 // no effect once the response has completed. It is guaranteed that no 533 // no effect once the response has completed. It is guaranteed that no
532 // methods of the delegate will be called after the request has been 534 // methods of the delegate will be called after the request has been
533 // cancelled, except that this may call the delegate's OnReadCompleted() 535 // cancelled, except that this may call the delegate's OnReadCompleted()
534 // during the call to Cancel itself. 536 // during the call to Cancel itself.
535 void Cancel(); 537 void Cancel();
536 538
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 616
615 // Sets the priority level for this request and any related 617 // Sets the priority level for this request and any related
616 // jobs. Must not change the priority to anything other than 618 // jobs. Must not change the priority to anything other than
617 // MAXIMUM_PRIORITY if the IGNORE_LIMITS load flag is set. 619 // MAXIMUM_PRIORITY if the IGNORE_LIMITS load flag is set.
618 void SetPriority(RequestPriority priority); 620 void SetPriority(RequestPriority priority);
619 621
620 // Returns true iff this request would be internally redirected to HTTPS 622 // Returns true iff this request would be internally redirected to HTTPS
621 // due to HSTS. If so, |redirect_url| is rewritten to the new HTTPS URL. 623 // due to HSTS. If so, |redirect_url| is rewritten to the new HTTPS URL.
622 bool GetHSTSRedirect(GURL* redirect_url) const; 624 bool GetHSTSRedirect(GURL* redirect_url) const;
623 625
624 // TODO(willchan): Undo this. Only temporarily public.
625 bool has_delegate() const { return delegate_ != NULL; }
626
627 // NOTE(willchan): This is just temporary for debugging 626 // NOTE(willchan): This is just temporary for debugging
628 // http://crbug.com/90971. 627 // http://crbug.com/90971.
629 // Allows to setting debug info into the URLRequest. 628 // Allows to setting debug info into the URLRequest.
630 void set_stack_trace(const base::debug::StackTrace& stack_trace); 629 void set_stack_trace(const base::debug::StackTrace& stack_trace);
631 const base::debug::StackTrace* stack_trace() const; 630 const base::debug::StackTrace* stack_trace() const;
632 631
633 void set_received_response_content_length(int64_t received_content_length) { 632 void set_received_response_content_length(int64_t received_content_length) {
634 received_response_content_length_ = received_content_length; 633 received_response_content_length_ = received_content_length;
635 } 634 }
636 635
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 718
720 // Notifies the network delegate that the request has been completed. 719 // Notifies the network delegate that the request has been completed.
721 // This does not imply a successful completion. Also a canceled request is 720 // This does not imply a successful completion. Also a canceled request is
722 // considered completed. 721 // considered completed.
723 void NotifyRequestCompleted(); 722 void NotifyRequestCompleted();
724 723
725 // Called by URLRequestJob to allow interception when the final response 724 // Called by URLRequestJob to allow interception when the final response
726 // occurs. 725 // occurs.
727 void NotifyResponseStarted(); 726 void NotifyResponseStarted();
728 727
729 // These functions delegate to |delegate_| and may only be used if 728 // These functions delegate to |delegate_|. See URLRequest::Delegate for the
730 // |delegate_| is not NULL. See URLRequest::Delegate for the meaning 729 // meaning of these functions.
731 // of these functions.
732 void NotifyAuthRequired(AuthChallengeInfo* auth_info); 730 void NotifyAuthRequired(AuthChallengeInfo* auth_info);
733 void NotifyAuthRequiredComplete(NetworkDelegate::AuthRequiredResponse result); 731 void NotifyAuthRequiredComplete(NetworkDelegate::AuthRequiredResponse result);
734 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); 732 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info);
735 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal); 733 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal);
736 void NotifyReadCompleted(int bytes_read); 734 void NotifyReadCompleted(int bytes_read);
737 735
738 // These functions delegate to |network_delegate_| if it is not NULL. 736 // These functions delegate to |network_delegate_| if it is not NULL.
739 // If |network_delegate_| is NULL, cookies can be used unless 737 // If |network_delegate_| is NULL, cookies can be used unless
740 // SetDefaultCookiePolicyToBlock() has been called. 738 // SetDefaultCookiePolicyToBlock() has been called.
741 bool CanGetCookies(const CookieList& cookie_list) const; 739 bool CanGetCookies(const CookieList& cookie_list) const;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 HostPortPair proxy_server_; 860 HostPortPair proxy_server_;
863 861
864 scoped_ptr<const base::debug::StackTrace> stack_trace_; 862 scoped_ptr<const base::debug::StackTrace> stack_trace_;
865 863
866 DISALLOW_COPY_AND_ASSIGN(URLRequest); 864 DISALLOW_COPY_AND_ASSIGN(URLRequest);
867 }; 865 };
868 866
869 } // namespace net 867 } // namespace net
870 868
871 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 869 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW
« no previous file with comments | « ios/web/net/request_tracker_impl_unittest.mm ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698