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

Side by Side Diff: content/browser/net/network_error_request_job.cc

Issue 1421743002: Implement chrome://network-errors for direct access to network error interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 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/net/network_error_request_job.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "base/values.h"
9 #include "net/base/escape.h"
10 #include "net/base/net_errors.h"
11 #include "net/log/net_log_util.h"
12 #include "net/url_request/url_request.h"
13 #include "url/gurl.h"
14
15 namespace content {
16
17 NetworkErrorRequestJob::NetworkErrorRequestJob(
18 net::URLRequest* request,
19 net::NetworkDelegate* network_delegate)
20 : net::URLRequestSimpleJob(request, network_delegate),
21 error_code_(net::Error::OK) {
22 std::basic_string<char> error_code_string =
23 request->url().path().substr(1, std::string::npos);
24
25 if (!base::StringToInt(error_code_string, &error_code_))
26 error_code_ = 0;
27 }
28
29 int NetworkErrorRequestJob::GetData(
30 std::string* mime_type,
31 std::string* charset,
32 std::string* data,
33 const net::CompletionCallback& callback) const {
34 mime_type->assign("text/html");
35 charset->assign("UTF8");
36
37 if (error_code_ == 0 || error_code_ == net::Error::ERR_IO_PENDING) {
38 return net::OK;
39 }
Dan Beam 2015/11/24 20:08:20 nit: no curlies
edwardjung 2015/11/24 21:42:12 Done.
40 return error_code_;
41 }
42
43 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698