Moved QuotaStatusCode to WebKit/common
Moved QuotaStatusCode from storage/common to WebKit/common. This is
pre-work to onion soup the QuotaDispatcherHost mojo API and remove
WebStorageQuotaType and WebStorageQuotaError.
This patch:
* Moves QuotaStatusCode to WebKit/common and updates users to use
blink:: instead of storage:: for the types
* Moves QuotaStatusToString to a function in an anonymous namespace in
the only file it's used (sync_file_system_api.cc)
* Removes kQuotaStatusLast, since it's not used anywhere
* Makes QuotaStatusCode an enum class in preparation for converting it
to a mojo enum (where it will be an enum class)
* Updates the DEPS files for android_webview/browser to depend on
WebKit/common/quota, since aw_quota_manager_bridge.cc uses
QuotaStatusCode
* Removes the dependency of QuotaStatusCode on WebStorageQuotaError -
reversed the dependency
* Added a TODO to remove WebStorageQuotaError and replace it with
blink::QuotaStatusCode
General strategy:
* Renamed storage:: to blink:: for each value of the enum
* Removed includes from files where the include was the only change
(also removed includes of quota_types where it was being used to
transitively include quota_status_code)
* IWYUs where includes were previously missing; except in unit tests
(where the include is transitive), and when interfaces are implemented
(and the type is included from the virtual method decl)
* Generally removed `using` declarations, except in files with 4/5+
uses, where they were added if not already there
* Added visibility of WebKit/common to storage/
Bug: 781643
Change-Id: I7f31493dfee4934d5ed6e400e2c0723191549057
Reviewed-on: https://chromium-review.googlesource.com/821802
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Sasha Morrissey <sashab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524331}diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS
index ce72a720..e9c2f5f5 100644
--- a/android_webview/browser/DEPS
+++ b/android_webview/browser/DEPS
@@ -65,6 +65,9 @@
# AwContentBrowserClient::GetDefaultFavicon
"!ui/resources/grit/ui_resources.h",
+
+ # QuotaStatusCode required by AwQuotaManagerBridge.
+ "+third_party/WebKit/common/quota",
# POD structure required by the find-in-page IPC messages.
"+third_party/WebKit/public/web/WebFindOptions.h",
# Interface required for in-process input event handling.
diff --git a/android_webview/browser/aw_quota_manager_bridge.cc b/android_webview/browser/aw_quota_manager_bridge.cc
index cfd15b7..48bd984f 100644
--- a/android_webview/browser/aw_quota_manager_bridge.cc
+++ b/android_webview/browser/aw_quota_manager_bridge.cc
@@ -17,6 +17,7 @@
#include "jni/AwQuotaManagerBridge_jni.h"
#include "storage/browser/quota/quota_manager.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
using base::android::AttachCurrentThread;
@@ -50,7 +51,7 @@
storage::StorageType type);
void OnUsageAndQuotaObtained(const GURL& origin,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota);
@@ -105,13 +106,12 @@
CheckDone();
}
-void GetOriginsTask::OnUsageAndQuotaObtained(
- const GURL& origin,
- storage::QuotaStatusCode status_code,
- int64_t usage,
- int64_t quota) {
+void GetOriginsTask::OnUsageAndQuotaObtained(const GURL& origin,
+ blink::QuotaStatusCode status_code,
+ int64_t usage,
+ int64_t quota) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (status_code == storage::kQuotaStatusOk) {
+ if (status_code == blink::QuotaStatusCode::kOk) {
origin_.push_back(origin.spec());
usage_.push_back(usage);
quota_.push_back(quota);
@@ -274,11 +274,11 @@
void OnUsageAndQuotaObtained(
const AwQuotaManagerBridge::QuotaUsageCallback& ui_callback,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (status_code != storage::kQuotaStatusOk) {
+ if (status_code != blink::QuotaStatusCode::kOk) {
usage = 0;
quota = 0;
}
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc
index c83e56ce..417b373 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -45,7 +45,7 @@
#include "jni/WebsitePreferenceBridge_jni.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/origin.h"
#include "url/url_constants.h"
@@ -679,7 +679,7 @@
}
void OnStorageInfoCleared(const ScopedJavaGlobalRef<jobject>& java_callback,
- storage::QuotaStatusCode code) {
+ blink::QuotaStatusCode code) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Java_StorageInfoClearedCallback_onStorageInfoCleared(
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc
index 7230d80b..929cda6a 100644
--- a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc
+++ b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc
@@ -170,5 +170,5 @@
}
void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota(
- storage::QuotaStatusCode /*status*/,
+ blink::QuotaStatusCode /*status*/,
int64_t /*quota*/) {}
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h
index 482ab89..569ff61 100644
--- a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h
+++ b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h
@@ -18,6 +18,7 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
class GURL;
@@ -65,7 +66,7 @@
QuotaInfoMap* quota_info);
void RevokeHostQuotaOnIOThread(const std::string& host);
- void DidRevokeHostQuota(storage::QuotaStatusCode status, int64_t quota);
+ void DidRevokeHostQuota(blink::QuotaStatusCode status, int64_t quota);
scoped_refptr<storage::QuotaManager> quota_manager_;
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
index 46562bc..8d88d37 100644
--- a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
@@ -90,8 +90,8 @@
weak_factory_.GetWeakPtr()));
}
- void GotPersistentHostQuota(storage::QuotaStatusCode status, int64_t quota) {
- EXPECT_EQ(storage::kQuotaStatusOk, status);
+ void GotPersistentHostQuota(blink::QuotaStatusCode status, int64_t quota) {
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, status);
quota_ = quota;
}
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
index 647f7f4..c24e6e2 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
@@ -67,6 +67,25 @@
static_cast<int>(code));
}
+const char* QuotaStatusCodeToString(blink::QuotaStatusCode status) {
+ switch (status) {
+ case blink::QuotaStatusCode::kOk:
+ return "OK.";
+ case blink::QuotaStatusCode::kErrorNotSupported:
+ return "Operation not supported.";
+ case blink::QuotaStatusCode::kErrorInvalidModification:
+ return "Invalid modification.";
+ case blink::QuotaStatusCode::kErrorInvalidAccess:
+ return "Invalid access.";
+ case blink::QuotaStatusCode::kErrorAbort:
+ return "Quota operation aborted.";
+ case blink::QuotaStatusCode::kUnknown:
+ return "Unknown error.";
+ }
+ NOTREACHED();
+ return "Unknown error.";
+}
+
} // namespace
bool SyncFileSystemDeleteFileSystemFunction::RunAsync() {
@@ -323,7 +342,7 @@
}
void SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota(
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
// Repost to switch from IO thread to UI thread for SendResponse().
@@ -337,7 +356,7 @@
}
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (status != storage::kQuotaStatusOk) {
+ if (status != blink::QuotaStatusCode::kOk) {
error_ = QuotaStatusCodeToString(status);
SendResponse(false);
return;
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
index 9863c8f9..902a961e 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
@@ -15,7 +15,7 @@
#include "chrome/browser/sync_file_system/sync_status_code.h"
#include "chrome/common/extensions/api/sync_file_system.h"
#include "storage/browser/fileapi/file_system_url.h"
-#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace storage {
class FileSystemContext;
@@ -93,7 +93,7 @@
bool RunAsync() override;
private:
- void DidGetUsageAndQuota(storage::QuotaStatusCode status,
+ void DidGetUsageAndQuota(blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
};
diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc
index 65041ad..52e51c3 100644
--- a/chrome/browser/extensions/extension_special_storage_policy.cc
+++ b/chrome/browser/extensions/extension_special_storage_policy.cc
@@ -32,8 +32,8 @@
#include "extensions/common/manifest_handlers/content_capabilities_handler.h"
#include "extensions/common/permissions/permissions_data.h"
#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
using content::BrowserThread;
using extensions::APIPermission;
@@ -42,10 +42,10 @@
namespace {
-void ReportQuotaUsage(storage::QuotaStatusCode code,
+void ReportQuotaUsage(blink::QuotaStatusCode code,
int64_t usage,
int64_t quota) {
- if (code == storage::kQuotaStatusOk) {
+ if (code == blink::QuotaStatusCode::kOk) {
// We're interested in the amount of space hosted apps are using. Record it
// when the extension is granted the unlimited storage permission (once per
// extension load, so on average once per run).
diff --git a/chrome/browser/storage/storage_info_fetcher.cc b/chrome/browser/storage/storage_info_fetcher.cc
index 7aa1748db..28e841ae 100644
--- a/chrome/browser/storage/storage_info_fetcher.cc
+++ b/chrome/browser/storage/storage_info_fetcher.cc
@@ -80,7 +80,7 @@
Release();
}
-void StorageInfoFetcher::OnUsageClearedInternal(storage::QuotaStatusCode code) {
+void StorageInfoFetcher::OnUsageClearedInternal(blink::QuotaStatusCode code) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
quota_manager_->ResetUsageTracker(type_to_delete_);
@@ -90,7 +90,7 @@
base::Bind(&StorageInfoFetcher::OnClearCompleted, this, code));
}
-void StorageInfoFetcher::OnClearCompleted(storage::QuotaStatusCode code) {
+void StorageInfoFetcher::OnClearCompleted(blink::QuotaStatusCode code) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
clear_callback_.Run(code);
diff --git a/chrome/browser/storage/storage_info_fetcher.h b/chrome/browser/storage/storage_info_fetcher.h
index 50465cf..6b111f9e 100644
--- a/chrome/browser/storage/storage_info_fetcher.h
+++ b/chrome/browser/storage/storage_info_fetcher.h
@@ -20,8 +20,7 @@
public:
using FetchCallback =
base::Callback<void(const storage::UsageInfoEntries&)>;
- using ClearCallback =
- base::Callback<void(storage::QuotaStatusCode code)>;
+ using ClearCallback = base::Callback<void(blink::QuotaStatusCode code)>;
explicit StorageInfoFetcher(Profile* profile);
@@ -49,10 +48,10 @@
void OnFetchCompleted();
// Called when usage has been cleared.
- void OnUsageClearedInternal(storage::QuotaStatusCode code);
+ void OnUsageClearedInternal(blink::QuotaStatusCode code);
// Reports back to all observers that storage has been deleted.
- void OnClearCompleted(storage::QuotaStatusCode code);
+ void OnClearCompleted(blink::QuotaStatusCode code);
// The quota manager to use to calculate the storage usage.
storage::QuotaManager* quota_manager_;
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index 30f36873e..e3206a3 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -196,7 +196,7 @@
void DidGetUsageAndQuota(const storage::StatusCallback& callback,
int64_t* usage_out,
int64_t* quota_out,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
*usage_out = usage;
@@ -464,10 +464,10 @@
origin_, type_));
}
-storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota(
+blink::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota(
int64_t* usage,
int64_t* quota) {
- return RunOnThread<storage::QuotaStatusCode>(
+ return RunOnThread<blink::QuotaStatusCode>(
io_task_runner_.get(), FROM_HERE,
base::BindOnce(&CannedSyncableFileSystem::DoGetUsageAndQuota,
base::Unretained(this), usage, quota));
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
index 4d3eaf2..f531d197a 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
@@ -25,6 +25,7 @@
#include "storage/common/fileapi/file_system_types.h"
#include "storage/common/fileapi/file_system_util.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace base {
class SingleThreadTaskRunner;
@@ -151,7 +152,7 @@
base::File::Error DeleteFileSystem();
// Retrieves the quota and usage.
- storage::QuotaStatusCode GetUsageAndQuota(int64_t* usage, int64_t* quota);
+ blink::QuotaStatusCode GetUsageAndQuota(int64_t* usage, int64_t* quota);
// ChangeTracker related methods. They run on file task runner.
void GetChangedURLsInTracker(storage::FileSystemURLSet* urls);
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
index de43b584..f0c1d784 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -611,7 +611,7 @@
// Record the initial usage (likely 0).
int64_t initial_usage = -1;
int64_t quota = -1;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&initial_usage, "a));
// Create a file and directory in the file_system.
@@ -637,7 +637,7 @@
// At this point the usage must be greater than the initial usage.
int64_t new_usage = -1;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_GT(new_usage, initial_usage);
@@ -673,7 +673,7 @@
EXPECT_TRUE(urls.empty());
// The quota usage data must have reflected the deletion.
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(new_usage, initial_usage);
@@ -699,7 +699,7 @@
// Record the initial usage (likely 0).
int64_t initial_usage = -1;
int64_t quota = -1;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&initial_usage, "a));
// Create a file and directory in the file_system.
@@ -713,7 +713,7 @@
// At this point the usage must be greater than the initial usage.
int64_t new_usage = -1;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_GT(new_usage, initial_usage);
@@ -740,7 +740,7 @@
EXPECT_TRUE(urls.empty());
// The quota usage data must have reflected the deletion.
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(new_usage, initial_usage);
@@ -806,7 +806,7 @@
// Record the usage.
int64_t usage = -1, new_usage = -1;
int64_t quota = -1;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&usage, "a));
// Here in the local filesystem we have:
@@ -833,7 +833,7 @@
// Check if the usage has been increased by (kTestFileData1 - kTestFileData0).
const int updated_size =
arraysize(kTestFileData1) - arraysize(kTestFileData0);
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(updated_size, new_usage - usage);
@@ -880,7 +880,7 @@
// Creating a file/directory must have increased the usage more than
// the size of kTestFileData2.
new_usage = usage;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system.GetUsageAndQuota(&new_usage, "a));
EXPECT_GT(new_usage,
static_cast<int64_t>(usage + arraysize(kTestFileData2) - 1));
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
index 0c0c5bef..1839bd5 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
@@ -30,7 +30,6 @@
using storage::FileSystemURL;
using storage::FileSystemURLSet;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
namespace sync_file_system {
@@ -129,7 +128,7 @@
const int64_t kQuota = 12345 * 1024;
QuotaManager::kSyncableStorageDefaultHostQuota = kQuota;
int64_t usage, quota;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system_.GetUsageAndQuota(&usage, "a));
// Returned quota must be what we overrode. Usage must be greater than 0
@@ -146,7 +145,7 @@
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend));
int64_t new_usage;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system_.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(kFileSizeToExtend, new_usage - usage);
@@ -157,7 +156,7 @@
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend + 1));
usage = new_usage;
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system_.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(usage, new_usage);
@@ -166,7 +165,7 @@
file_system_.DeleteFileSystem());
// Now the usage must be zero.
- EXPECT_EQ(storage::kQuotaStatusOk,
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
file_system_.GetUsageAndQuota(&usage, "a));
EXPECT_EQ(0, usage);
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 39445a17..db2bba1 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -45,7 +45,6 @@
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
@@ -248,8 +247,8 @@
}
}
-void SiteSettingsHandler::OnUsageInfoCleared(storage::QuotaStatusCode code) {
- if (code == storage::kQuotaStatusOk) {
+void SiteSettingsHandler::OnUsageInfoCleared(blink::QuotaStatusCode code) {
+ if (code == blink::QuotaStatusCode::kOk) {
CallJavascriptFunction("settings.WebsiteUsagePrivateApi.onUsageCleared",
base::Value(clearing_origin_));
}
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.h b/chrome/browser/ui/webui/settings/site_settings_handler.h
index 460e51d..457223f 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.h
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -16,6 +16,7 @@
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
class HostContentSettingsMap;
class Profile;
@@ -45,7 +46,7 @@
// Usage info.
void OnGetUsageInfo(const storage::UsageInfoEntries& entries);
- void OnUsageInfoCleared(storage::QuotaStatusCode code);
+ void OnUsageInfoCleared(blink::QuotaStatusCode code);
#if defined(OS_CHROMEOS)
// Alert the Javascript that the |kEnableDRM| pref has changed.
diff --git a/content/browser/appcache/appcache_quota_client.cc b/content/browser/appcache/appcache_quota_client.cc
index 97b6ef7..9c2c470 100644
--- a/content/browser/appcache/appcache_quota_client.cc
+++ b/content/browser/appcache/appcache_quota_client.cc
@@ -11,17 +11,18 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "content/browser/appcache/appcache_service_impl.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
using storage::QuotaClient;
namespace {
-storage::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) {
+blink::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) {
if (code == net::OK)
- return storage::kQuotaStatusOk;
+ return blink::QuotaStatusCode::kOk;
else if (code == net::ERR_ABORTED)
- return storage::kQuotaErrorAbort;
+ return blink::QuotaStatusCode::kErrorAbort;
else
- return storage::kQuotaStatusUnknown;
+ return blink::QuotaStatusCode::kUnknown;
}
void RunFront(content::AppCacheQuotaClient::RequestQueue* queue) {
@@ -117,7 +118,7 @@
DCHECK(!quota_manager_is_destroyed_);
if (!service_) {
- callback.Run(storage::kQuotaErrorAbort);
+ callback.Run(blink::QuotaStatusCode::kErrorAbort);
return;
}
@@ -239,7 +240,7 @@
RunFront(&pending_serial_requests_);
if (!current_delete_request_callback_.is_null()) {
- current_delete_request_callback_.Run(storage::kQuotaErrorAbort);
+ current_delete_request_callback_.Run(blink::QuotaStatusCode::kErrorAbort);
current_delete_request_callback_.Reset();
GetServiceDeleteCallback()->Cancel();
}
diff --git a/content/browser/appcache/appcache_quota_client_unittest.cc b/content/browser/appcache/appcache_quota_client_unittest.cc
index 1ba3f2d..53ef9e4 100644
--- a/content/browser/appcache/appcache_quota_client_unittest.cc
+++ b/content/browser/appcache/appcache_quota_client_unittest.cc
@@ -33,7 +33,7 @@
kOriginB("http://host:8000"),
kOriginOther("http://other"),
usage_(0),
- delete_status_(storage::kQuotaStatusUnknown),
+ delete_status_(blink::QuotaStatusCode::kUnknown),
num_get_origin_usage_completions_(0),
num_get_origins_completions_(0),
num_delete_origins_completions_(0),
@@ -65,10 +65,10 @@
return origins_;
}
- storage::QuotaStatusCode DeleteOriginData(storage::QuotaClient* client,
- storage::StorageType type,
- const GURL& origin) {
- delete_status_ = storage::kQuotaStatusUnknown;
+ blink::QuotaStatusCode DeleteOriginData(storage::QuotaClient* client,
+ storage::StorageType type,
+ const GURL& origin) {
+ delete_status_ = blink::QuotaStatusCode::kUnknown;
AsyncDeleteOriginData(client, type, origin);
base::RunLoop().RunUntilIdle();
return delete_status_;
@@ -140,7 +140,7 @@
origins_ = origins;
}
- void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) {
+ void OnDeleteOriginDataComplete(blink::QuotaStatusCode status) {
++num_delete_origins_completions_;
delete_status_ = status;
}
@@ -148,7 +148,7 @@
base::test::ScopedTaskEnvironment scoped_task_environment_;
int64_t usage_;
std::set<GURL> origins_;
- storage::QuotaStatusCode delete_status_;
+ blink::QuotaStatusCode delete_status_;
int num_get_origin_usage_completions_;
int num_get_origins_completions_;
int num_delete_origins_completions_;
@@ -174,8 +174,10 @@
EXPECT_TRUE(GetOriginsForType(client, kPerm).empty());
EXPECT_TRUE(GetOriginsForHost(client, kTemp, kOriginA.host()).empty());
EXPECT_TRUE(GetOriginsForHost(client, kPerm, kOriginA.host()).empty());
- EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kTemp, kOriginA));
- EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kPerm, kOriginA));
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
+ DeleteOriginData(client, kTemp, kOriginA));
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
+ DeleteOriginData(client, kPerm, kOriginA));
Call_NotifyAppCacheDestroyed(client);
Call_OnQuotaManagerDestroyed(client);
@@ -192,9 +194,9 @@
EXPECT_TRUE(GetOriginsForType(client, kPerm).empty());
EXPECT_TRUE(GetOriginsForHost(client, kTemp, kOriginA.host()).empty());
EXPECT_TRUE(GetOriginsForHost(client, kPerm, kOriginA.host()).empty());
- EXPECT_EQ(storage::kQuotaErrorAbort,
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort,
DeleteOriginData(client, kTemp, kOriginA));
- EXPECT_EQ(storage::kQuotaErrorAbort,
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort,
DeleteOriginData(client, kPerm, kOriginA));
Call_OnQuotaManagerDestroyed(client);
@@ -269,15 +271,17 @@
// Perm deletions are short circuited in the Client and
// should not reach the AppCacheServiceImpl.
- EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kPerm, kOriginA));
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
+ DeleteOriginData(client, kPerm, kOriginA));
EXPECT_EQ(0, mock_service_.delete_called_count());
- EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kTemp, kOriginA));
+ EXPECT_EQ(blink::QuotaStatusCode::kOk,
+ DeleteOriginData(client, kTemp, kOriginA));
EXPECT_EQ(1, mock_service_.delete_called_count());
mock_service_.set_mock_delete_appcaches_for_origin_result(
net::ERR_ABORTED);
- EXPECT_EQ(storage::kQuotaErrorAbort,
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort,
DeleteOriginData(client, kTemp, kOriginA));
EXPECT_EQ(2, mock_service_.delete_called_count());
@@ -359,7 +363,7 @@
EXPECT_EQ(3, num_delete_origins_completions_);
EXPECT_EQ(0, usage_);
EXPECT_TRUE(origins_.empty());
- EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_);
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_);
Call_OnQuotaManagerDestroyed(client);
}
@@ -412,13 +416,13 @@
// Should have been aborted.
EXPECT_EQ(1, num_delete_origins_completions_);
- EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_);
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_);
// A real completion callback from the service should
// be dropped if it comes in after NotifyAppCacheDestroyed.
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, num_delete_origins_completions_);
- EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_);
+ EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_);
Call_OnQuotaManagerDestroyed(client);
}
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc
index 7cbf946c..be08ad05 100644
--- a/content/browser/appcache/appcache_storage_impl.cc
+++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -37,6 +37,7 @@
#include "storage/browser/quota/quota_client.h"
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_manager_proxy.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace content {
@@ -601,7 +602,7 @@
AppCache* newest_cache);
void GetQuotaThenSchedule();
- void OnQuotaCallback(storage::QuotaStatusCode status,
+ void OnQuotaCallback(blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
@@ -673,11 +674,11 @@
}
void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback(
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
if (storage_) {
- if (status == storage::kQuotaStatusOk)
+ if (status == blink::QuotaStatusCode::kOk)
space_available_ = std::max(static_cast<int64_t>(0), quota - usage);
else
space_available_ = 0;
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc
index b522034..b977de3 100644
--- a/content/browser/appcache/appcache_storage_impl_unittest.cc
+++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -298,7 +298,7 @@
}
void CallCallback(const UsageAndQuotaCallback& callback) {
- callback.Run(storage::kQuotaStatusOk, 0, kMockQuota);
+ callback.Run(blink::QuotaStatusCode::kOk, 0, kMockQuota);
}
bool async_;
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc
index abf93d284..9254ab8 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -569,8 +569,8 @@
BatchDidGetUsageAndQuota(
operations, std::move(callback), std::move(bad_message_callback),
- 0 /* space_required */, 0 /* side_data_size */, storage::kQuotaStatusOk,
- 0 /* usage */, 0 /* quota */);
+ 0 /* space_required */, 0 /* side_data_size */,
+ blink::QuotaStatusCode::kOk, 0 /* usage */, 0 /* quota */);
}
void CacheStorageCache::BatchDidGetUsageAndQuota(
@@ -579,7 +579,7 @@
BadMessageCallback bad_message_callback,
uint64_t space_required,
uint64_t side_data_size,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota) {
base::CheckedNumeric<uint64_t> safe_space_required = space_required;
@@ -596,7 +596,7 @@
base::BindOnce(std::move(callback), CacheStorageError::kErrorStorage));
return;
}
- if (status_code != storage::kQuotaStatusOk ||
+ if (status_code != blink::QuotaStatusCode::kOk ||
safe_space_required.ValueOrDie() > quota) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
@@ -1089,10 +1089,10 @@
base::Time expected_response_time,
scoped_refptr<net::IOBuffer> buffer,
int buf_len,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota) {
- if (status_code != storage::kQuotaStatusOk || (buf_len > quota - usage)) {
+ if (status_code != blink::QuotaStatusCode::kOk || (buf_len > quota - usage)) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback),
CacheStorageError::kErrorQuotaExceeded));
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h
index 06c9397c1..6cd3d3d 100644
--- a/content/browser/cache_storage/cache_storage_cache.h
+++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -21,7 +21,7 @@
#include "content/common/service_worker/service_worker_types.h"
#include "net/base/io_buffer.h"
#include "net/disk_cache/disk_cache.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h"
namespace crypto {
@@ -155,7 +155,7 @@
BadMessageCallback bad_message_callback,
uint64_t space_required,
uint64_t side_data_size,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota);
// Callback passed to operations. If |error| is a real error, invokes
@@ -307,7 +307,7 @@
base::Time expected_response_time,
scoped_refptr<net::IOBuffer> buffer,
int buf_len,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota);
@@ -321,7 +321,7 @@
base::Time expected_response_time,
scoped_refptr<net::IOBuffer> buffer,
int buf_len,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota);
void WriteSideDataDidOpenEntry(ErrorCallback callback,
@@ -353,7 +353,7 @@
void PutDidDeleteEntry(std::unique_ptr<PutContext> put_context,
blink::mojom::CacheStorageError error);
void PutDidGetUsageAndQuota(std::unique_ptr<PutContext> put_context,
- storage::QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota);
void PutDidCreateEntry(std::unique_ptr<disk_cache::Entry*> entry_ptr,
diff --git a/content/browser/cache_storage/cache_storage_manager.cc b/content/browser/cache_storage/cache_storage_manager.cc
index 30dc6bd..9d00a42bb 100644
--- a/content/browser/cache_storage/cache_storage_manager.cc
+++ b/content/browser/cache_storage/cache_storage_manager.cc
@@ -31,7 +31,7 @@
#include "net/base/url_util.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/common/database/database_identifier.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -49,8 +49,9 @@
DCHECK_CURRENTLY_ON(BrowserThread::IO);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, rv ? storage::kQuotaStatusOk
- : storage::kQuotaErrorAbort));
+ FROM_HERE,
+ base::BindOnce(callback, rv ? blink::QuotaStatusCode::kOk
+ : blink::QuotaStatusCode::kErrorAbort));
}
// Calculate the sum of all cache sizes in this store, but only if all sizes are
@@ -123,7 +124,7 @@
FROM_HERE, base::BindOnce(callback, out_origins));
}
-void EmptyQuotaStatusCallback(storage::QuotaStatusCode code) {}
+void EmptyQuotaStatusCallback(blink::QuotaStatusCode code) {}
void AllOriginSizesReported(
std::unique_ptr<std::vector<CacheStorageUsageInfo>> usages,
@@ -426,7 +427,7 @@
if (IsMemoryBacked()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(callback, storage::kQuotaStatusOk));
+ FROM_HERE, base::BindOnce(callback, blink::QuotaStatusCode::kOk));
return;
}
diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc
index 4d474bd..7372078 100644
--- a/content/browser/cache_storage/cache_storage_manager_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc
@@ -52,6 +52,7 @@
#include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/common/blob_storage/blob_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h"
using blink::mojom::CacheStorageError;
@@ -551,10 +552,10 @@
void DidGetQuotaOriginUsage(int64_t* out_usage,
base::RunLoop* run_loop,
- QuotaStatusCode status_code,
+ blink::QuotaStatusCode status_code,
int64_t usage,
int64_t quota) {
- if (status_code == storage::kQuotaStatusOk)
+ if (status_code == blink::QuotaStatusCode::kOk)
*out_usage = usage;
run_loop->Quit();
}
@@ -1669,7 +1670,7 @@
}
void DeleteOriginCallback(base::RunLoop* run_loop,
- storage::QuotaStatusCode status) {
+ blink::QuotaStatusCode status) {
callback_status_ = status;
run_loop->Quit();
}
@@ -1711,7 +1712,7 @@
base::Bind(&CacheStorageQuotaClientTest::DeleteOriginCallback,
base::Unretained(this), base::Unretained(&loop)));
loop.Run();
- return callback_status_ == storage::kQuotaStatusOk;
+ return callback_status_ == blink::QuotaStatusCode::kOk;
}
bool QuotaDoesSupport(storage::StorageType type) {
@@ -1720,7 +1721,7 @@
std::unique_ptr<CacheStorageQuotaClient> quota_client_;
- storage::QuotaStatusCode callback_status_;
+ blink::QuotaStatusCode callback_status_;
int64_t callback_quota_usage_ = 0;
std::set<GURL> callback_origins_;
diff --git a/content/browser/cache_storage/cache_storage_quota_client.cc b/content/browser/cache_storage/cache_storage_quota_client.cc
index cfbdbf093..8ac1f97 100644
--- a/content/browser/cache_storage/cache_storage_quota_client.cc
+++ b/content/browser/cache_storage/cache_storage_quota_client.cc
@@ -6,6 +6,7 @@
#include "content/browser/cache_storage/cache_storage_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace content {
@@ -73,12 +74,12 @@
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!cache_manager_) {
- callback.Run(storage::kQuotaErrorAbort);
+ callback.Run(blink::QuotaStatusCode::kErrorAbort);
return;
}
if (!DoesSupport(type)) {
- callback.Run(storage::kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
diff --git a/content/browser/devtools/protocol/storage_handler.cc b/content/browser/devtools/protocol/storage_handler.cc
index e19d123..4e2b2e3 100644
--- a/content/browser/devtools/protocol/storage_handler.cc
+++ b/content/browser/devtools/protocol/storage_handler.cc
@@ -16,7 +16,7 @@
#include "content/public/browser/storage_partition.h"
#include "storage/browser/quota/quota_client.h"
#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -45,12 +45,12 @@
void ReportUsageAndQuotaDataOnUIThread(
std::unique_ptr<StorageHandler::GetUsageAndQuotaCallback> callback,
- storage::QuotaStatusCode code,
+ blink::QuotaStatusCode code,
int64_t usage,
int64_t quota,
base::flat_map<storage::QuotaClient::ID, int64_t> usage_breakdown) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (code != storage::kQuotaStatusOk) {
+ if (code != blink::QuotaStatusCode::kOk) {
return callback->sendFailure(
Response::Error("Quota information is not available"));
}
@@ -70,7 +70,7 @@
void GotUsageAndQuotaDataCallback(
std::unique_ptr<StorageHandler::GetUsageAndQuotaCallback> callback,
- storage::QuotaStatusCode code,
+ blink::QuotaStatusCode code,
int64_t usage,
int64_t quota,
base::flat_map<storage::QuotaClient::ID, int64_t> usage_breakdown) {
diff --git a/content/browser/indexed_db/database_impl.cc b/content/browser/indexed_db/database_impl.cc
index 3bba482..10c9ce4 100644
--- a/content/browser/indexed_db/database_impl.cc
+++ b/content/browser/indexed_db/database_impl.cc
@@ -18,6 +18,7 @@
#include "content/browser/indexed_db/indexed_db_value.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/quota/quota_manager_proxy.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h"
using std::swap;
@@ -130,7 +131,7 @@
const IndexedDBDatabaseError& error);
void Commit(int64_t transaction_id);
void OnGotUsageAndQuotaForCommit(int64_t transaction_id,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
void AckReceivedBlobs(const std::vector<std::string>& uuids);
@@ -923,7 +924,7 @@
void DatabaseImpl::IDBSequenceHelper::OnGotUsageAndQuotaForCommit(
int64_t transaction_id,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -936,7 +937,7 @@
if (!transaction)
return;
- if (status == storage::kQuotaStatusOk &&
+ if (status == blink::QuotaStatusCode::kOk &&
usage + transaction->size() <= quota) {
connection_->database()->Commit(transaction);
} else {
diff --git a/content/browser/indexed_db/indexed_db_quota_client.cc b/content/browser/indexed_db/indexed_db_quota_client.cc
index 5c9bd66e..2198c12 100644
--- a/content/browser/indexed_db/indexed_db_quota_client.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/browser_thread.h"
#include "net/base/url_util.h"
#include "storage/browser/database/database_util.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/origin.h"
using storage::QuotaClient;
@@ -21,11 +22,11 @@
namespace content {
namespace {
-storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread(
+blink::QuotaStatusCode DeleteOriginDataOnIndexedDBThread(
IndexedDBContextImpl* context,
const GURL& origin) {
context->DeleteForOrigin(origin);
- return storage::kQuotaStatusOk;
+ return blink::QuotaStatusCode::kOk;
}
int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context,
@@ -138,7 +139,7 @@
storage::StorageType type,
const DeletionCallback& callback) {
if (type != storage::kStorageTypeTemporary) {
- callback.Run(storage::kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
index fa90cef..0b12f0a 100644
--- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -24,6 +24,7 @@
#include "content/public/test/test_utils.h"
#include "storage/browser/test/mock_quota_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
// Declared to shorten the line lengths.
static const storage::StorageType kTemp = storage::kStorageTypeTemporary;
@@ -112,10 +113,10 @@
return origins_;
}
- storage::QuotaStatusCode DeleteOrigin(storage::QuotaClient* client,
- const GURL& origin_url,
- storage::StorageType type) {
- delete_status_ = storage::kQuotaStatusUnknown;
+ blink::QuotaStatusCode DeleteOrigin(storage::QuotaClient* client,
+ const GURL& origin_url,
+ storage::StorageType type) {
+ delete_status_ = blink::QuotaStatusCode::kUnknown;
client->DeleteOriginData(
origin_url, type,
base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete,
@@ -150,7 +151,7 @@
origins_ = origins;
}
- void OnDeleteOriginComplete(storage::QuotaStatusCode code) {
+ void OnDeleteOriginComplete(blink::QuotaStatusCode code) {
delete_status_ = code;
}
@@ -160,7 +161,7 @@
std::set<GURL> origins_;
scoped_refptr<IndexedDBContextImpl> idb_context_;
std::unique_ptr<TestBrowserContext> browser_context_;
- storage::QuotaStatusCode delete_status_;
+ blink::QuotaStatusCode delete_status_;
base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBQuotaClientTest);
@@ -229,19 +230,18 @@
EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
- storage::QuotaStatusCode delete_status =
- DeleteOrigin(&client, kOriginA, kTemp);
- EXPECT_EQ(storage::kQuotaStatusOk, delete_status);
+ blink::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA, kTemp);
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status);
EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
// IndexedDB only supports temporary storage; requests to delete other types
// are no-ops, but should not fail.
delete_status = DeleteOrigin(&client, kOriginA, kPerm);
- EXPECT_EQ(storage::kQuotaStatusOk, delete_status);
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status);
delete_status = DeleteOrigin(&client, kOriginA, kSync);
- EXPECT_EQ(storage::kQuotaStatusOk, delete_status);
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status);
}
} // namespace content
diff --git a/content/browser/quota_dispatcher_host.cc b/content/browser/quota_dispatcher_host.cc
index ab3061f..a936cdbe 100644
--- a/content/browser/quota_dispatcher_host.cc
+++ b/content/browser/quota_dispatcher_host.cc
@@ -14,11 +14,11 @@
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/base/url_util.h"
#include "storage/browser/quota/quota_manager.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/origin.h"
using storage::QuotaClient;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
using storage::StorageType;
namespace content {
@@ -67,7 +67,7 @@
if (storage_type != storage::kStorageTypeTemporary &&
storage_type != storage::kStorageTypePersistent) {
// Unsupported storage types.
- std::move(callback).Run(storage::kQuotaErrorNotSupported, 0, 0);
+ std::move(callback).Run(blink::QuotaStatusCode::kErrorNotSupported, 0, 0);
return;
}
@@ -91,7 +91,7 @@
void QuotaDispatcherHost::DidQueryStorageUsageAndQuota(
RequestStorageQuotaCallback callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
std::move(callback).Run(status, usage, quota);
@@ -103,10 +103,10 @@
storage::StorageType storage_type,
uint64_t requested_quota,
RequestStorageQuotaCallback callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t current_usage,
int64_t current_quota) {
- if (status != storage::kQuotaStatusOk) {
+ if (status != blink::QuotaStatusCode::kOk) {
std::move(callback).Run(status, 0, 0);
return;
}
@@ -119,7 +119,7 @@
base::saturated_cast<int64_t>(requested_quota);
if (quota_manager_->IsStorageUnlimited(origin.GetURL(), storage_type) ||
requested_quota_signed <= current_quota) {
- std::move(callback).Run(storage::kQuotaStatusOk, current_usage,
+ std::move(callback).Run(blink::QuotaStatusCode::kOk, current_usage,
requested_quota);
return;
}
@@ -150,7 +150,7 @@
QuotaPermissionContext::QuotaPermissionResponse response) {
// If user didn't allow the new quota, just return the current quota.
if (response != QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW) {
- std::move(callback).Run(storage::kQuotaStatusOk, current_usage,
+ std::move(callback).Run(blink::QuotaStatusCode::kOk, current_usage,
current_quota);
return;
}
@@ -168,7 +168,7 @@
void QuotaDispatcherHost::DidSetHostQuota(int64_t current_usage,
RequestStorageQuotaCallback callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t new_quota) {
std::move(callback).Run(status, current_usage, new_quota);
}
@@ -176,7 +176,7 @@
void QuotaDispatcherHost::DidGetTemporaryUsageAndQuota(
int64_t requested_quota,
RequestStorageQuotaCallback callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
std::move(callback).Run(status, usage, std::min(requested_quota, quota));
diff --git a/content/browser/quota_dispatcher_host.h b/content/browser/quota_dispatcher_host.h
index 01e6999..215325c 100644
--- a/content/browser/quota_dispatcher_host.h
+++ b/content/browser/quota_dispatcher_host.h
@@ -8,7 +8,7 @@
#include "base/macros.h"
#include "content/common/quota_dispatcher_host.mojom.h"
#include "content/public/browser/quota_permission_context.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace storage {
class QuotaManager;
@@ -47,7 +47,7 @@
private:
void DidQueryStorageUsageAndQuota(RequestStorageQuotaCallback callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
void DidGetPersistentUsageAndQuota(int64_t render_frame_id,
@@ -55,7 +55,7 @@
storage::StorageType storage_type,
uint64_t requested_quota,
RequestStorageQuotaCallback callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
void DidGetPermissionResponse(
@@ -67,11 +67,11 @@
QuotaPermissionContext::QuotaPermissionResponse response);
void DidSetHostQuota(int64_t current_usage,
RequestStorageQuotaCallback callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t new_quota);
void DidGetTemporaryUsageAndQuota(int64_t requested_quota,
RequestStorageQuotaCallback callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
diff --git a/content/browser/renderer_host/web_database_host_impl.cc b/content/browser/renderer_host/web_database_host_impl.cc
index 2ab649e4..0731b83 100644
--- a/content/browser/renderer_host/web_database_host_impl.cc
+++ b/content/browser/renderer_host/web_database_host_impl.cc
@@ -18,13 +18,12 @@
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/common/database/database_identifier.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "third_party/sqlite/sqlite3.h"
using storage::DatabaseUtil;
using storage::VfsBackend;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
namespace content {
namespace {
@@ -188,10 +187,10 @@
db_tracker_->task_runner(), origin.GetURL(),
storage::kStorageTypeTemporary,
base::Bind(
- [](GetSpaceAvailableCallback callback,
- storage::QuotaStatusCode status, int64_t usage, int64_t quota) {
+ [](GetSpaceAvailableCallback callback, blink::QuotaStatusCode status,
+ int64_t usage, int64_t quota) {
int64_t available = 0;
- if ((status == storage::kQuotaStatusOk) && (usage < quota)) {
+ if ((status == blink::QuotaStatusCode::kOk) && (usage < quota)) {
available = quota - usage;
}
std::move(callback).Run(available);
diff --git a/content/browser/service_worker/service_worker_quota_client.cc b/content/browser/service_worker/service_worker_quota_client.cc
index 2a7842f..4819a05 100644
--- a/content/browser/service_worker/service_worker_quota_client.cc
+++ b/content/browser/service_worker/service_worker_quota_client.cc
@@ -27,8 +27,8 @@
void ReportToQuotaStatus(const QuotaClient::DeletionCallback& callback,
bool status) {
- callback.Run(status ? storage::QuotaStatusCode::kQuotaStatusOk
- : storage::QuotaStatusCode::kQuotaStatusUnknown);
+ callback.Run(status ? blink::QuotaStatusCode::kOk
+ : blink::QuotaStatusCode::kUnknown);
}
void FindUsageForOrigin(const QuotaClient::GetUsageCallback& callback,
@@ -98,7 +98,7 @@
storage::StorageType type,
const DeletionCallback& callback) {
if (type != storage::StorageType::kStorageTypeTemporary) {
- callback.Run(storage::QuotaStatusCode::kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
context_->DeleteForOrigin(origin, base::Bind(&ReportToQuotaStatus, callback));
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index ed100ce..53ae35d 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -49,6 +49,7 @@
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/database/database_tracker.h"
#include "storage/browser/quota/quota_manager.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#if !defined(OS_ANDROID)
#include "content/browser/host_zoom_map_impl.h"
@@ -124,12 +125,12 @@
storage::StorageType type,
size_t* deletion_task_count,
const base::Closure& callback,
- storage::QuotaStatusCode status) {
+ blink::QuotaStatusCode status) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK_GT(*deletion_task_count, 0u);
- if (status != storage::kQuotaStatusOk) {
+ if (status != blink::QuotaStatusCode::kOk) {
DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin "
- << origin << ". Status: " << status;
+ << origin << ". Status: " << static_cast<int>(status);
}
(*deletion_task_count)--;
diff --git a/content/renderer/quota_dispatcher.cc b/content/renderer/quota_dispatcher.cc
index 399ce386..c13df85 100644
--- a/content/renderer/quota_dispatcher.cc
+++ b/content/renderer/quota_dispatcher.cc
@@ -21,7 +21,7 @@
using blink::WebStorageQuotaCallbacks;
using blink::WebStorageQuotaError;
using blink::WebStorageQuotaType;
-using storage::QuotaStatusCode;
+using blink::QuotaStatusCode;
using storage::StorageType;
namespace content {
@@ -45,7 +45,7 @@
void DidGrantStorageQuota(int64_t usage, int64_t granted_quota) override {
callbacks_.DidGrantStorageQuota(usage, granted_quota);
}
- void DidFail(storage::QuotaStatusCode error) override {
+ void DidFail(QuotaStatusCode error) override {
callbacks_.DidFail(static_cast<WebStorageQuotaError>(error));
}
@@ -86,7 +86,7 @@
base::IDMap<std::unique_ptr<Callback>>::iterator iter(
&pending_quota_callbacks_);
while (!iter.IsAtEnd()) {
- iter.GetCurrentValue()->DidFail(storage::kQuotaErrorAbort);
+ iter.GetCurrentValue()->DidFail(blink::QuotaStatusCode::kErrorAbort);
iter.Advance();
}
@@ -143,10 +143,10 @@
}
void QuotaDispatcher::DidGrantStorageQuota(int64_t request_id,
- storage::QuotaStatusCode status,
+ QuotaStatusCode status,
int64_t current_usage,
int64_t granted_quota) {
- if (status != storage::kQuotaStatusOk) {
+ if (status != blink::QuotaStatusCode::kOk) {
DidFail(request_id, status);
return;
}
@@ -157,12 +157,11 @@
pending_quota_callbacks_.Remove(request_id);
}
-void QuotaDispatcher::DidQueryStorageUsageAndQuota(
- int64_t request_id,
- storage::QuotaStatusCode status,
- int64_t current_usage,
- int64_t current_quota) {
- if (status != storage::kQuotaStatusOk) {
+void QuotaDispatcher::DidQueryStorageUsageAndQuota(int64_t request_id,
+ QuotaStatusCode status,
+ int64_t current_usage,
+ int64_t current_quota) {
+ if (status != blink::QuotaStatusCode::kOk) {
DidFail(request_id, status);
return;
}
@@ -190,10 +189,10 @@
"mismatching enums: kStorageTypePersistent");
static_assert(int(blink::kWebStorageQuotaErrorNotSupported) ==
- int(storage::kQuotaErrorNotSupported),
+ int(blink::QuotaStatusCode::kErrorNotSupported),
"mismatching enums: kQuotaErrorNotSupported");
static_assert(int(blink::kWebStorageQuotaErrorAbort) ==
- int(storage::kQuotaErrorAbort),
+ int(blink::QuotaStatusCode::kErrorAbort),
"mismatching enums: kQuotaErrorAbort");
} // namespace content
diff --git a/content/renderer/quota_dispatcher.h b/content/renderer/quota_dispatcher.h
index 308d280..1a56a8f 100644
--- a/content/renderer/quota_dispatcher.h
+++ b/content/renderer/quota_dispatcher.h
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "content/common/quota_dispatcher_host.mojom.h"
#include "content/public/renderer/worker_thread.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace blink {
class WebStorageQuotaCallbacks;
@@ -40,7 +41,7 @@
virtual ~Callback() {}
virtual void DidQueryStorageUsageAndQuota(int64_t usage, int64_t quota) = 0;
virtual void DidGrantStorageQuota(int64_t usage, int64_t granted_quota) = 0;
- virtual void DidFail(storage::QuotaStatusCode status) = 0;
+ virtual void DidFail(blink::QuotaStatusCode status) = 0;
};
explicit QuotaDispatcher(
@@ -69,14 +70,14 @@
private:
// Message handlers.
void DidQueryStorageUsageAndQuota(int64_t request_id,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t current_usage,
int64_t current_quota);
void DidGrantStorageQuota(int64_t request_id,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t current_usage,
int64_t granted_quota);
- void DidFail(int request_id, storage::QuotaStatusCode error);
+ void DidFail(int request_id, blink::QuotaStatusCode error);
content::mojom::QuotaDispatcherHostPtr quota_host_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
diff --git a/storage/browser/database/database_quota_client.cc b/storage/browser/database/database_quota_client.cc
index e53dd0c..bd6f49c 100644
--- a/storage/browser/database/database_quota_client.cc
+++ b/storage/browser/database/database_quota_client.cc
@@ -20,6 +20,7 @@
#include "storage/browser/database/database_tracker.h"
#include "storage/browser/database/database_util.h"
#include "storage/common/database/database_identifier.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
using storage::QuotaClient;
@@ -81,11 +82,11 @@
return;
}
- storage::QuotaStatusCode status;
+ blink::QuotaStatusCode status;
if (result == net::OK)
- status = storage::kQuotaStatusOk;
+ status = blink::QuotaStatusCode::kOk;
else
- status = storage::kQuotaStatusUnknown;
+ status = blink::QuotaStatusCode::kUnknown;
original_task_runner->PostTask(FROM_HERE, base::BindOnce(callback, status));
}
@@ -183,12 +184,12 @@
// All databases are in the temp namespace for now, so nothing to delete.
if (type != storage::kStorageTypeTemporary) {
- callback.Run(storage::kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
// DidDeleteOriginData() translates the net::Error response to a
- // storage::QuotaStatusCode if necessary, and no-ops as appropriate if
+ // blink::QuotaStatusCode if necessary, and no-ops as appropriate if
// DatabaseTracker::ScheduleDatabasesForDeletion will also invoke the
// callback.
auto delete_callback = base::BindRepeating(
diff --git a/storage/browser/database/database_quota_client_unittest.cc b/storage/browser/database/database_quota_client_unittest.cc
index f10643ef..4db4769 100644
--- a/storage/browser/database/database_quota_client_unittest.cc
+++ b/storage/browser/database/database_quota_client_unittest.cc
@@ -178,14 +178,14 @@
bool DeleteOriginData(storage::QuotaClient* client,
storage::StorageType type,
const GURL& origin) {
- delete_status_ = storage::kQuotaStatusUnknown;
+ delete_status_ = blink::QuotaStatusCode::kUnknown;
client->DeleteOriginData(
origin, type,
base::AdaptCallbackForRepeating(
base::BindOnce(&DatabaseQuotaClientTest::OnDeleteOriginDataComplete,
weak_factory_.GetWeakPtr())));
base::RunLoop().RunUntilIdle();
- return delete_status_ == storage::kQuotaStatusOk;
+ return delete_status_ == blink::QuotaStatusCode::kOk;
}
MockDatabaseTracker* mock_tracker() { return mock_tracker_.get(); }
@@ -197,14 +197,14 @@
origins_ = origins;
}
- void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) {
+ void OnDeleteOriginDataComplete(blink::QuotaStatusCode status) {
delete_status_ = status;
}
base::test::ScopedTaskEnvironment scoped_task_environment_;
int64_t usage_;
std::set<GURL> origins_;
- storage::QuotaStatusCode delete_status_;
+ blink::QuotaStatusCode delete_status_;
scoped_refptr<MockDatabaseTracker> mock_tracker_;
base::WeakPtrFactory<DatabaseQuotaClientTest> weak_factory_;
};
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
index c02cd38..df6d4d37 100644
--- a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
+++ b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -387,9 +387,9 @@
void GetUsageAndQuota(storage::FileSystemType type,
int64_t* usage,
int64_t* quota) {
- storage::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota(
+ blink::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota(
quota_manager_.get(), origin_, type, usage, quota);
- ASSERT_EQ(storage::kQuotaStatusOk, status);
+ ASSERT_EQ(blink::QuotaStatusCode::kOk, status);
}
private:
diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc
index 90219de5..5791ffa2 100644
--- a/storage/browser/fileapi/file_system_operation_impl.cc
+++ b/storage/browser/fileapi/file_system_operation_impl.cc
@@ -416,11 +416,11 @@
void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask(
const base::Closure& task,
const base::Closure& error_callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
- if (status != storage::kQuotaStatusOk) {
- LOG(WARNING) << "Got unexpected quota error : " << status;
+ if (status != blink::QuotaStatusCode::kOk) {
+ LOG(WARNING) << "Got unexpected quota error : " << static_cast<int>(status);
error_callback.Run();
return;
}
diff --git a/storage/browser/fileapi/file_system_operation_impl.h b/storage/browser/fileapi/file_system_operation_impl.h
index eed8df5..1a625dc7 100644
--- a/storage/browser/fileapi/file_system_operation_impl.h
+++ b/storage/browser/fileapi/file_system_operation_impl.h
@@ -19,7 +19,7 @@
#include "storage/browser/fileapi/file_system_url.h"
#include "storage/browser/fileapi/file_writer_delegate.h"
#include "storage/browser/storage_browser_export.h"
-#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace storage {
@@ -124,7 +124,7 @@
// |error_callback|.
void DidGetUsageAndQuotaAndRunTask(const base::Closure& task,
const base::Closure& error_callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
diff --git a/storage/browser/fileapi/file_system_operation_impl_unittest.cc b/storage/browser/fileapi/file_system_operation_impl_unittest.cc
index aa82eab9..d9dc80f 100644
--- a/storage/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/storage/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -253,14 +253,11 @@
}
void GetUsageAndQuota(int64_t* usage, int64_t* quota) {
- storage::QuotaStatusCode status =
- AsyncFileTestHelper::GetUsageAndQuota(quota_manager_.get(),
- sandbox_file_system_.origin(),
- sandbox_file_system_.type(),
- usage,
- quota);
+ blink::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota(
+ quota_manager_.get(), sandbox_file_system_.origin(),
+ sandbox_file_system_.type(), usage, quota);
scoped_task_environment_.RunUntilIdle();
- ASSERT_EQ(storage::kQuotaStatusOk, status);
+ ASSERT_EQ(blink::QuotaStatusCode::kOk, status);
}
int64_t ComputePathCost(const FileSystemURL& url) {
diff --git a/storage/browser/fileapi/file_system_quota_client.cc b/storage/browser/fileapi/file_system_quota_client.cc
index 1a2feb2..e6274ae 100644
--- a/storage/browser/fileapi/file_system_quota_client.cc
+++ b/storage/browser/fileapi/file_system_quota_client.cc
@@ -18,6 +18,7 @@
#include "storage/browser/fileapi/file_system_usage_cache.h"
#include "storage/browser/fileapi/sandbox_file_system_backend.h"
#include "storage/common/fileapi/file_system_util.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
using storage::StorageType;
@@ -58,19 +59,18 @@
callback.Run(*origins_ptr);
}
-storage::QuotaStatusCode DeleteOriginOnFileTaskRunner(
- FileSystemContext* context,
- const GURL& origin,
- FileSystemType type) {
+blink::QuotaStatusCode DeleteOriginOnFileTaskRunner(FileSystemContext* context,
+ const GURL& origin,
+ FileSystemType type) {
FileSystemBackend* provider = context->GetFileSystemBackend(type);
if (!provider || !provider->GetQuotaUtil())
- return storage::kQuotaErrorNotSupported;
+ return blink::QuotaStatusCode::kErrorNotSupported;
base::File::Error result =
provider->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner(
context, context->quota_manager_proxy(), origin, type);
if (result == base::File::FILE_OK)
- return storage::kQuotaStatusOk;
- return storage::kQuotaErrorInvalidModification;
+ return blink::QuotaStatusCode::kOk;
+ return blink::QuotaStatusCode::kErrorInvalidModification;
}
} // namespace
diff --git a/storage/browser/fileapi/file_system_quota_client_unittest.cc b/storage/browser/fileapi/file_system_quota_client_unittest.cc
index ccf04f85..1e6c93a 100644
--- a/storage/browser/fileapi/file_system_quota_client_unittest.cc
+++ b/storage/browser/fileapi/file_system_quota_client_unittest.cc
@@ -22,6 +22,7 @@
#include "storage/common/fileapi/file_system_util.h"
#include "storage/common/quota/quota_types.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
using content::AsyncFileTestHelper;
@@ -45,7 +46,7 @@
public:
FileSystemQuotaClientTest()
: additional_callback_count_(0),
- deletion_status_(storage::kQuotaStatusUnknown),
+ deletion_status_(blink::QuotaStatusCode::kUnknown),
weak_factory_(this) {}
void SetUp() override {
@@ -200,7 +201,7 @@
void DeleteOriginData(FileSystemQuotaClient* quota_client,
const std::string& origin,
storage::StorageType type) {
- deletion_status_ = storage::kQuotaStatusUnknown;
+ deletion_status_ = blink::QuotaStatusCode::kUnknown;
quota_client->DeleteOriginData(
GURL(origin), type,
base::Bind(&FileSystemQuotaClientTest::OnDeleteOrigin,
@@ -208,7 +209,7 @@
}
int64_t usage() const { return usage_; }
- storage::QuotaStatusCode status() { return deletion_status_; }
+ blink::QuotaStatusCode status() { return deletion_status_; }
int additional_callback_count() const { return additional_callback_count_; }
void set_additional_callback_count(int count) {
additional_callback_count_ = count;
@@ -225,7 +226,7 @@
++additional_callback_count_;
}
- void OnDeleteOrigin(storage::QuotaStatusCode status) {
+ void OnDeleteOrigin(blink::QuotaStatusCode status) {
deletion_status_ = status;
}
@@ -235,7 +236,7 @@
int64_t usage_;
int additional_callback_count_;
std::set<GURL> origins_;
- storage::QuotaStatusCode deletion_status_;
+ blink::QuotaStatusCode deletion_status_;
base::WeakPtrFactory<FileSystemQuotaClientTest> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest);
@@ -530,15 +531,15 @@
DeleteOriginData(quota_client.get(), "http://foo.com/", kTemporary);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(storage::kQuotaStatusOk, status());
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, status());
DeleteOriginData(quota_client.get(), "http://bar.com/", kPersistent);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(storage::kQuotaStatusOk, status());
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, status());
DeleteOriginData(quota_client.get(), "http://buz.com/", kTemporary);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(storage::kQuotaStatusOk, status());
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, status());
EXPECT_EQ(0, GetOriginUsage(
quota_client.get(), "http://foo.com/", kTemporary));
diff --git a/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/storage/browser/fileapi/obfuscated_file_util_unittest.cc
index 3d18579..35ae9f7 100644
--- a/storage/browser/fileapi/obfuscated_file_util_unittest.cc
+++ b/storage/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -159,7 +159,7 @@
origin_(GURL("http://www.example.com")),
type_(storage::kFileSystemTypeTemporary),
sandbox_file_system_(origin_, type_),
- quota_status_(storage::kQuotaStatusUnknown),
+ quota_status_(blink::QuotaStatusCode::kUnknown),
usage_(-1),
weak_factory_(this) {}
@@ -282,7 +282,7 @@
sandbox_file_system_.type(),
&usage_,
"a);
- EXPECT_EQ(storage::kQuotaStatusOk, quota_status_);
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, quota_status_);
}
void RevokeUsageCache() {
@@ -823,7 +823,7 @@
GURL origin_;
storage::FileSystemType type_;
SandboxFileSystemTestHelper sandbox_file_system_;
- storage::QuotaStatusCode quota_status_;
+ blink::QuotaStatusCode quota_status_;
int64_t usage_;
storage::MockFileChangeObserver change_observer_;
storage::ChangeObserverList change_observers_;
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.cc b/storage/browser/fileapi/quota/quota_backend_impl.cc
index 668a40d..e777687c9 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl.cc
+++ b/storage/browser/fileapi/quota/quota_backend_impl.cc
@@ -106,14 +106,14 @@
void QuotaBackendImpl::DidGetUsageAndQuotaForReserveQuota(
const QuotaReservationInfo& info,
const ReserveQuotaCallback& callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
DCHECK(file_task_runner_->RunsTasksInCurrentSequence());
DCHECK(info.origin.is_valid());
DCHECK_LE(0, usage);
DCHECK_LE(0, quota);
- if (status != storage::kQuotaStatusOk) {
+ if (status != blink::QuotaStatusCode::kOk) {
callback.Run(base::File::FILE_ERROR_FAILED, 0);
return;
}
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.h b/storage/browser/fileapi/quota/quota_backend_impl.h
index 66c69744..ed364bd6 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl.h
+++ b/storage/browser/fileapi/quota/quota_backend_impl.h
@@ -13,7 +13,7 @@
#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
#include "storage/browser/storage_browser_export.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace base {
class SequencedTaskRunner;
@@ -75,7 +75,7 @@
void DidGetUsageAndQuotaForReserveQuota(const QuotaReservationInfo& info,
const ReserveQuotaCallback& callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
diff --git a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
index 83b3281d..323c789 100644
--- a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
+++ b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
@@ -72,7 +72,7 @@
const GURL& origin,
storage::StorageType type,
const UsageAndQuotaCallback& callback) override {
- callback.Run(storage::kQuotaStatusOk, usage_, quota_);
+ callback.Run(blink::QuotaStatusCode::kOk, usage_, quota_);
}
int storage_modified_count() { return storage_modified_count_; }
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.cc b/storage/browser/fileapi/sandbox_file_stream_writer.cc
index 0f4895d5c..4b09e38 100644
--- a/storage/browser/fileapi/sandbox_file_stream_writer.cc
+++ b/storage/browser/fileapi/sandbox_file_stream_writer.cc
@@ -169,13 +169,13 @@
void SandboxFileStreamWriter::DidGetUsageAndQuota(
const net::CompletionCallback& callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
if (CancelIfRequested())
return;
- if (status != storage::kQuotaStatusOk) {
- LOG(WARNING) << "Got unexpected quota error : " << status;
+ if (status != blink::QuotaStatusCode::kOk) {
+ LOG(WARNING) << "Got unexpected quota error : " << static_cast<int>(status);
// crbug.com/349708
TRACE_EVENT0("io", "SandboxFileStreamWriter::DidGetUsageAndQuota FAILED");
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.h b/storage/browser/fileapi/sandbox_file_stream_writer.h
index 31e46d9..8b20b0b 100644
--- a/storage/browser/fileapi/sandbox_file_stream_writer.h
+++ b/storage/browser/fileapi/sandbox_file_stream_writer.h
@@ -18,7 +18,7 @@
#include "storage/browser/fileapi/task_runner_bound_observer_list.h"
#include "storage/browser/storage_browser_export.h"
#include "storage/common/fileapi/file_system_types.h"
-#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
namespace storage {
@@ -58,7 +58,7 @@
const base::FilePath& platform_path,
scoped_refptr<storage::ShareableFileReference> file_ref);
void DidGetUsageAndQuota(const net::CompletionCallback& callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
void DidInitializeForWrite(net::IOBuffer* buf, int buf_len,
diff --git a/storage/browser/quota/quota_callbacks.h b/storage/browser/quota/quota_callbacks.h
index dd8a369..d868abe 100644
--- a/storage/browser/quota/quota_callbacks.h
+++ b/storage/browser/quota/quota_callbacks.h
@@ -16,8 +16,8 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "storage/browser/quota/quota_client.h"
-#include "storage/common/quota/quota_status_code.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
class GURL;
@@ -29,14 +29,15 @@
// Common callback types that are used throughout in the quota module.
typedef base::Callback<void(int64_t usage, int64_t unlimited_usage)>
GlobalUsageCallback;
-typedef base::Callback<void(QuotaStatusCode status, int64_t quota)>
+typedef base::Callback<void(blink::QuotaStatusCode status, int64_t quota)>
QuotaCallback;
typedef base::Callback<void(int64_t usage)> UsageCallback;
typedef base::Callback<void(int64_t usage,
base::flat_map<QuotaClient::ID, int64_t>)>
UsageWithBreakdownCallback;
-typedef base::Callback<void(QuotaStatusCode, int64_t)> AvailableSpaceCallback;
-typedef base::Callback<void(QuotaStatusCode)> StatusCallback;
+typedef base::Callback<void(blink::QuotaStatusCode, int64_t)>
+ AvailableSpaceCallback;
+typedef base::Callback<void(blink::QuotaStatusCode)> StatusCallback;
typedef base::Callback<void(const std::set<GURL>& origins,
StorageType type)> GetOriginsCallback;
typedef base::Callback<void(const UsageInfoEntries&)> GetUsageInfoCallback;
diff --git a/storage/browser/quota/quota_client.h b/storage/browser/quota/quota_client.h
index 973f4ad7..9a29ab18 100644
--- a/storage/browser/quota/quota_client.h
+++ b/storage/browser/quota/quota_client.h
@@ -14,6 +14,7 @@
#include "base/callback.h"
#include "storage/browser/storage_browser_export.h"
#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
#include "url/gurl.h"
namespace storage {
@@ -27,7 +28,7 @@
typedef base::Callback<void(int64_t usage)> GetUsageCallback;
typedef base::Callback<void(const std::set<GURL>& origins)>
GetOriginsCallback;
- typedef base::Callback<void(QuotaStatusCode status)> DeletionCallback;
+ typedef base::Callback<void(blink::QuotaStatusCode status)> DeletionCallback;
virtual ~QuotaClient() {}
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc
index ec301148..cdb5fc9a 100644
--- a/storage/browser/quota/quota_manager.cc
+++ b/storage/browser/quota/quota_manager.cc
@@ -209,7 +209,7 @@
void DidGetUsageAndQuotaForWebApps(
const QuotaManager::UsageAndQuotaCallback& callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota,
base::flat_map<QuotaClient::ID, int64_t> usage_breakdown) {
@@ -260,9 +260,9 @@
// Determine host_quota differently depending on type.
if (is_unlimited_) {
- SetDesiredHostQuota(barrier, kQuotaStatusOk, kNoLimit);
+ SetDesiredHostQuota(barrier, blink::QuotaStatusCode::kOk, kNoLimit);
} else if (type_ == kStorageTypeSyncable) {
- SetDesiredHostQuota(barrier, kQuotaStatusOk,
+ SetDesiredHostQuota(barrier, blink::QuotaStatusCode::kOk,
kSyncableStorageDefaultHostQuota);
} else if (type_ == kStorageTypePersistent) {
manager()->GetPersistentHostQuota(
@@ -276,7 +276,7 @@
void Aborted() override {
weak_factory_.InvalidateWeakPtrs();
- callback_.Run(kQuotaErrorAbort, 0, 0,
+ callback_.Run(blink::QuotaStatusCode::kErrorAbort, 0, 0,
base::flat_map<QuotaClient::ID, int64_t>());
DeleteSoon();
}
@@ -292,7 +292,7 @@
host_usage_ +
std::max(INT64_C(0), available_space_ -
settings_.must_remain_available));
- callback_.Run(kQuotaStatusOk, host_usage_, host_quota,
+ callback_.Run(blink::QuotaStatusCode::kOk, host_usage_, host_quota,
std::move(host_usage_breakdown_));
if (type_ == kStorageTypeTemporary && !is_incognito_ && !is_unlimited_) {
UMA_HISTOGRAM_MBYTES("Quota.QuotaForOrigin", host_quota);
@@ -317,7 +317,8 @@
int64_t host_quota = is_session_only_
? settings.session_only_per_host_quota
: settings.per_host_quota;
- SetDesiredHostQuota(barrier_closure, kQuotaStatusOk, host_quota);
+ SetDesiredHostQuota(barrier_closure, blink::QuotaStatusCode::kOk,
+ host_quota);
}
}
@@ -339,7 +340,7 @@
}
void SetDesiredHostQuota(const base::Closure& barrier_closure,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t quota) {
desired_host_quota_ = quota;
barrier_closure.Run();
@@ -389,15 +390,15 @@
void Aborted() override {
weak_factory_.InvalidateWeakPtrs();
- callback_.Run(kQuotaErrorAbort, QuotaSettings(), 0, 0, 0, false);
+ callback_.Run(blink::QuotaStatusCode::kErrorAbort, QuotaSettings(), 0, 0, 0,
+ false);
DeleteSoon();
}
void Completed() override {
weak_factory_.InvalidateWeakPtrs();
- callback_.Run(kQuotaStatusOk, settings_,
- available_space_, total_space_,
- global_usage_, global_usage_is_complete_);
+ callback_.Run(blink::QuotaStatusCode::kOk, settings_, available_space_,
+ total_space_, global_usage_, global_usage_is_complete_);
DeleteSoon();
}
@@ -578,26 +579,26 @@
// Only remove the entire origin if we didn't skip any client types.
if (skipped_clients_ == 0)
manager()->DeleteOriginFromDatabase(origin_, type_, is_eviction_);
- callback_.Run(kQuotaStatusOk);
+ callback_.Run(blink::QuotaStatusCode::kOk);
} else {
// crbug.com/349708
TRACE_EVENT0("io", "QuotaManager::OriginDataDeleter::Completed Error");
- callback_.Run(kQuotaErrorInvalidModification);
+ callback_.Run(blink::QuotaStatusCode::kErrorInvalidModification);
}
DeleteSoon();
}
void Aborted() override {
- callback_.Run(kQuotaErrorAbort);
+ callback_.Run(blink::QuotaStatusCode::kErrorAbort);
DeleteSoon();
}
private:
- void DidDeleteOriginData(QuotaStatusCode status) {
+ void DidDeleteOriginData(blink::QuotaStatusCode status) {
DCHECK_GT(remaining_clients_, 0);
- if (status != kQuotaStatusOk)
+ if (status != blink::QuotaStatusCode::kOk)
++error_count_;
if (--remaining_clients_ == 0)
@@ -656,18 +657,18 @@
// crbug.com/349708
TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Ok");
- callback_.Run(kQuotaStatusOk);
+ callback_.Run(blink::QuotaStatusCode::kOk);
} else {
// crbug.com/349708
TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Error");
- callback_.Run(kQuotaErrorInvalidModification);
+ callback_.Run(blink::QuotaStatusCode::kErrorInvalidModification);
}
DeleteSoon();
}
void Aborted() override {
- callback_.Run(kQuotaErrorAbort);
+ callback_.Run(blink::QuotaStatusCode::kErrorAbort);
DeleteSoon();
}
@@ -698,10 +699,10 @@
}
}
- void DidDeleteOriginData(QuotaStatusCode status) {
+ void DidDeleteOriginData(blink::QuotaStatusCode status) {
DCHECK_GT(remaining_deleters_, 0);
- if (status != kQuotaStatusOk)
+ if (status != blink::QuotaStatusCode::kOk)
++error_count_;
if (--remaining_deleters_ == 0)
@@ -868,7 +869,7 @@
DCHECK(origin == origin.GetOrigin());
if (!IsSupportedType(type) ||
(is_incognito_ && !IsSupportedIncognitoType(type))) {
- callback.Run(kQuotaErrorNotSupported, 0, 0,
+ callback.Run(blink::QuotaStatusCode::kErrorNotSupported, 0, 0,
base::flat_map<QuotaClient::ID, int64_t>());
return;
}
@@ -891,7 +892,7 @@
if (IsStorageUnlimited(origin, type)) {
// TODO(michaeln): This seems like a non-obvious odd behavior, probably for
// apps/extensions, but it would be good to eliminate this special case.
- callback.Run(kQuotaStatusOk, 0, kNoLimit);
+ callback.Run(blink::QuotaStatusCode::kOk, 0, kNoLimit);
return;
}
@@ -949,7 +950,7 @@
const StatusCallback& callback) {
LazyInitialize();
if (host.empty() || clients_.empty()) {
- callback.Run(kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
@@ -965,7 +966,7 @@
// This could happen if we are called on file:///.
// TODO(kinuko) We may want to respect --allow-file-access-from-files
// command line switch.
- callback.Run(kQuotaStatusOk, 0);
+ callback.Run(blink::QuotaStatusCode::kOk, 0);
return;
}
@@ -990,12 +991,12 @@
LazyInitialize();
if (host.empty()) {
// This could happen if we are called on file:///.
- callback.Run(kQuotaErrorNotSupported, 0);
+ callback.Run(blink::QuotaStatusCode::kErrorNotSupported, 0);
return;
}
if (new_quota < 0) {
- callback.Run(kQuotaErrorInvalidModification, -1);
+ callback.Run(blink::QuotaStatusCode::kErrorInvalidModification, -1);
return;
}
@@ -1003,7 +1004,7 @@
new_quota = std::min(new_quota, kPerHostPersistentQuotaLimit);
if (db_disabled_) {
- callback.Run(kQuotaErrorInvalidAccess, -1);
+ callback.Run(blink::QuotaStatusCode::kErrorInvalidAccess, -1);
return;
}
@@ -1333,14 +1334,14 @@
base::Bind(&QuotaManager::DidDatabaseWork, weak_factory_.GetWeakPtr()));
}
-void QuotaManager::DidOriginDataEvicted(QuotaStatusCode status) {
+void QuotaManager::DidOriginDataEvicted(blink::QuotaStatusCode status) {
DCHECK(io_thread_->BelongsToCurrentThread());
// We only try evict origins that are not in use, so basically
// deletion attempt for eviction should not fail. Let's record
// the origin if we get error and exclude it from future eviction
// if the error happens consistently (> kThresholdOfErrorsToBeBlacklisted).
- if (status != kQuotaStatusOk)
+ if (status != blink::QuotaStatusCode::kOk)
origins_in_error_[eviction_context_.evicted_origin]++;
eviction_context_.evict_origin_data_callback.Run(status);
@@ -1355,7 +1356,7 @@
LazyInitialize();
if (origin.is_empty() || clients_.empty()) {
- callback.Run(kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
return;
}
@@ -1563,7 +1564,8 @@
bool success) {
DidDatabaseWork(success);
persistent_host_quota_callbacks_.Run(
- host, kQuotaStatusOk, std::min(*quota, kPerHostPersistentQuotaLimit));
+ host, blink::QuotaStatusCode::kOk,
+ std::min(*quota, kPerHostPersistentQuotaLimit));
}
void QuotaManager::DidSetPersistentHostQuota(const std::string& host,
@@ -1571,7 +1573,9 @@
const int64_t* new_quota,
bool success) {
DidDatabaseWork(success);
- callback.Run(success ? kQuotaStatusOk : kQuotaErrorInvalidAccess, *new_quota);
+ callback.Run(success ? blink::QuotaStatusCode::kOk
+ : blink::QuotaStatusCode::kErrorInvalidAccess,
+ *new_quota);
}
void QuotaManager::DidGetLRUOrigin(const GURL* origin,
diff --git a/storage/browser/quota/quota_manager.h b/storage/browser/quota/quota_manager.h
index 1e9d545d..f17e9b6 100644
--- a/storage/browser/quota/quota_manager.h
+++ b/storage/browser/quota/quota_manager.h
@@ -32,6 +32,7 @@
#include "storage/browser/quota/special_storage_policy.h"
#include "storage/browser/quota/storage_observer.h"
#include "storage/browser/storage_browser_export.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace base {
class FilePath;
@@ -66,7 +67,7 @@
class STORAGE_EXPORT QuotaEvictionHandler {
public:
using EvictionRoundInfoCallback =
- base::Callback<void(QuotaStatusCode status,
+ base::Callback<void(blink::QuotaStatusCode status,
const QuotaSettings& settings,
int64_t available_space,
int64_t total_space,
@@ -112,10 +113,10 @@
public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> {
public:
typedef base::Callback<
- void(QuotaStatusCode, int64_t /* usage */, int64_t /* quota */)>
+ void(blink::QuotaStatusCode, int64_t /* usage */, int64_t /* quota */)>
UsageAndQuotaCallback;
typedef base::Callback<void(
- QuotaStatusCode,
+ blink::QuotaStatusCode,
int64_t /* usage */,
int64_t /* quota */,
base::flat_map<QuotaClient::ID, int64_t> /* usage breakdown */)>
@@ -297,7 +298,10 @@
DumpOriginInfoTableCallback;
typedef CallbackQueue<base::Closure> ClosureQueue;
- typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64_t>
+ typedef CallbackQueueMap<QuotaCallback,
+ std::string,
+ blink::QuotaStatusCode,
+ int64_t>
HostQuotaCallbackMap;
using QuotaSettingsCallbackQueue =
CallbackQueue<QuotaSettingsCallback, const QuotaSettings&>;
@@ -366,7 +370,7 @@
StorageType type,
bool is_eviction);
- void DidOriginDataEvicted(QuotaStatusCode status);
+ void DidOriginDataEvicted(blink::QuotaStatusCode status);
void ReportHistogram();
void DidGetTemporaryGlobalUsageForHistogram(int64_t usage,
diff --git a/storage/browser/quota/quota_manager_proxy.cc b/storage/browser/quota/quota_manager_proxy.cc
index 40655bfe..219709e 100644
--- a/storage/browser/quota/quota_manager_proxy.cc
+++ b/storage/browser/quota/quota_manager_proxy.cc
@@ -13,6 +13,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/task_runner_util.h"
#include "base/trace_event/trace_event.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace storage {
@@ -21,7 +22,7 @@
void DidGetUsageAndQuota(
base::SequencedTaskRunner* original_task_runner,
const QuotaManagerProxy::UsageAndQuotaCallback& callback,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
if (!original_task_runner->RunsTasksInCurrentSequence()) {
@@ -139,7 +140,8 @@
return;
}
if (!manager_) {
- DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0);
+ DidGetUsageAndQuota(original_task_runner, callback,
+ blink::QuotaStatusCode::kErrorAbort, 0, 0);
return;
}
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc
index 67d9c0c..6b142ced 100644
--- a/storage/browser/quota/quota_manager_unittest.cc
+++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -33,18 +33,13 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
-using storage::kQuotaErrorAbort;
-using storage::kQuotaErrorInvalidModification;
-using storage::kQuotaErrorNotSupported;
-using storage::kQuotaStatusOk;
-using storage::kQuotaStatusUnknown;
using storage::kStorageTypePersistent;
using storage::kStorageTypeSyncable;
using storage::kStorageTypeTemporary;
using storage::kStorageTypeUnknown;
using storage::QuotaClient;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
+using blink::QuotaStatusCode;
using storage::StorageType;
using storage::UsageInfo;
using storage::UsageInfoEntries;
@@ -143,7 +138,7 @@
void GetUsageAndQuotaForWebApps(const GURL& origin,
StorageType type) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
usage_ = -1;
quota_ = -1;
quota_manager_->GetUsageAndQuotaForWebApps(
@@ -152,7 +147,7 @@
}
void GetUsageAndQuotaWithBreakdown(const GURL& origin, StorageType type) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
usage_ = -1;
quota_ = -1;
usage_breakdown_.clear();
@@ -164,7 +159,7 @@
void GetUsageAndQuotaForStorageClient(const GURL& origin,
StorageType type) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
usage_ = -1;
quota_ = -1;
quota_manager_->GetUsageAndQuota(
@@ -186,7 +181,7 @@
}
void GetPersistentHostQuota(const std::string& host) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
quota_ = -1;
quota_manager_->GetPersistentHostQuota(
host,
@@ -195,7 +190,7 @@
}
void SetPersistentHostQuota(const std::string& host, int64_t new_quota) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
quota_ = -1;
quota_manager_->SetPersistentHostQuota(
host, new_quota,
@@ -239,7 +234,7 @@
const GURL& origin,
StorageType type) {
DCHECK(client);
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
client->DeleteOriginData(
origin, type,
base::Bind(&QuotaManagerTest::StatusCallback,
@@ -248,7 +243,7 @@
void EvictOriginData(const GURL& origin,
StorageType type) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
quota_manager_->EvictOriginData(
origin, type,
base::Bind(&QuotaManagerTest::StatusCallback,
@@ -258,7 +253,7 @@
void DeleteOriginData(const GURL& origin,
StorageType type,
int quota_client_mask) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
quota_manager_->DeleteOriginData(
origin, type, quota_client_mask,
base::Bind(&QuotaManagerTest::StatusCallback,
@@ -268,7 +263,7 @@
void DeleteHostData(const std::string& host,
StorageType type,
int quota_client_mask) {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
quota_manager_->DeleteHostData(
host, type, quota_client_mask,
base::Bind(&QuotaManagerTest::StatusCallback,
@@ -283,7 +278,7 @@
}
void GetEvictionRoundInfo() {
- quota_status_ = kQuotaStatusUnknown;
+ quota_status_ = QuotaStatusCode::kUnknown;
settings_ = storage::QuotaSettings();
available_space_ = -1;
total_space_ = -1;
@@ -570,20 +565,20 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(80, usage());
EXPECT_EQ(0, quota());
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_LE(0, quota());
int64_t quota_returned_for_foo = quota();
GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(quota_returned_for_foo, quota());
}
@@ -591,12 +586,12 @@
TEST_F(QuotaManagerTest, GetUsage_NoClient) {
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
GetHostUsage("foo.com", kTemp);
@@ -622,12 +617,12 @@
RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem));
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
GetHostUsage("foo.com", kTemp);
@@ -668,7 +663,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
// The host's quota should be its full portion of the global quota
@@ -677,7 +672,7 @@
GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(5 + 7, usage());
EXPECT_EQ(kPerHostQuota, quota());
}
@@ -706,37 +701,37 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(1 + 128, usage());
EXPECT_EQ(kPerHostQuota, quota());
GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4, usage());
EXPECT_EQ(0, quota());
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(512, usage());
EXPECT_EQ(kAvailableSpaceForApp + usage(), quota());
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(8, usage());
EXPECT_EQ(kAvailableSpaceForApp + usage(), quota());
GetGlobalUsage(kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(1 + 2 + 128 + 512, usage());
EXPECT_EQ(512, unlimited_usage());
GetGlobalUsage(kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4 + 8 + 256, usage());
EXPECT_EQ(8, unlimited_usage());
}
@@ -764,7 +759,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(80, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 80;
usage_breakdown_expected[QuotaClient::kDatabase] = 0;
@@ -773,7 +768,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(1 + 4 + 8, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 1;
usage_breakdown_expected[QuotaClient::kDatabase] = 4;
@@ -782,7 +777,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 0;
usage_breakdown_expected[QuotaClient::kDatabase] = 0;
@@ -795,13 +790,13 @@
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(usage_breakdown_expected, usage_breakdown());
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(usage_breakdown_expected, usage_breakdown());
@@ -828,14 +823,14 @@
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 10 + 20;
EXPECT_EQ(usage_breakdown_expected, usage_breakdown());
GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(5 + 7, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 5 + 7;
EXPECT_EQ(usage_breakdown_expected, usage_breakdown());
@@ -862,7 +857,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(1 + 128, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 1;
usage_breakdown_expected[QuotaClient::kDatabase] = 128;
@@ -870,7 +865,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 4;
usage_breakdown_expected[QuotaClient::kDatabase] = 0;
@@ -878,7 +873,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(512, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 0;
usage_breakdown_expected[QuotaClient::kDatabase] = 512;
@@ -886,7 +881,7 @@
GetUsageAndQuotaWithBreakdown(GURL("http://unlimited/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(8, usage());
usage_breakdown_expected[QuotaClient::kFileSystem] = 8;
usage_breakdown_expected[QuotaClient::kDatabase] = 0;
@@ -904,7 +899,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), type);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
client->ModifyOriginAndNotify(GURL("http://foo.com/"), type, 30);
@@ -913,14 +908,14 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), type);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20 + 30 - 5 + 1, usage());
int foo_usage = usage();
client->AddOriginAndNotify(GURL("http://bar.com/"), type, 40);
GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), type);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(40, usage());
GetGlobalUsage(type);
@@ -951,7 +946,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
EXPECT_EQ(kPerHostQuota, quota());
@@ -961,7 +956,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
EXPECT_EQ(kPerHostQuota, quota());
EXPECT_EQ(2, additional_callback_count());
@@ -993,7 +988,7 @@
// Nuke before waiting for callbacks.
set_quota_manager(NULL);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaErrorAbort, status());
+ EXPECT_EQ(QuotaStatusCode::kErrorAbort, status());
}
TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Overbudget) {
@@ -1017,19 +1012,19 @@
GetUsageAndQuotaForWebApps(GURL("http://usage1/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(1, usage());
EXPECT_EQ(kPerHostQuota, quota());
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_EQ(kPerHostQuota, quota());
GetUsageAndQuotaForWebApps(GURL("http://usage200/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(200, usage());
EXPECT_EQ(kPerHostQuota, quota()); // should be clamped to the nominal quota
}
@@ -1056,25 +1051,25 @@
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_EQ(kPerHostQuotaFor1000, quota());
GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(50, usage());
EXPECT_EQ(kPerHostQuotaFor1000, quota());
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4000, usage());
EXPECT_EQ(kAvailableSpaceForApp + usage(), quota());
GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(QuotaManager::kNoLimit, quota());
@@ -1084,25 +1079,25 @@
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(50, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4000, usage());
EXPECT_EQ(kAvailableSpaceForApp + usage(), quota());
GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(QuotaManager::kNoLimit, quota());
@@ -1117,25 +1112,25 @@
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(50, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4000, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(4000, usage());
EXPECT_EQ(kPerHostQuotaFor100, quota());
}
@@ -1194,14 +1189,14 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(0, quota());
SetPersistentHostQuota("foo.com", 100);
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(100, quota());
@@ -1232,7 +1227,7 @@
mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/"));
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kSync);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, usage());
EXPECT_EQ(kAvailableSpaceForApp, quota());
}
@@ -1254,7 +1249,7 @@
SetPersistentHostQuota("foo.com", 100);
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20 + 13 + 19, usage());
EXPECT_EQ(100, quota());
}
@@ -1278,7 +1273,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
EXPECT_EQ(100, quota());
@@ -1288,7 +1283,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10 + 20, usage());
EXPECT_EQ(2, additional_callback_count());
}
@@ -1312,7 +1307,7 @@
// Nuke before waiting for callbacks.
set_quota_manager(NULL);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaErrorAbort, status());
+ EXPECT_EQ(QuotaStatusCode::kErrorAbort, status());
}
TEST_F(QuotaManagerTest, GetUsage_Simple) {
@@ -1426,7 +1421,7 @@
DeleteClientOriginData(client, GURL("http://foo.com/"),
kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
GetGlobalUsage(kTemp);
scoped_task_environment_.RunUntilIdle();
@@ -1617,7 +1612,7 @@
++i) {
EvictOriginData(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaErrorInvalidModification, status());
+ EXPECT_EQ(QuotaStatusCode::kErrorInvalidModification, status());
}
DumpOriginInfoTable();
@@ -1685,7 +1680,7 @@
GetEvictionRoundInfo();
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(21, usage());
EXPECT_EQ(kPoolSize, settings().pool_size);
EXPECT_LE(0, available_space());
@@ -1713,7 +1708,7 @@
DeleteHostData(std::string(), kTemp, kAllClients);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
GetGlobalUsage(kTemp);
scoped_task_environment_.RunUntilIdle();
@@ -1729,7 +1724,7 @@
DeleteHostData("foo.com", kTemp, kAllClients);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
GetGlobalUsage(kTemp);
scoped_task_environment_.RunUntilIdle();
@@ -2190,12 +2185,12 @@
TEST_F(QuotaManagerTest, QuotaForEmptyHost) {
GetPersistentHostQuota(std::string());
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(0, quota());
SetPersistentHostQuota(std::string(), 10);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaErrorNotSupported, status());
+ EXPECT_EQ(QuotaStatusCode::kErrorNotSupported, status());
}
TEST_F(QuotaManagerTest, DeleteSpecificClientTypeSingleOrigin) {
@@ -2416,7 +2411,7 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(80, usage());
EXPECT_EQ(0, quota());
@@ -2431,20 +2426,20 @@
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_LE(kPerHostQuota, quota());
mock_special_storage_policy()->AddUnlimited(GURL("http://foo.com/"));
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(80, usage());
EXPECT_EQ(available_space() + usage(), quota());
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
scoped_task_environment_.RunUntilIdle();
- EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(QuotaStatusCode::kOk, status());
EXPECT_EQ(10, usage());
EXPECT_EQ(available_space() + usage(), quota());
}
diff --git a/storage/browser/quota/quota_temporary_storage_evictor.cc b/storage/browser/quota/quota_temporary_storage_evictor.cc
index f236621..c4c13fc4 100644
--- a/storage/browser/quota/quota_temporary_storage_evictor.cc
+++ b/storage/browser/quota/quota_temporary_storage_evictor.cc
@@ -164,7 +164,7 @@
}
void QuotaTemporaryStorageEvictor::OnGotEvictionRoundInfo(
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
const QuotaSettings& settings,
int64_t available_space,
int64_t total_space,
@@ -175,7 +175,7 @@
// Note: if there is no storage pressure, |current_usage|
// may not be fully calculated and may be 0.
- if (status != kQuotaStatusOk)
+ if (status != blink::QuotaStatusCode::kOk)
++statistics_.num_errors_on_getting_usage_and_quota;
int64_t usage_overage = std::max(
@@ -203,7 +203,7 @@
round_statistics_.usage_on_end_of_round = current_usage;
int64_t amount_to_evict = std::max(usage_overage, diskspace_shortage);
- if (status == kQuotaStatusOk && amount_to_evict > 0) {
+ if (status == blink::QuotaStatusCode::kOk && amount_to_evict > 0) {
// Space is getting tight. Get the least recently used origin and continue.
// TODO(michaeln): if the reason for eviction is low physical disk space,
// make 'unlimited' origins subject to eviction too.
@@ -246,7 +246,7 @@
}
void QuotaTemporaryStorageEvictor::OnEvictionComplete(
- QuotaStatusCode status) {
+ blink::QuotaStatusCode status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Just calling ConsiderEviction() or StartEvictionTimerWithDelay() here is
@@ -255,7 +255,7 @@
// origin permanently. The evictor skips origins which had deletion errors
// a few times.
- if (status == kQuotaStatusOk) {
+ if (status == blink::QuotaStatusCode::kOk) {
++statistics_.num_evicted_origins;
++round_statistics_.num_evicted_origins_in_round;
// We many need to get rid of more space so reconsider immediately.
diff --git a/storage/browser/quota/quota_temporary_storage_evictor.h b/storage/browser/quota/quota_temporary_storage_evictor.h
index 42d3e14..45e9c0cf 100644
--- a/storage/browser/quota/quota_temporary_storage_evictor.h
+++ b/storage/browser/quota/quota_temporary_storage_evictor.h
@@ -16,7 +16,7 @@
#include "base/sequence_checker.h"
#include "base/timer/timer.h"
#include "storage/browser/storage_browser_export.h"
-#include "storage/common/quota/quota_types.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
class GURL;
@@ -83,14 +83,14 @@
void StartEvictionTimerWithDelay(int delay_ms);
void ConsiderEviction();
- void OnGotEvictionRoundInfo(QuotaStatusCode status,
+ void OnGotEvictionRoundInfo(blink::QuotaStatusCode status,
const QuotaSettings& settings,
int64_t available_space,
int64_t total_space,
int64_t current_usage,
bool current_usage_is_complete);
void OnGotEvictionOrigin(const GURL& origin);
- void OnEvictionComplete(QuotaStatusCode status);
+ void OnEvictionComplete(blink::QuotaStatusCode status);
void OnEvictionRoundStarted();
void OnEvictionRoundFinished();
diff --git a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
index f8a1cc8..d7d5193 100644
--- a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
+++ b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
@@ -40,25 +40,25 @@
StorageType type,
const storage::StatusCallback& callback) override {
if (error_on_evict_origin_data_) {
- callback.Run(storage::kQuotaErrorInvalidModification);
+ callback.Run(blink::QuotaStatusCode::kErrorInvalidModification);
return;
}
int64_t origin_usage = EnsureOriginRemoved(origin);
if (origin_usage >= 0)
available_space_ += origin_usage;
- callback.Run(storage::kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
}
void GetEvictionRoundInfo(
const EvictionRoundInfoCallback& callback) override {
if (error_on_get_usage_and_quota_) {
- callback.Run(storage::kQuotaErrorAbort, storage::QuotaSettings(), 0, 0,
- 0, false);
+ callback.Run(blink::QuotaStatusCode::kErrorAbort,
+ storage::QuotaSettings(), 0, 0, 0, false);
return;
}
if (!task_for_get_usage_and_quota_.is_null())
task_for_get_usage_and_quota_.Run();
- callback.Run(storage::kQuotaStatusOk, settings_, available_space_,
+ callback.Run(blink::QuotaStatusCode::kOk, settings_, available_space_,
available_space_ * 2, GetUsage(), true);
}
diff --git a/storage/browser/quota/storage_monitor.cc b/storage/browser/quota/storage_monitor.cc
index a24bc5e..0e14400 100644
--- a/storage/browser/quota/storage_monitor.cc
+++ b/storage/browser/quota/storage_monitor.cc
@@ -12,7 +12,6 @@
#include "base/trace_event/trace_event.h"
#include "net/base/url_util.h"
#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
namespace storage {
@@ -217,11 +216,11 @@
void HostStorageObservers::GotHostUsageAndQuota(
const StorageObserver::Filter& filter,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
initializing_ = false;
- if (status != kQuotaStatusOk)
+ if (status != blink::QuotaStatusCode::kOk)
return;
initialized_ = true;
cached_quota_ = quota;
diff --git a/storage/browser/quota/storage_monitor.h b/storage/browser/quota/storage_monitor.h
index 85e3e3d..95d447d 100644
--- a/storage/browser/quota/storage_monitor.h
+++ b/storage/browser/quota/storage_monitor.h
@@ -15,6 +15,7 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "storage/browser/quota/storage_observer.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace content {
class StorageMonitorTestBase;
@@ -95,7 +96,7 @@
private:
void StartInitialization(const StorageObserver::Filter& filter);
void GotHostUsageAndQuota(const StorageObserver::Filter& filter,
- QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota);
void DispatchEvent(const StorageObserver::Filter& filter, bool is_update);
diff --git a/storage/browser/quota/storage_monitor_unittest.cc b/storage/browser/quota/storage_monitor_unittest.cc
index 23f185f..12f6585ce 100644
--- a/storage/browser/quota/storage_monitor_unittest.cc
+++ b/storage/browser/quota/storage_monitor_unittest.cc
@@ -20,14 +20,12 @@
#include "storage/browser/test/mock_storage_client.h"
#include "testing/gtest/include/gtest/gtest.h"
+using blink::QuotaStatusCode;
using storage::HostStorageObservers;
-using storage::kQuotaErrorNotSupported;
-using storage::kQuotaStatusOk;
using storage::kStorageTypePersistent;
using storage::kStorageTypeTemporary;
using storage::QuotaClient;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
using storage::SpecialStoragePolicy;
using storage::StorageMonitor;
using storage::StorageObserver;
@@ -73,7 +71,7 @@
storage::GetQuotaSettingsFunc()),
callback_usage_(0),
callback_quota_(0),
- callback_status_(kQuotaStatusOk),
+ callback_status_(QuotaStatusCode::kOk),
initialized_(false) {}
void SetCallbackParams(int64_t usage, int64_t quota, QuotaStatusCode status) {
@@ -322,7 +320,7 @@
false);
const int64_t kUsage = 324554;
const int64_t kQuota = 234354354;
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
MockObserver mock_observer;
HostStorageObservers host_observers(quota_manager_.get());
@@ -350,7 +348,7 @@
TEST_F(HostStorageObserversTest, InitializeOnObserver) {
const int64_t kUsage = 74387;
const int64_t kQuota = 92834743;
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
HostStorageObservers host_observers(quota_manager_.get());
// |host_observers| should not be initialized after the first observer is
@@ -408,7 +406,7 @@
false);
const int64_t kUsage = -324554;
const int64_t kQuota = -234354354;
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
MockObserver mock_observer;
HostStorageObservers host_observers(quota_manager_.get());
@@ -432,7 +430,8 @@
// Set up the quota manager to return an error status.
const int64_t kUsage = 6656;
const int64_t kQuota = 99585556;
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaErrorNotSupported);
+ quota_manager_->SetCallbackParams(kUsage, kQuota,
+ QuotaStatusCode::kErrorNotSupported);
// Verify that |host_observers| is not initialized and an event has not been
// dispatched.
@@ -443,7 +442,7 @@
EXPECT_EQ(0, GetRequiredUpdatesCount(host_observers));
// Now ensure that quota manager returns a good status.
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
host_observers.NotifyUsageChange(params.filter, 9048543);
StorageObserver::Event expected_event(params.filter, kUsage, kQuota);
EXPECT_EQ(1, mock_observer.EventCount());
@@ -482,7 +481,7 @@
EXPECT_EQ(0, GetRequiredUpdatesCount(host_observers));
// Simulate an asynchronous callback from QuotaManager.
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
quota_manager_->InvokeCallback();
StorageObserver::Event expected_event(params.filter, kUsage + kDelta, kQuota);
EXPECT_EQ(1, mock_observer.EventCount());
@@ -614,7 +613,7 @@
// Verify dispatch of events.
const int64_t kUsage = 5325;
const int64_t kQuota = 903845;
- quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk);
+ quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk);
storage_monitor_->NotifyUsageChange(params1_.filter, 9048543);
StorageObserver::Event expected_event(params1_.filter, kUsage, kQuota);
diff --git a/storage/browser/quota/usage_tracker_unittest.cc b/storage/browser/quota/usage_tracker_unittest.cc
index 82aad28e..0963f37 100644
--- a/storage/browser/quota/usage_tracker_unittest.cc
+++ b/storage/browser/quota/usage_tracker_unittest.cc
@@ -16,7 +16,7 @@
#include "storage/browser/test/mock_special_storage_policy.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::kQuotaStatusOk;
+using blink::QuotaStatusCode;
using storage::kStorageTypeTemporary;
using storage::QuotaClient;
using storage::QuotaClientList;
@@ -109,7 +109,7 @@
EXPECT_EQ(kStorageTypeTemporary, type);
usage_map_.erase(origin);
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(callback, kQuotaStatusOk));
+ FROM_HERE, base::Bind(callback, QuotaStatusCode::kOk));
}
bool DoesSupport(storage::StorageType type) const override {
diff --git a/storage/browser/test/async_file_test_helper.cc b/storage/browser/test/async_file_test_helper.cc
index 837d1554..ec428f8 100644
--- a/storage/browser/test/async_file_test_helper.cc
+++ b/storage/browser/test/async_file_test_helper.cc
@@ -73,11 +73,11 @@
run_loop->Quit();
}
-void DidGetUsageAndQuota(storage::QuotaStatusCode* status_out,
+void DidGetUsageAndQuota(blink::QuotaStatusCode* status_out,
int64_t* usage_out,
int64_t* quota_out,
base::OnceClosure done_callback,
- storage::QuotaStatusCode status,
+ blink::QuotaStatusCode status,
int64_t usage,
int64_t quota) {
if (status_out)
@@ -256,13 +256,13 @@
return (result == base::File::FILE_OK) && file_info.is_directory;
}
-storage::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota(
+blink::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota(
storage::QuotaManager* quota_manager,
const GURL& origin,
storage::FileSystemType type,
int64_t* usage,
int64_t* quota) {
- storage::QuotaStatusCode status = storage::kQuotaStatusUnknown;
+ blink::QuotaStatusCode status = blink::QuotaStatusCode::kUnknown;
base::RunLoop run_loop;
quota_manager->GetUsageAndQuota(
origin, FileSystemTypeToQuotaStorageType(type),
diff --git a/storage/browser/test/async_file_test_helper.h b/storage/browser/test/async_file_test_helper.h
index 55c8f8c..0993079c 100644
--- a/storage/browser/test/async_file_test_helper.h
+++ b/storage/browser/test/async_file_test_helper.h
@@ -10,7 +10,7 @@
#include "storage/browser/fileapi/file_system_operation.h"
#include "storage/common/fileapi/file_system_types.h"
-#include "storage/common/quota/quota_status_code.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
class GURL;
@@ -100,7 +100,7 @@
const storage::FileSystemURL& url);
// Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|.
- static storage::QuotaStatusCode GetUsageAndQuota(
+ static blink::QuotaStatusCode GetUsageAndQuota(
storage::QuotaManager* quota_manager,
const GURL& origin,
storage::FileSystemType type,
diff --git a/storage/browser/test/mock_quota_manager.cc b/storage/browser/test/mock_quota_manager.cc
index d3af9010..0820ad73 100644
--- a/storage/browser/test/mock_quota_manager.cc
+++ b/storage/browser/test/mock_quota_manager.cc
@@ -13,8 +13,6 @@
#include "base/threading/thread_task_runner_handle.h"
#include "url/gurl.h"
-using storage::kQuotaStatusOk;
-
namespace content {
MockQuotaManager::OriginInfo::OriginInfo(
@@ -50,7 +48,7 @@
storage::StorageType type,
const UsageAndQuotaCallback& callback) {
StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)];
- callback.Run(storage::kQuotaStatusOk, info.usage, info.quota);
+ callback.Run(blink::QuotaStatusCode::kOk, info.usage, info.quota);
}
void MockQuotaManager::SetQuota(const GURL& origin,
@@ -119,9 +117,9 @@
}
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(&MockQuotaManager::DidDeleteOriginData,
- weak_factory_.GetWeakPtr(), callback, kQuotaStatusOk));
+ FROM_HERE, base::Bind(&MockQuotaManager::DidDeleteOriginData,
+ weak_factory_.GetWeakPtr(), callback,
+ blink::QuotaStatusCode::kOk));
}
MockQuotaManager::~MockQuotaManager() = default;
@@ -139,9 +137,8 @@
callback.Run(*origins, storage_type);
}
-void MockQuotaManager::DidDeleteOriginData(
- const StatusCallback& callback,
- QuotaStatusCode status) {
+void MockQuotaManager::DidDeleteOriginData(const StatusCallback& callback,
+ blink::QuotaStatusCode status) {
callback.Run(status);
}
diff --git a/storage/browser/test/mock_quota_manager.h b/storage/browser/test/mock_quota_manager.h
index 4ead56c..c373eec 100644
--- a/storage/browser/test/mock_quota_manager.h
+++ b/storage/browser/test/mock_quota_manager.h
@@ -23,7 +23,6 @@
using storage::GetOriginsCallback;
using storage::QuotaClient;
using storage::QuotaManager;
-using storage::QuotaStatusCode;
using storage::SpecialStoragePolicy;
using storage::StatusCallback;
using storage::StorageType;
@@ -138,7 +137,7 @@
std::set<GURL>* origins,
StorageType storage_type);
void DidDeleteOriginData(const StatusCallback& callback,
- QuotaStatusCode status);
+ blink::QuotaStatusCode status);
// The list of stored origins that have been added via AddOrigin.
std::vector<OriginInfo> origins_;
diff --git a/storage/browser/test/mock_quota_manager_unittest.cc b/storage/browser/test/mock_quota_manager_unittest.cc
index 59a1b370..4236f45 100644
--- a/storage/browser/test/mock_quota_manager_unittest.cc
+++ b/storage/browser/test/mock_quota_manager_unittest.cc
@@ -18,7 +18,6 @@
#include "storage/browser/test/mock_storage_client.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::kQuotaStatusOk;
using storage::kStorageTypePersistent;
using storage::kStorageTypeTemporary;
@@ -79,9 +78,9 @@
weak_factory_.GetWeakPtr()));
}
- void DeletedOriginData(QuotaStatusCode status) {
+ void DeletedOriginData(blink::QuotaStatusCode status) {
++deletion_callback_count_;
- EXPECT_EQ(kQuotaStatusOk, status);
+ EXPECT_EQ(blink::QuotaStatusCode::kOk, status);
}
int deletion_callback_count() const {
diff --git a/storage/browser/test/mock_storage_client.cc b/storage/browser/test/mock_storage_client.cc
index 66da6dec..2013e27 100644
--- a/storage/browser/test/mock_storage_client.cc
+++ b/storage/browser/test/mock_storage_client.cc
@@ -15,9 +15,6 @@
#include "net/base/url_util.h"
#include "storage/browser/quota/quota_manager_proxy.h"
-using storage::kQuotaErrorInvalidModification;
-using storage::kQuotaStatusOk;
-
namespace content {
using std::make_pair;
@@ -172,7 +169,7 @@
ErrorOriginSet::iterator itr_error =
error_origins_.find(make_pair(origin_url, type));
if (itr_error != error_origins_.end()) {
- callback.Run(kQuotaErrorInvalidModification);
+ callback.Run(blink::QuotaStatusCode::kErrorInvalidModification);
return;
}
@@ -185,7 +182,7 @@
origin_data_.erase(itr);
}
- callback.Run(kQuotaStatusOk);
+ callback.Run(blink::QuotaStatusCode::kOk);
}
} // namespace content
diff --git a/storage/common/BUILD.gn b/storage/common/BUILD.gn
index b3454ba..3328336 100644
--- a/storage/common/BUILD.gn
+++ b/storage/common/BUILD.gn
@@ -29,8 +29,6 @@
"fileapi/file_system_types.h",
"fileapi/file_system_util.cc",
"fileapi/file_system_util.h",
- "quota/quota_status_code.cc",
- "quota/quota_status_code.h",
"quota/quota_types.h",
"storage_common_export.h",
"storage_histograms.cc",
diff --git a/storage/common/quota/quota_status_code.cc b/storage/common/quota/quota_status_code.cc
deleted file mode 100644
index b3976e5..0000000
--- a/storage/common/quota/quota_status_code.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 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 "storage/common/quota/quota_status_code.h"
-
-namespace storage {
-
-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 storage
diff --git a/storage/common/quota/quota_status_code.h b/storage/common/quota/quota_status_code.h
deleted file mode 100644
index c55f8a5..0000000
--- a/storage/common/quota/quota_status_code.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2013 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 STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
-#define STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
-
-#include "storage/common/storage_common_export.h"
-#include "third_party/WebKit/public/platform/WebStorageQuotaError.h"
-
-namespace storage {
-
-enum QuotaStatusCode {
- kQuotaStatusOk = 0,
- kQuotaErrorNotSupported = blink::kWebStorageQuotaErrorNotSupported,
- kQuotaErrorInvalidModification =
- blink::kWebStorageQuotaErrorInvalidModification,
- kQuotaErrorInvalidAccess = blink::kWebStorageQuotaErrorInvalidAccess,
- kQuotaErrorAbort = blink::kWebStorageQuotaErrorAbort,
- kQuotaStatusUnknown = -1,
-
- kQuotaStatusLast = kQuotaErrorAbort,
-};
-
-STORAGE_COMMON_EXPORT const char* QuotaStatusCodeToString(
- QuotaStatusCode status);
-
-} // namespace storage
-
-#endif // STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
diff --git a/storage/common/quota/quota_types.h b/storage/common/quota/quota_types.h
index 381d8473..1c164382 100644
--- a/storage/common/quota/quota_types.h
+++ b/storage/common/quota/quota_types.h
@@ -5,8 +5,6 @@
#ifndef STORAGE_COMMON_QUOTA_QUOTA_TYPES_H_
#define STORAGE_COMMON_QUOTA_QUOTA_TYPES_H_
-#include "storage/common/quota/quota_status_code.h"
-
namespace storage {
enum StorageType {
diff --git a/storage/common/quota/quota_types.mojom b/storage/common/quota/quota_types.mojom
index 915a673..4258de7b 100644
--- a/storage/common/quota/quota_types.mojom
+++ b/storage/common/quota/quota_types.mojom
@@ -13,7 +13,7 @@
kUnknown,
};
-// TODO(sashab): Remove duplicate definition storage::QuotaStatusCode.
+// TODO(sashab): Remove duplicate definition blink::QuotaStatusCode.
enum QuotaStatusCode {
kOk = 0,
kErrorNotSupported,
diff --git a/storage/common/quota/quota_types.typemap b/storage/common/quota/quota_types.typemap
index d55ef180..f179778 100644
--- a/storage/common/quota/quota_types.typemap
+++ b/storage/common/quota/quota_types.typemap
@@ -4,14 +4,15 @@
mojom = "//storage/common/quota/quota_types.mojom"
public_headers = [
- "//storage/common/quota/quota_status_code.h",
+ "//third_party/WebKit/common/quota/quota_status_code.h",
"//storage/common/quota/quota_types.h",
]
traits_headers = [ "//storage/common/quota/quota_types_struct_traits.h" ]
deps = [
"//storage/common",
+ "//third_party/WebKit/common:blink_common",
]
type_mappings = [
- "storage.mojom.QuotaStatusCode=storage::QuotaStatusCode",
+ "storage.mojom.QuotaStatusCode=blink::QuotaStatusCode",
"storage.mojom.StorageType=storage::StorageType",
]
diff --git a/storage/common/quota/quota_types_struct_traits.h b/storage/common/quota/quota_types_struct_traits.h
index 73cfb742..3231850 100644
--- a/storage/common/quota/quota_types_struct_traits.h
+++ b/storage/common/quota/quota_types_struct_traits.h
@@ -6,9 +6,9 @@
#define CONTENT_COMMON_QUOTA_MESSAGES_STRUCT_TRAITS_H_
#include "mojo/public/cpp/bindings/enum_traits.h"
-#include "storage/common/quota/quota_status_code.h"
#include "storage/common/quota/quota_types.h"
#include "storage/common/quota/quota_types.mojom.h"
+#include "third_party/WebKit/common/quota/quota_status_code.h"
namespace mojo {
@@ -58,21 +58,21 @@
};
template <>
-struct EnumTraits<storage::mojom::QuotaStatusCode, storage::QuotaStatusCode> {
+struct EnumTraits<storage::mojom::QuotaStatusCode, blink::QuotaStatusCode> {
static storage::mojom::QuotaStatusCode ToMojom(
- storage::QuotaStatusCode status_code) {
+ blink::QuotaStatusCode status_code) {
switch (status_code) {
- case storage::kQuotaStatusOk:
+ case blink::QuotaStatusCode::kOk:
return storage::mojom::QuotaStatusCode::kOk;
- case storage::kQuotaErrorNotSupported:
+ case blink::QuotaStatusCode::kErrorNotSupported:
return storage::mojom::QuotaStatusCode::kErrorNotSupported;
- case storage::kQuotaErrorInvalidModification:
+ case blink::QuotaStatusCode::kErrorInvalidModification:
return storage::mojom::QuotaStatusCode::kErrorInvalidModification;
- case storage::kQuotaErrorInvalidAccess:
+ case blink::QuotaStatusCode::kErrorInvalidAccess:
return storage::mojom::QuotaStatusCode::kErrorInvalidAccess;
- case storage::kQuotaErrorAbort:
+ case blink::QuotaStatusCode::kErrorAbort:
return storage::mojom::QuotaStatusCode::kErrorAbort;
- case storage::kQuotaStatusUnknown:
+ case blink::QuotaStatusCode::kUnknown:
return storage::mojom::QuotaStatusCode::kUnknown;
}
NOTREACHED();
@@ -80,25 +80,25 @@
}
static bool FromMojom(storage::mojom::QuotaStatusCode status_code,
- storage::QuotaStatusCode* out) {
+ blink::QuotaStatusCode* out) {
switch (status_code) {
case storage::mojom::QuotaStatusCode::kOk:
- *out = storage::kQuotaStatusOk;
+ *out = blink::QuotaStatusCode::kOk;
return true;
case storage::mojom::QuotaStatusCode::kErrorNotSupported:
- *out = storage::kQuotaErrorNotSupported;
+ *out = blink::QuotaStatusCode::kErrorNotSupported;
return true;
case storage::mojom::QuotaStatusCode::kErrorInvalidModification:
- *out = storage::kQuotaErrorInvalidModification;
+ *out = blink::QuotaStatusCode::kErrorInvalidModification;
return true;
case storage::mojom::QuotaStatusCode::kErrorInvalidAccess:
- *out = storage::kQuotaErrorInvalidAccess;
+ *out = blink::QuotaStatusCode::kErrorInvalidAccess;
return true;
case storage::mojom::QuotaStatusCode::kErrorAbort:
- *out = storage::kQuotaErrorAbort;
+ *out = blink::QuotaStatusCode::kErrorAbort;
return true;
case storage::mojom::QuotaStatusCode::kUnknown:
- *out = storage::kQuotaStatusUnknown;
+ *out = blink::QuotaStatusCode::kUnknown;
return true;
}
NOTREACHED();
diff --git a/third_party/WebKit/common/BUILD.gn b/third_party/WebKit/common/BUILD.gn
index 894030f..1c6996a 100644
--- a/third_party/WebKit/common/BUILD.gn
+++ b/third_party/WebKit/common/BUILD.gn
@@ -17,6 +17,7 @@
"//content/*",
"//third_party/WebKit/*",
"//components/*",
+ "//storage/*",
":*",
]
@@ -52,6 +53,7 @@
"origin_trials/trial_token.h",
"origin_trials/trial_token_validator.cc",
"origin_trials/trial_token_validator.h",
+ "quota/quota_status_code.h",
"sandbox_flags.h",
]
diff --git a/third_party/WebKit/common/quota/quota_status_code.h b/third_party/WebKit/common/quota/quota_status_code.h
new file mode 100644
index 0000000..efef901
--- /dev/null
+++ b/third_party/WebKit/common/quota/quota_status_code.h
@@ -0,0 +1,24 @@
+// Copyright 2013 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 THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
+#define THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
+
+namespace blink {
+
+// These values are used by WebStorageQuotaError and need to match
+// dom/ExceptionState.h.
+// TODO(sashab): Remove this and use mojom::storage::QuotaStatusCode instead.
+enum class QuotaStatusCode {
+ kOk = 0,
+ kErrorNotSupported = 7,
+ kErrorInvalidModification = 11,
+ kErrorInvalidAccess = 13,
+ kErrorAbort = 17,
+ kUnknown = -1,
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
diff --git a/third_party/WebKit/public/platform/WebStorageQuotaError.h b/third_party/WebKit/public/platform/WebStorageQuotaError.h
index e1873c5..47080799 100644
--- a/third_party/WebKit/public/platform/WebStorageQuotaError.h
+++ b/third_party/WebKit/public/platform/WebStorageQuotaError.h
@@ -31,9 +31,13 @@
#ifndef WebStorageQuotaError_h
#define WebStorageQuotaError_h
+#include "third_party/WebKit/common/quota/quota_status_code.h"
+
namespace blink {
-// The error code used for WebStorageQuota.
+// The error code used for WebStorageQuota. Values must match QuotaStatusCode.
+// TODO(sashab): Remove this class and update callers to use
+// blink::QuotaStatusCode instead.
enum WebStorageQuotaError {
kWebStorageQuotaErrorNotSupported = 7,
kWebStorageQuotaErrorInvalidModification = 11,
@@ -41,6 +45,23 @@
kWebStorageQuotaErrorAbort = 17,
};
+static_assert(
+ static_cast<int>(kWebStorageQuotaErrorNotSupported) ==
+ static_cast<int>(QuotaStatusCode::kErrorNotSupported),
+ "WebStorageQuotaError and QuotaStatusCode enum values must match");
+static_assert(
+ static_cast<int>(kWebStorageQuotaErrorInvalidModification) ==
+ static_cast<int>(QuotaStatusCode::kErrorInvalidModification),
+ "WebStorageQuotaError and QuotaStatusCode enum values must match");
+static_assert(
+ static_cast<int>(kWebStorageQuotaErrorInvalidAccess) ==
+ static_cast<int>(QuotaStatusCode::kErrorInvalidAccess),
+ "WebStorageQuotaError and QuotaStatusCode enum values must match");
+static_assert(
+ static_cast<int>(kWebStorageQuotaErrorAbort) ==
+ static_cast<int>(QuotaStatusCode::kErrorAbort),
+ "WebStorageQuotaError and QuotaStatusCode enum values must match");
+
} // namespace blink
#endif // WebStorageQuotaError_h