| Index: content/browser/net/network_error_request_job.cc
|
| diff --git a/content/browser/net/network_error_request_job.cc b/content/browser/net/network_error_request_job.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ff63102db8cb586e8a33853a41902bbccd9532d8
|
| --- /dev/null
|
| +++ b/content/browser/net/network_error_request_job.cc
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/net/network_error_request_job.h"
|
| +
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "base/values.h"
|
| +#include "net/base/escape.h"
|
| +#include "net/base/net_errors.h"
|
| +#include "net/log/net_log_util.h"
|
| +#include "net/url_request/url_request.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace content {
|
| +
|
| +NetworkErrorRequestJob::NetworkErrorRequestJob(
|
| + net::URLRequest* request,
|
| + net::NetworkDelegate* network_delegate)
|
| + : net::URLRequestSimpleJob(request, network_delegate),
|
| + error_code_(net::Error::OK) {
|
| + std::basic_string<char> error_code_string =
|
| + request->url().path().substr(1, std::string::npos);
|
| +
|
| + if (!base::StringToInt(error_code_string, &error_code_))
|
| + error_code_ = 0;
|
| +}
|
| +
|
| +int NetworkErrorRequestJob::GetData(
|
| + std::string* mime_type,
|
| + std::string* charset,
|
| + std::string* data,
|
| + const net::CompletionCallback& callback) const {
|
| + mime_type->assign("text/html");
|
| + charset->assign("UTF8");
|
| +
|
| + if (error_code_ == 0 || error_code_ == net::Error::ERR_IO_PENDING)
|
| + return net::OK;
|
| +
|
| + return error_code_;
|
| +}
|
| +
|
| +} // namespace content
|
|
|