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_BASE_NETWORK_DELEGATE_H_ | 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ |
6 #define NET_BASE_NETWORK_DELEGATE_H_ | 6 #define NET_BASE_NETWORK_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 GURL* new_url); | 42 GURL* new_url); |
43 int NotifyBeforeSendHeaders(uint64 request_id, | 43 int NotifyBeforeSendHeaders(uint64 request_id, |
44 CompletionCallback* callback, | 44 CompletionCallback* callback, |
45 HttpRequestHeaders* headers); | 45 HttpRequestHeaders* headers); |
46 void NotifyRequestSent(uint64 request_id, | 46 void NotifyRequestSent(uint64 request_id, |
47 const HostPortPair& socket_address, | 47 const HostPortPair& socket_address, |
48 const HttpRequestHeaders& headers); | 48 const HttpRequestHeaders& headers); |
49 void NotifyBeforeRedirect(URLRequest* request, | 49 void NotifyBeforeRedirect(URLRequest* request, |
50 const GURL& new_location); | 50 const GURL& new_location); |
51 void NotifyResponseStarted(URLRequest* request); | 51 void NotifyResponseStarted(URLRequest* request); |
| 52 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); |
52 void NotifyCompleted(URLRequest* request); | 53 void NotifyCompleted(URLRequest* request); |
53 void NotifyURLRequestDestroyed(URLRequest* request); | 54 void NotifyURLRequestDestroyed(URLRequest* request); |
54 void NotifyHttpTransactionDestroyed(uint64 request_id); | 55 void NotifyHttpTransactionDestroyed(uint64 request_id); |
55 void NotifyPACScriptError(int line_number, const string16& error); | 56 void NotifyPACScriptError(int line_number, const string16& error); |
56 | 57 |
57 private: | 58 private: |
58 // This is the interface for subclasses of NetworkDelegate to implement. This | 59 // This is the interface for subclasses of NetworkDelegate to implement. This |
59 // member functions will be called by the respective public notification | 60 // member functions will be called by the respective public notification |
60 // member function, which will perform basic sanity checking. | 61 // member function, which will perform basic sanity checking. |
61 | 62 |
(...skipping 20 matching lines...) Expand all Loading... |
82 const HostPortPair& socket_address, | 83 const HostPortPair& socket_address, |
83 const HttpRequestHeaders& headers) = 0; | 84 const HttpRequestHeaders& headers) = 0; |
84 | 85 |
85 // Called right after a redirect response code was received. | 86 // Called right after a redirect response code was received. |
86 virtual void OnBeforeRedirect(URLRequest* request, | 87 virtual void OnBeforeRedirect(URLRequest* request, |
87 const GURL& new_location) = 0; | 88 const GURL& new_location) = 0; |
88 | 89 |
89 // This corresponds to URLRequestDelegate::OnResponseStarted. | 90 // This corresponds to URLRequestDelegate::OnResponseStarted. |
90 virtual void OnResponseStarted(URLRequest* request) = 0; | 91 virtual void OnResponseStarted(URLRequest* request) = 0; |
91 | 92 |
| 93 // Called every time we read raw bytes. |
| 94 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; |
| 95 |
92 // Indicates that the URL request has been completed or failed. | 96 // Indicates that the URL request has been completed or failed. |
93 virtual void OnCompleted(URLRequest* request) = 0; | 97 virtual void OnCompleted(URLRequest* request) = 0; |
94 | 98 |
95 // Called when an URLRequest is being destroyed. Note that the request is | 99 // Called when an URLRequest is being destroyed. Note that the request is |
96 // being deleted, so it's not safe to call any methods that may result in | 100 // being deleted, so it's not safe to call any methods that may result in |
97 // a virtual method call. | 101 // a virtual method call. |
98 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; | 102 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; |
99 | 103 |
100 // Called when the HttpTransaction for the request with the given ID is | 104 // Called when the HttpTransaction for the request with the given ID is |
101 // destroyed. | 105 // destroyed. |
102 virtual void OnHttpTransactionDestroyed(uint64 request_id) = 0; | 106 virtual void OnHttpTransactionDestroyed(uint64 request_id) = 0; |
103 | 107 |
104 // Corresponds to ProxyResolverJSBindings::OnError. | 108 // Corresponds to ProxyResolverJSBindings::OnError. |
105 virtual void OnPACScriptError(int line_number, const string16& error) = 0; | 109 virtual void OnPACScriptError(int line_number, const string16& error) = 0; |
106 }; | 110 }; |
107 | 111 |
108 } // namespace net | 112 } // namespace net |
109 | 113 |
110 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 114 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |