diff options
author | calvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 11:44:47 +0000 |
---|---|---|
committer | calvinlo@chromium.org <calvinlo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-06 11:44:47 +0000 |
commit | bab2025fedbd2048d8db8f2ff487d016b0fd8881 (patch) | |
tree | 6ad9c95dabc5fdb873e1e9968104298de058beff /webkit/quota | |
parent | 2a222912b7843c96149256a8edcb4867c1339cff (diff) | |
download | chromium_src-bab2025fedbd2048d8db8f2ff487d016b0fd8881.zip chromium_src-bab2025fedbd2048d8db8f2ff487d016b0fd8881.tar.gz chromium_src-bab2025fedbd2048d8db8f2ff487d016b0fd8881.tar.bz2 |
Added quota_status_code.h/cc file to hold QuotaStatusCode enum and added function to convert enum to error strings.
BUG=156791
TBR=benwells@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11363098
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/quota')
-rw-r--r-- | webkit/quota/quota_status_code.cc | 29 | ||||
-rw-r--r-- | webkit/quota/quota_status_code.h | 28 | ||||
-rw-r--r-- | webkit/quota/quota_types.h | 12 | ||||
-rw-r--r-- | webkit/quota/webkit_quota.gypi | 2 |
4 files changed, 60 insertions, 11 deletions
diff --git a/webkit/quota/quota_status_code.cc b/webkit/quota/quota_status_code.cc new file mode 100644 index 0000000..fd319c7 --- /dev/null +++ b/webkit/quota/quota_status_code.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2012 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 "base/logging.h" +#include "webkit/quota/quota_status_code.h" + +namespace quota { + +const char* QuotaStatusCodeToString(QuotaStatusCode status) { + switch (status) { + case kQuotaStatusOk: + return "OK."; + case kQuotaErrorNotSupported: + return "Operation not supported."; + case kQuotaErrorInvalidModification: + return "Invalid modification."; + case kQuotaErrorInvalidAccess: + return "Invalid access."; + case kQuotaErrorAbort: + return "Quota operation aborted."; + case kQuotaStatusUnknown: + return "Unknown error."; + } + NOTREACHED(); + return "Unknown error."; +} + +} // namespace quota diff --git a/webkit/quota/quota_status_code.h b/webkit/quota/quota_status_code.h new file mode 100644 index 0000000..47eeb22 --- /dev/null +++ b/webkit/quota/quota_status_code.h @@ -0,0 +1,28 @@ +// 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. + +#ifndef WEBKIT_QUOTA_QUOTA_STATUS_CODE_H_ +#define WEBKIT_QUOTA_QUOTA_STATUS_CODE_H_ + +#include "webkit/storage/webkit_storage_export.h" + +namespace quota { + +// The numbers should match with the error code defined in +// third_party/WebKit/Source/WebCore/dom/ExceptionCode.h. +enum QuotaStatusCode { + kQuotaStatusOk = 0, + kQuotaErrorNotSupported = 9, // NOT_SUPPORTED_ERR + kQuotaErrorInvalidModification = 13, // INVALID_MODIFICATION_ERR + kQuotaErrorInvalidAccess = 15, // INVALID_ACCESS_ERR + kQuotaErrorAbort = 20, // ABORT_ERR + kQuotaStatusUnknown = -1, +}; + +WEBKIT_STORAGE_EXPORT const char* QuotaStatusCodeToString( + QuotaStatusCode status); + +} // namespace quota + +#endif // WEBKIT_QUOTA_QUOTA_STATUS_CODE_H_ diff --git a/webkit/quota/quota_types.h b/webkit/quota/quota_types.h index 6748ae4..8d67b76 100644 --- a/webkit/quota/quota_types.h +++ b/webkit/quota/quota_types.h @@ -13,6 +13,7 @@ #include "base/basictypes.h" #include "base/callback.h" +#include "webkit/quota/quota_status_code.h" class GURL; @@ -25,17 +26,6 @@ enum StorageType { kStorageTypeUnknown, }; -// The numbers should match with the error code defined in -// third_party/WebKit/Source/WebCore/dom/ExceptionCode.h. -enum QuotaStatusCode { - kQuotaStatusOk = 0, - kQuotaErrorNotSupported = 9, // NOT_SUPPORTED_ERR - kQuotaErrorInvalidModification = 13, // INVALID_MODIFICATION_ERR - kQuotaErrorInvalidAccess = 15, // INVALID_ACCESS_ERR - kQuotaErrorAbort = 20, // ABORT_ERR - kQuotaStatusUnknown = -1, -}; - struct UsageInfo; typedef std::vector<UsageInfo> UsageInfoEntries; diff --git a/webkit/quota/webkit_quota.gypi b/webkit/quota/webkit_quota.gypi index a43600e..1642a58 100644 --- a/webkit/quota/webkit_quota.gypi +++ b/webkit/quota/webkit_quota.gypi @@ -10,6 +10,8 @@ '../quota/quota_database.h', '../quota/quota_manager.cc', '../quota/quota_manager.h', + '../quota/quota_status_code.cc', + '../quota/quota_status_code.h', '../quota/quota_task.cc', '../quota/quota_task.h', '../quota/quota_temporary_storage_evictor.cc', |