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

Side by Side Diff: content/browser/webui/network_error_url_loader.cc

Issue 2873913002: Implement chrome://network-error with network service. (Closed)
Patch Set: merge Created 3 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 unified diff | Download patch
OLDNEW
(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::ERR_INVALID_URL;
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
OLDNEW
« no previous file with comments | « content/browser/webui/network_error_url_loader.h ('k') | content/browser/webui/url_data_manager_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698