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

Unified Diff: net/url_request/url_request_status.h

Issue 1164823002: Remove URLRequestStatus mutators and introduce FromError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_status.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_status.h
diff --git a/net/url_request/url_request_status.h b/net/url_request/url_request_status.h
index 521a3d45f5fa94b043e9c4a12ac7a5bce99386f2..023668785429d427f20176aed09fbf717b6ce844 100644
--- a/net/url_request/url_request_status.h
+++ b/net/url_request/url_request_status.h
@@ -1,18 +1,17 @@
// Copyright (c) 2011 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.
-//
-// This file's dependencies should be kept to a minimum so that it can be
-// included in WebKit code that doesn't rely on much of common.
#ifndef NET_URL_REQUEST_URL_REQUEST_STATUS_H_
#define NET_URL_REQUEST_URL_REQUEST_STATUS_H_
+#include "net/base/net_export.h"
+
namespace net {
// Represents the result of a URL request. It encodes errors and various
// types of success.
-class URLRequestStatus {
+class NET_EXPORT URLRequestStatus {
public:
enum Status {
// Request succeeded, |error_| will be 0.
@@ -29,14 +28,21 @@ class URLRequestStatus {
FAILED,
};
+ // Creates a successful URLRequestStatus.
URLRequestStatus() : status_(SUCCESS), error_(0) {}
- URLRequestStatus(Status s, int e) : status_(s), error_(e) {}
- Status status() const { return status_; }
- void set_status(Status s) { status_ = s; }
+ // Creates a URLRequestStatus with specified status and error parameters. New
+ // consumers should use URLRequestStatus::FromError instead.
+ URLRequestStatus(Status status, int error) : status_(status), error_(error) {}
+ // Creates a URLRequestStatus, initializing the status from |error|. OK maps
+ // to SUCCESS, ERR_IO_PENDING maps to IO_PENDING, ERR_ABORTED maps to CANCELED
+ // and all others map to FAILED. Other combinations of status and error are
+ // deprecated. See https://crbug.com/490311.
+ static URLRequestStatus FromError(int error);
+
+ Status status() const { return status_; }
int error() const { return error_; }
- void set_error(int e) { error_ = e; }
// Returns true if the status is success, which makes some calling code more
// convenient because this is the most common test.
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698