#include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
+#include <set>
+
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "content/public/browser/browser_thread.h"
-#include "webkit/browser/fileapi/file_system_context.h"
-#include "webkit/browser/fileapi/file_system_quota_util.h"
-#include "webkit/common/fileapi/file_system_types.h"
+#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/fileapi/file_system_quota_util.h"
+#include "storage/common/fileapi/file_system_types.h"
using content::BrowserThread;
-namespace fileapi {
+namespace storage {
class FileSystemContext;
}
public:
// BrowsingDataFileSystemHelper implementation
explicit BrowsingDataFileSystemHelperImpl(
- fileapi::FileSystemContext* filesystem_context);
- virtual void StartFetching(const base::Callback<
- void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE;
- virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE;
+ storage::FileSystemContext* filesystem_context);
+ void StartFetching(
+ const base::Callback<void(const std::list<FileSystemInfo>&)>& callback)
+ override;
+ void DeleteFileSystemOrigin(const GURL& origin) override;
private:
- virtual ~BrowsingDataFileSystemHelperImpl();
+ ~BrowsingDataFileSystemHelperImpl() override;
// Enumerates all filesystem files, storing the resulting list into
// file_system_file_ for later use. This must be called on the file
// Keep a reference to the FileSystemContext object for the current profile
// for use on the file task runner.
- scoped_refptr<fileapi::FileSystemContext> filesystem_context_;
+ scoped_refptr<storage::FileSystemContext> filesystem_context_;
// Holds the current list of file systems returned to the client after
// StartFetching is called. Access to |file_system_info_| is triggered
};
BrowsingDataFileSystemHelperImpl::BrowsingDataFileSystemHelperImpl(
- fileapi::FileSystemContext* filesystem_context)
- : filesystem_context_(filesystem_context),
- is_fetching_(false) {
+ storage::FileSystemContext* filesystem_context)
+ : filesystem_context_(filesystem_context), is_fetching_(false) {
DCHECK(filesystem_context_.get());
}
void BrowsingDataFileSystemHelperImpl::StartFetching(
const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!is_fetching_);
- DCHECK_EQ(false, callback.is_null());
+ DCHECK(!callback.is_null());
is_fetching_ = true;
completion_callback_ = callback;
file_task_runner()->PostTask(
void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin(
const GURL& origin) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
file_task_runner()->PostTask(
FROM_HERE,
base::Bind(
DCHECK(file_task_runner()->RunsTasksOnCurrentThread());
// We check usage for these filesystem types.
- const fileapi::FileSystemType types[] = {
- fileapi::kFileSystemTypeTemporary,
- fileapi::kFileSystemTypePersistent,
- fileapi::kFileSystemTypeSyncable,
+ const storage::FileSystemType types[] = {
+ storage::kFileSystemTypeTemporary,
+ storage::kFileSystemTypePersistent,
+#if defined(ENABLE_EXTENSIONS)
+ storage::kFileSystemTypeSyncable,
+#endif
};
typedef std::map<GURL, FileSystemInfo> OriginInfoMap;
OriginInfoMap file_system_info_map;
for (size_t i = 0; i < arraysize(types); ++i) {
- fileapi::FileSystemType type = types[i];
- fileapi::FileSystemQuotaUtil* quota_util =
- filesystem_context_->GetQuotaUtil(type);
+ storage::FileSystemType type = types[i];
+ storage::FileSystemQuotaUtil* quota_util =
+ filesystem_context_->GetQuotaUtil(type);
DCHECK(quota_util);
std::set<GURL> origins;
quota_util->GetOriginsForTypeOnFileTaskRunner(type, &origins);
}
void BrowsingDataFileSystemHelperImpl::NotifyOnUIThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(is_fetching_);
completion_callback_.Run(file_system_info_);
completion_callback_.Reset();
// static
BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create(
- fileapi::FileSystemContext* filesystem_context) {
+ storage::FileSystemContext* filesystem_context) {
return new BrowsingDataFileSystemHelperImpl(filesystem_context);
}
CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper(
- Profile* profile)
- : is_fetching_(false) {
-}
-
-CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper()
- : is_fetching_(false) {
+ Profile* profile) {
}
CannedBrowsingDataFileSystemHelper::~CannedBrowsingDataFileSystemHelper() {}
-CannedBrowsingDataFileSystemHelper*
- CannedBrowsingDataFileSystemHelper::Clone() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- CannedBrowsingDataFileSystemHelper* clone =
- new CannedBrowsingDataFileSystemHelper();
- // This list only mutates on the UI thread, so it's safe to work with it here
- // (given the DCHECK above).
- clone->file_system_info_ = file_system_info_;
- return clone;
-}
-
void CannedBrowsingDataFileSystemHelper::AddFileSystem(
- const GURL& origin, const fileapi::FileSystemType type, const int64 size) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ const GURL& origin,
+ const storage::FileSystemType type,
+ const int64 size) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
// This canned implementation of AddFileSystem uses an O(n^2) algorithm; which
// is fine, as it isn't meant for use in a high-volume context. If it turns
// out that we want to start using this in a context with many, many origins,
}
size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
return file_system_info_.size();
}
void CannedBrowsingDataFileSystemHelper::StartFetching(
const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback.is_null());
BrowserThread::PostTask(