OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 5 #ifndef CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 6 #define CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class TimeTicks; | 16 class TimeTicks; |
17 } | 17 } |
18 | 18 |
| 19 namespace net { |
| 20 struct RedirectInfo; |
| 21 } |
| 22 |
19 namespace content { | 23 namespace content { |
20 | 24 |
21 struct ResourceResponseInfo; | 25 struct ResourceResponseInfo; |
22 | 26 |
23 // This is implemented by our custom resource loader within content. The Peer | 27 // This is implemented by our custom resource loader within content. The Peer |
24 // and it's bridge should have identical lifetimes as they represent each end of | 28 // and it's bridge should have identical lifetimes as they represent each end of |
25 // a communication channel. | 29 // a communication channel. |
26 // | 30 // |
27 // These callbacks mirror net::URLRequest::Delegate and the order and | 31 // These callbacks mirror net::URLRequest::Delegate and the order and |
28 // conditions in which they will be called are identical. See url_request.h | 32 // conditions in which they will be called are identical. See url_request.h |
29 // for more information. | 33 // for more information. |
30 class CONTENT_EXPORT RequestPeer { | 34 class CONTENT_EXPORT RequestPeer { |
31 public: | 35 public: |
32 // Called as upload progress is made. | 36 // Called as upload progress is made. |
33 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set | 37 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set |
34 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; | 38 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; |
35 | 39 |
36 // Called when a redirect occurs. The implementation may return false to | 40 // Called when a redirect occurs. The implementation may return false to |
37 // suppress the redirect. The given ResponseInfo provides complete | 41 // suppress the redirect. The ResourceResponseInfo provides information about |
38 // information about the redirect, and new_url is the URL that will be loaded | 42 // the redirect response and the RedirectInfo includes information about the |
39 // if this method returns true. new_first_party_for_cookies is the new | 43 // request to be made if the method returns true. |
40 // first-party URL for cookies should that have changed. | 44 virtual bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, |
41 virtual bool OnReceivedRedirect(const GURL& new_url, | |
42 const GURL& new_first_party_for_cookies, | |
43 const ResourceResponseInfo& info) = 0; | 45 const ResourceResponseInfo& info) = 0; |
44 | 46 |
45 // Called when response headers are available (after all redirects have | 47 // Called when response headers are available (after all redirects have |
46 // been followed). | 48 // been followed). |
47 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0; | 49 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0; |
48 | 50 |
49 // Called when a chunk of response data is downloaded. This method may be | 51 // Called when a chunk of response data is downloaded. This method may be |
50 // called multiple times or not at all if an error occurs. This method is | 52 // called multiple times or not at all if an error occurs. This method is |
51 // only called if RequestInfo::download_to_file was set to true, and in | 53 // only called if RequestInfo::download_to_file was set to true, and in |
52 // that case, OnReceivedData will not be called. | 54 // that case, OnReceivedData will not be called. |
(...skipping 24 matching lines...) Expand all Loading... |
77 const base::TimeTicks& completion_time, | 79 const base::TimeTicks& completion_time, |
78 int64 total_transfer_size) = 0; | 80 int64 total_transfer_size) = 0; |
79 | 81 |
80 protected: | 82 protected: |
81 virtual ~RequestPeer() {} | 83 virtual ~RequestPeer() {} |
82 }; | 84 }; |
83 | 85 |
84 } // namespace content | 86 } // namespace content |
85 | 87 |
86 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ | 88 #endif // CONTENT_PUBLIC_CHILD_REQUEST_PEER_H_ |
OLD | NEW |