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

Unified Diff: net/url_request/url_request.cc

Issue 10310124: Implement a ResourceThrottle for URL overriding in Chrome on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporated feedback Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« net/url_request/url_request.h ('K') | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index fef10fbdb0b4bd2bea18f1c0f110eff6f0ed8c60..85fcbdfd0f2ffa71e87147837aa05f9d1556089e 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -478,30 +478,38 @@ void URLRequest::RestartWithJob(URLRequestJob *job) {
}
void URLRequest::Cancel() {
- DoCancel(ERR_ABORTED, SSLInfo());
+ DoCancel(URLRequestStatus(URLRequestStatus::CANCELED, ERR_ABORTED),
+ SSLInfo());
}
void URLRequest::CancelWithError(int error) {
- DoCancel(error, SSLInfo());
+ DCHECK(error < 0);
+ DoCancel(URLRequestStatus(URLRequestStatus::CANCELED, error),
+ SSLInfo());
}
void URLRequest::CancelWithSSLError(int error, const SSLInfo& ssl_info) {
+ DCHECK(error < 0);
// This should only be called on a started request.
if (!is_pending_ || !job_ || job_->has_response_started()) {
NOTREACHED();
return;
}
- DoCancel(error, ssl_info);
+ DoCancel(URLRequestStatus(URLRequestStatus::CANCELED, error),
+ SSLInfo());
}
-void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) {
- DCHECK(error < 0);
+void URLRequest::CancelWithHandledExternallyStatus() {
+ DoCancel(URLRequestStatus(URLRequestStatus::HANDLED_EXTERNALLY, OK),
+ SSLInfo());
+}
+void URLRequest::DoCancel(const URLRequestStatus& status,
+ const SSLInfo& ssl_info) {
// If the URL request already has an error status, then canceling is a no-op.
// Plus, we don't want to change the error status once it has been set.
if (status_.is_success()) {
- status_.set_status(URLRequestStatus::CANCELED);
- status_.set_error(error);
+ status_ = status;
response_info_.ssl_info = ssl_info;
}
« net/url_request/url_request.h ('K') | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698