Chromium Code Reviews| Index: webkit/glue/weburlloader_impl.cc |
| diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc |
| index 104795dd1eed0e554ef5025249e6602c20cd0646..9f656c62a0eb4ce0286f2cf5f4c083248a2e63c5 100644 |
| --- a/webkit/glue/weburlloader_impl.cc |
| +++ b/webkit/glue/weburlloader_impl.cc |
| @@ -122,11 +122,11 @@ class HeaderFlattener : public WebHTTPHeaderVisitor { |
| bool GetInfoFromDataURL(const GURL& url, |
| ResourceResponseInfo* info, |
| std::string* data, |
| - net::URLRequestStatus* status) { |
| + int* error_code) { |
| std::string mime_type; |
| std::string charset; |
| if (net::DataURL::Parse(url, &mime_type, &charset, data)) { |
| - *status = net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0); |
| + *error_code = net::OK; |
| // Assure same time for all time fields of data: URLs. |
| Time now = Time::Now(); |
| info->load_timing.base_time = now; |
| @@ -143,8 +143,7 @@ bool GetInfoFromDataURL(const GURL& url, |
| return true; |
| } |
| - *status = net::URLRequestStatus(net::URLRequestStatus::FAILED, |
| - net::ERR_INVALID_URL); |
| + *error_code = net::ERR_INVALID_URL; |
| return false; |
| } |
| @@ -298,7 +297,8 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
| int data_length, |
| int encoded_data_length); |
| virtual void OnReceivedCachedMetadata(const char* data, int len); |
| - virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| + virtual void OnCompletedRequest(int error_code, |
| + bool is_handled_externally, |
| const std::string& security_info, |
| const base::TimeTicks& completion_time); |
| @@ -363,7 +363,7 @@ void WebURLLoaderImpl::Context::Start( |
| std::string data; |
| GetInfoFromDataURL(sync_load_response->url, sync_load_response, |
| &sync_load_response->data, |
| - &sync_load_response->status); |
| + &sync_load_response->error_code); |
| } else { |
| AddRef(); // Balanced in OnCompletedRequest |
| MessageLoop::current()->PostTask(FROM_HERE, |
| @@ -623,7 +623,8 @@ void WebURLLoaderImpl::Context::OnReceivedCachedMetadata( |
| } |
| void WebURLLoaderImpl::Context::OnCompletedRequest( |
| - const net::URLRequestStatus& status, |
| + int error_code, |
| + bool is_handled_externally, |
| const std::string& security_info, |
| const base::TimeTicks& completion_time) { |
| if (ftp_listing_delegate_.get()) { |
| @@ -640,15 +641,7 @@ void WebURLLoaderImpl::Context::OnCompletedRequest( |
| completed_bridge_.swap(bridge_); |
| if (client_) { |
| - if (status.status() != net::URLRequestStatus::SUCCESS) { |
| - int error_code; |
| - if (status.status() == net::URLRequestStatus::HANDLED_EXTERNALLY) { |
| - // By marking this request as aborted we insure that we don't navigate |
| - // to an error page. |
| - error_code = net::ERR_ABORTED; |
| - } else { |
| - error_code = status.error(); |
| - } |
| + if (!net::IsSuccess(error_code) || is_handled_externally) { |
|
darin (slow to review)
2012/08/10 18:03:02
I think you should just compare error_code against
mkosiba (inactive)
2012/08/29 15:53:01
Positive error codes support was dropped in one of
|
| WebURLError error; |
| if (error_code == net::ERR_ABORTED) { |
| error.isCancellation = true; |
| @@ -704,16 +697,17 @@ bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { |
| void WebURLLoaderImpl::Context::HandleDataURL() { |
| ResourceResponseInfo info; |
| - net::URLRequestStatus status; |
| + int error_code; |
| std::string data; |
| - if (GetInfoFromDataURL(request_.url(), &info, &data, &status)) { |
| + if (GetInfoFromDataURL(request_.url(), &info, &data, &error_code)) { |
| OnReceivedResponse(info); |
| if (!data.empty()) |
| OnReceivedData(data.data(), data.size(), 0); |
| } |
| - OnCompletedRequest(status, info.security_info, base::TimeTicks::Now()); |
| + OnCompletedRequest(error_code, false, info.security_info, |
| + base::TimeTicks::Now()); |
| } |
| // WebURLLoaderImpl ----------------------------------------------------------- |
| @@ -738,13 +732,11 @@ void WebURLLoaderImpl::loadSynchronously(const WebURLRequest& request, |
| // TODO(tc): For file loads, we may want to include a more descriptive |
| // status code or status text. |
| - const net::URLRequestStatus::Status& status = |
| - sync_load_response.status.status(); |
| - if (status != net::URLRequestStatus::SUCCESS && |
| - status != net::URLRequestStatus::HANDLED_EXTERNALLY) { |
| + int error_code = sync_load_response.error_code; |
| + if (!net::IsSuccess(error_code)) { |
| response.setURL(final_url); |
| error.domain = WebString::fromUTF8(net::kErrorDomain); |
| - error.reason = sync_load_response.status.error(); |
| + error.reason = error_code; |
| error.unreachableURL = final_url; |
| return; |
| } |