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

Unified Diff: storage/browser/fileapi/sandbox_file_system_backend_delegate.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
similarity index 84%
rename from webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc
rename to storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
index 6bb2efd9499634b09d2988ddb0b27d146f1568fb..bf2c21f11608cc99f9d90bf2019e2d6f267532a9 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc
+++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
+#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
#include <vector>
@@ -12,23 +12,23 @@
#include "base/stl_util.h"
#include "base/task_runner_util.h"
#include "net/base/net_util.h"
-#include "webkit/browser/blob/file_stream_reader.h"
-#include "webkit/browser/fileapi/async_file_util_adapter.h"
-#include "webkit/browser/fileapi/file_system_context.h"
-#include "webkit/browser/fileapi/file_system_operation_context.h"
-#include "webkit/browser/fileapi/file_system_url.h"
-#include "webkit/browser/fileapi/file_system_usage_cache.h"
-#include "webkit/browser/fileapi/obfuscated_file_util.h"
-#include "webkit/browser/fileapi/quota/quota_backend_impl.h"
-#include "webkit/browser/fileapi/quota/quota_reservation.h"
-#include "webkit/browser/fileapi/quota/quota_reservation_manager.h"
-#include "webkit/browser/fileapi/sandbox_file_stream_writer.h"
-#include "webkit/browser/fileapi/sandbox_file_system_backend.h"
-#include "webkit/browser/fileapi/sandbox_quota_observer.h"
-#include "webkit/browser/quota/quota_manager_proxy.h"
-#include "webkit/common/fileapi/file_system_util.h"
-
-namespace fileapi {
+#include "storage/browser/blob/file_stream_reader.h"
+#include "storage/browser/fileapi/async_file_util_adapter.h"
+#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/fileapi/file_system_url.h"
+#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/fileapi/quota/quota_backend_impl.h"
+#include "storage/browser/fileapi/quota/quota_reservation.h"
+#include "storage/browser/fileapi/quota/quota_reservation_manager.h"
+#include "storage/browser/fileapi/sandbox_file_stream_writer.h"
+#include "storage/browser/fileapi/sandbox_file_system_backend.h"
+#include "storage/browser/fileapi/sandbox_quota_observer.h"
+#include "storage/browser/quota/quota_manager_proxy.h"
+#include "storage/common/fileapi/file_system_util.h"
+
+namespace storage {
namespace {
@@ -48,10 +48,8 @@ const char kTemporaryDirectoryName[] = "t";
const char kPersistentDirectoryName[] = "p";
const char kSyncableDirectoryName[] = "s";
-const char* kPrepopulateTypes[] = {
- kPersistentDirectoryName,
- kTemporaryDirectoryName
-};
+const char* kPrepopulateTypes[] = {kPersistentDirectoryName,
+ kTemporaryDirectoryName};
enum FileSystemError {
kOK = 0,
@@ -66,12 +64,12 @@ enum FileSystemError {
// Restricted names.
// http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions
const base::FilePath::CharType* const kRestrictedNames[] = {
- FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."),
+ FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."),
};
// Restricted chars.
const base::FilePath::CharType kRestrictedChars[] = {
- FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'),
+ FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'),
};
std::string GetTypeStringForURL(const FileSystemURL& url) {
@@ -94,9 +92,7 @@ class ObfuscatedOriginEnumerator
}
virtual ~ObfuscatedOriginEnumerator() {}
- virtual GURL Next() OVERRIDE {
- return enum_->Next();
- }
+ virtual GURL Next() OVERRIDE { return enum_->Next(); }
virtual bool HasFileSystemType(FileSystemType type) const OVERRIDE {
return enum_->HasTypeDirectory(
@@ -107,21 +103,21 @@ class ObfuscatedOriginEnumerator
scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enum_;
};
-void OpenFileSystemOnFileTaskRunner(
- ObfuscatedFileUtil* file_util,
- const GURL& origin_url,
- FileSystemType type,
- OpenFileSystemMode mode,
- base::File::Error* error_ptr) {
+void OpenFileSystemOnFileTaskRunner(ObfuscatedFileUtil* file_util,
+ const GURL& origin_url,
+ FileSystemType type,
+ OpenFileSystemMode mode,
+ base::File::Error* error_ptr) {
DCHECK(error_ptr);
const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
file_util->GetDirectoryForOriginAndType(
- origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type),
- create, error_ptr);
+ origin_url,
+ SandboxFileSystemBackendDelegate::GetTypeString(type),
+ create,
+ error_ptr);
if (*error_ptr != base::File::FILE_OK) {
- UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel,
- kCreateDirectoryError,
- kFileSystemErrorMax);
+ UMA_HISTOGRAM_ENUMERATION(
+ kOpenFileSystemLabel, kCreateDirectoryError, kFileSystemErrorMax);
} else {
UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, kOK, kFileSystemErrorMax);
}
@@ -148,8 +144,8 @@ void DeleteSoon(base::SequencedTaskRunner* runner, T* ptr) {
} // namespace
const base::FilePath::CharType
-SandboxFileSystemBackendDelegate::kFileSystemDirectory[] =
- FILE_PATH_LITERAL("File System");
+ SandboxFileSystemBackendDelegate::kFileSystemDirectory[] =
+ FILE_PATH_LITERAL("File System");
// static
std::string SandboxFileSystemBackendDelegate::GetTypeString(
@@ -177,20 +173,18 @@ SandboxFileSystemBackendDelegate::SandboxFileSystemBackendDelegate(
const FileSystemOptions& file_system_options)
: file_task_runner_(file_task_runner),
sandbox_file_util_(new AsyncFileUtilAdapter(
- new ObfuscatedFileUtil(
- special_storage_policy,
- profile_path.Append(kFileSystemDirectory),
- file_system_options.env_override(),
- file_task_runner,
- base::Bind(&GetTypeStringForURL),
- GetKnownTypeStrings(),
- this))),
+ new ObfuscatedFileUtil(special_storage_policy,
+ profile_path.Append(kFileSystemDirectory),
+ file_system_options.env_override(),
+ file_task_runner,
+ base::Bind(&GetTypeStringForURL),
+ GetKnownTypeStrings(),
+ this))),
file_system_usage_cache_(new FileSystemUsageCache(file_task_runner)),
- quota_observer_(new SandboxQuotaObserver(
- quota_manager_proxy,
- file_task_runner,
- obfuscated_file_util(),
- usage_cache())),
+ quota_observer_(new SandboxQuotaObserver(quota_manager_proxy,
+ file_task_runner,
+ obfuscated_file_util(),
+ usage_cache())),
quota_reservation_manager_(new QuotaReservationManager(
scoped_ptr<QuotaReservationManager::QuotaBackend>(
new QuotaBackendImpl(file_task_runner_,
@@ -212,8 +206,8 @@ SandboxFileSystemBackendDelegate::SandboxFileSystemBackendDelegate(
file_task_runner_->PostTask(
FROM_HERE,
base::Bind(&ObfuscatedFileUtil::MaybePrepopulateDatabase,
- base::Unretained(obfuscated_file_util()),
- types_to_prepopulate));
+ base::Unretained(obfuscated_file_util()),
+ types_to_prepopulate));
}
}
@@ -263,7 +257,10 @@ void SandboxFileSystemBackendDelegate::OpenFileSystem(
file_task_runner_->PostTaskAndReply(
FROM_HERE,
base::Bind(&OpenFileSystemOnFileTaskRunner,
- obfuscated_file_util(), origin_url, type, mode,
+ obfuscated_file_util(),
+ origin_url,
+ type,
+ mode,
base::Unretained(error_ptr)),
base::Bind(&DidOpenFileSystem,
weak_factory_.GetWeakPtr(),
@@ -297,16 +294,16 @@ SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext(
return operation_context.Pass();
}
-scoped_ptr<webkit_blob::FileStreamReader>
+scoped_ptr<storage::FileStreamReader>
SandboxFileSystemBackendDelegate::CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
const base::Time& expected_modification_time,
FileSystemContext* context) const {
if (!IsAccessValid(url))
- return scoped_ptr<webkit_blob::FileStreamReader>();
- return scoped_ptr<webkit_blob::FileStreamReader>(
- webkit_blob::FileStreamReader::CreateForFileSystemFile(
+ return scoped_ptr<storage::FileStreamReader>();
+ return scoped_ptr<storage::FileStreamReader>(
+ storage::FileStreamReader::CreateForFileSystemFile(
context, url, offset, expected_modification_time));
}
@@ -331,17 +328,16 @@ SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner(
const GURL& origin_url,
FileSystemType type) {
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
- int64 usage = GetOriginUsageOnFileTaskRunner(
- file_system_context, origin_url, type);
+ int64 usage =
+ GetOriginUsageOnFileTaskRunner(file_system_context, origin_url, type);
usage_cache()->CloseCacheFiles();
bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType(
origin_url, GetTypeString(type));
if (result && proxy) {
- proxy->NotifyStorageModified(
- quota::QuotaClient::kFileSystem,
- origin_url,
- FileSystemTypeToQuotaStorageType(type),
- -usage);
+ proxy->NotifyStorageModified(quota::QuotaClient::kFileSystem,
+ origin_url,
+ FileSystemTypeToQuotaStorageType(type),
+ -usage);
}
if (result)
@@ -350,7 +346,8 @@ SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner(
}
void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner(
- FileSystemType type, std::set<GURL>* origins) {
+ FileSystemType type,
+ std::set<GURL>* origins) {
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origins);
scoped_ptr<OriginEnumerator> enumerator(CreateOriginEnumerator());
@@ -372,7 +369,8 @@ void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner(
}
void SandboxFileSystemBackendDelegate::GetOriginsForHostOnFileTaskRunner(
- FileSystemType type, const std::string& host,
+ FileSystemType type,
+ const std::string& host,
std::set<GURL>* origins) {
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origins);
@@ -599,8 +597,8 @@ int64 SandboxFileSystemBackendDelegate::RecalculateUsage(
const GURL& origin,
FileSystemType type) {
FileSystemOperationContext operation_context(context);
- FileSystemURL url = context->CreateCrackedFileSystemURL(
- origin, type, base::FilePath());
+ FileSystemURL url =
+ context->CreateCrackedFileSystemURL(origin, type, base::FilePath());
scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator(
obfuscated_file_util()->CreateFileEnumerator(
&operation_context, url, true));
@@ -626,9 +624,8 @@ void SandboxFileSystemBackendDelegate::CollectOpenFileSystemMetrics(
}
#define REPORT(report_value) \
- UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailLabel, \
- (report_value), \
- kFileSystemErrorMax); \
+ UMA_HISTOGRAM_ENUMERATION( \
+ kOpenFileSystemDetailLabel, (report_value), kFileSystemErrorMax); \
if (!throttled) { \
UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailNonThrottledLabel, \
(report_value), \
@@ -673,4 +670,4 @@ ObfuscatedFileUtil* ObfuscatedFileUtil::CreateForTesting(
NULL);
}
-} // namespace fileapi
+} // namespace storage

Powered by Google App Engine
This is Rietveld 408576698