Chromium Code Reviews| 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 #include "net/base/network_delegate.h" | 5 #include "net/base/network_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 DCHECK(CalledOnValidThread()); | 71 DCHECK(CalledOnValidThread()); |
| 72 DCHECK(original_response_headers); | 72 DCHECK(original_response_headers); |
| 73 DCHECK(!callback.is_null()); | 73 DCHECK(!callback.is_null()); |
| 74 return OnHeadersReceived(request, | 74 return OnHeadersReceived(request, |
| 75 callback, | 75 callback, |
| 76 original_response_headers, | 76 original_response_headers, |
| 77 override_response_headers, | 77 override_response_headers, |
| 78 allowed_unsafe_redirect_url); | 78 allowed_unsafe_redirect_url); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void NetworkDelegate::NotifyResponseStarted(URLRequest* request) { | 81 void NetworkDelegate::NotifyResponseStarted(URLRequest* request, |
| 82 int net_error) { | |
| 82 DCHECK(CalledOnValidThread()); | 83 DCHECK(CalledOnValidThread()); |
| 83 DCHECK(request); | 84 DCHECK(request); |
| 85 | |
| 86 OnResponseStarted(request, net_error); | |
| 87 } | |
| 88 | |
| 89 void NetworkDelegate::OnResponseStarted(URLRequest* request, int net_error) { | |
| 84 OnResponseStarted(request); | 90 OnResponseStarted(request); |
| 85 } | 91 } |
| 86 | 92 |
| 93 // Deprecated | |
| 94 void NetworkDelegate::OnResponseStarted(URLRequest* request) { | |
| 95 NOTREACHED(); | |
| 96 } | |
|
mmenke
2016/08/30 22:09:11
Order in this file should match order in the heade
maksims (do not use this acc)
2016/08/31 11:16:59
Done.
| |
| 97 | |
| 87 void NetworkDelegate::NotifyNetworkBytesReceived(URLRequest* request, | 98 void NetworkDelegate::NotifyNetworkBytesReceived(URLRequest* request, |
| 88 int64_t bytes_received) { | 99 int64_t bytes_received) { |
| 89 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 100 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), |
| 90 "NetworkDelegate::NotifyNetworkBytesReceived"); | 101 "NetworkDelegate::NotifyNetworkBytesReceived"); |
| 91 DCHECK(CalledOnValidThread()); | 102 DCHECK(CalledOnValidThread()); |
| 92 DCHECK_GT(bytes_received, 0); | 103 DCHECK_GT(bytes_received, 0); |
| 93 OnNetworkBytesReceived(request, bytes_received); | 104 OnNetworkBytesReceived(request, bytes_received); |
| 94 } | 105 } |
| 95 | 106 |
| 96 void NetworkDelegate::NotifyNetworkBytesSent(URLRequest* request, | 107 void NetworkDelegate::NotifyNetworkBytesSent(URLRequest* request, |
| 97 int64_t bytes_sent) { | 108 int64_t bytes_sent) { |
| 98 DCHECK(CalledOnValidThread()); | 109 DCHECK(CalledOnValidThread()); |
| 99 DCHECK_GT(bytes_sent, 0); | 110 DCHECK_GT(bytes_sent, 0); |
| 100 OnNetworkBytesSent(request, bytes_sent); | 111 OnNetworkBytesSent(request, bytes_sent); |
| 101 } | 112 } |
| 102 | 113 |
| 103 void NetworkDelegate::NotifyBeforeRedirect(URLRequest* request, | 114 void NetworkDelegate::NotifyBeforeRedirect(URLRequest* request, |
| 104 const GURL& new_location) { | 115 const GURL& new_location) { |
| 105 DCHECK(CalledOnValidThread()); | 116 DCHECK(CalledOnValidThread()); |
| 106 DCHECK(request); | 117 DCHECK(request); |
| 107 OnBeforeRedirect(request, new_location); | 118 OnBeforeRedirect(request, new_location); |
| 108 } | 119 } |
| 109 | 120 |
| 110 void NetworkDelegate::NotifyCompleted(URLRequest* request, bool started) { | 121 void NetworkDelegate::NotifyCompleted(URLRequest* request, |
| 122 bool started, | |
| 123 int net_error) { | |
| 111 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 124 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), |
| 112 "NetworkDelegate::NotifyCompleted"); | 125 "NetworkDelegate::NotifyCompleted"); |
| 113 DCHECK(CalledOnValidThread()); | 126 DCHECK(CalledOnValidThread()); |
| 114 DCHECK(request); | 127 DCHECK(request); |
| 115 // TODO(cbentzel): Remove ScopedTracker below once crbug.com/475753 is fixed. | 128 // TODO(cbentzel): Remove ScopedTracker below once crbug.com/475753 is fixed. |
| 116 tracked_objects::ScopedTracker tracking_profile( | 129 tracked_objects::ScopedTracker tracking_profile( |
| 117 FROM_HERE_WITH_EXPLICIT_FUNCTION("475753 NetworkDelegate::OnCompleted")); | 130 FROM_HERE_WITH_EXPLICIT_FUNCTION("475753 NetworkDelegate::OnCompleted")); |
| 131 | |
| 132 OnCompleted(request, started, net_error); | |
| 133 } | |
| 134 | |
| 135 void NetworkDelegate::OnCompleted(URLRequest* request, | |
| 136 bool started, | |
| 137 int net_error) { | |
| 118 OnCompleted(request, started); | 138 OnCompleted(request, started); |
| 119 } | 139 } |
| 120 | 140 |
| 141 // Deprecated. | |
| 142 void NetworkDelegate::OnCompleted(URLRequest* request, bool started) { | |
| 143 NOTREACHED(); | |
| 144 } | |
|
mmenke
2016/08/30 22:09:11
Order in this file should match order in the heade
maksims (do not use this acc)
2016/08/31 11:16:59
Done.
| |
| 145 | |
| 121 void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) { | 146 void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) { |
| 122 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), | 147 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), |
| 123 "NetworkDelegate::NotifyURLRequestDestroyed"); | 148 "NetworkDelegate::NotifyURLRequestDestroyed"); |
| 124 DCHECK(CalledOnValidThread()); | 149 DCHECK(CalledOnValidThread()); |
| 125 DCHECK(request); | 150 DCHECK(request); |
| 126 OnURLRequestDestroyed(request); | 151 OnURLRequestDestroyed(request); |
| 127 } | 152 } |
| 128 | 153 |
| 129 void NetworkDelegate::NotifyPACScriptError(int line_number, | 154 void NetworkDelegate::NotifyPACScriptError(int line_number, |
| 130 const base::string16& error) { | 155 const base::string16& error) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 bool NetworkDelegate::CancelURLRequestWithPolicyViolatingReferrerHeader( | 207 bool NetworkDelegate::CancelURLRequestWithPolicyViolatingReferrerHeader( |
| 183 const URLRequest& request, | 208 const URLRequest& request, |
| 184 const GURL& target_url, | 209 const GURL& target_url, |
| 185 const GURL& referrer_url) const { | 210 const GURL& referrer_url) const { |
| 186 DCHECK(CalledOnValidThread()); | 211 DCHECK(CalledOnValidThread()); |
| 187 return OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 212 return OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 188 request, target_url, referrer_url); | 213 request, target_url, referrer_url); |
| 189 } | 214 } |
| 190 | 215 |
| 191 } // namespace net | 216 } // namespace net |
| OLD | NEW |