Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/webui/network_error_url_loader.h" | |
| 6 | |
| 7 #include "base/strings/string_number_conversions.h" | |
| 8 #include "content/browser/webui/url_data_manager_backend.h" | |
| 9 #include "content/public/common/url_constants.h" | |
| 10 #include "net/base/net_errors.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 void StartNetworkErrorsURLLoader(const ResourceRequest& request, | |
| 15 mojom::URLLoaderClientPtr client) { | |
| 16 int net_error = net::OK; | |
|
scottmg
2017/05/10 16:29:30
Is this logic copied from somewhere else? It seems
jam
2017/05/10 17:33:05
Good point, defaulted to ERR_INVALID_URL which is
| |
| 17 if (request.url.host() == kChromeUIDinoHost) { | |
| 18 net_error = net::Error::ERR_INTERNET_DISCONNECTED; | |
| 19 } else { | |
| 20 std::string error_code_string = request.url.path().substr(1); | |
| 21 | |
| 22 int temp_code; | |
| 23 if (base::StringToInt(error_code_string, &temp_code)) { | |
| 24 // Check for a valid error code. | |
| 25 if (URLDataManagerBackend::IsValidNetworkErrorCode(temp_code) && | |
| 26 temp_code != net::Error::ERR_IO_PENDING) { | |
| 27 net_error = temp_code; | |
| 28 } | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 ResourceRequestCompletionStatus request_complete_data; | |
| 33 request_complete_data.error_code = net_error; | |
| 34 client->OnComplete(request_complete_data); | |
| 35 } | |
| 36 | |
| 37 } // namespace content | |
| OLD | NEW |