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

Side by Side Diff: webkit/browser/fileapi/file_system_quota_client.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/browser/fileapi/file_system_quota_client.h" 5 #include "webkit/browser/fileapi/file_system_quota_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
19 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 #include "webkit/browser/fileapi/file_system_context.h" 21 #include "webkit/browser/fileapi/file_system_context.h"
22 #include "webkit/browser/fileapi/file_system_quota_util.h" 22 #include "webkit/browser/fileapi/file_system_quota_util.h"
23 #include "webkit/browser/fileapi/file_system_usage_cache.h" 23 #include "webkit/browser/fileapi/file_system_usage_cache.h"
24 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 24 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
25 #include "webkit/common/fileapi/file_system_util.h" 25 #include "webkit/common/fileapi/file_system_util.h"
26 26
27 using quota::StorageType; 27 using storage::StorageType;
28 28
29 namespace fileapi { 29 namespace storage {
30 30
31 namespace { 31 namespace {
32 32
33 void GetOriginsForTypeOnFileTaskRunner( 33 void GetOriginsForTypeOnFileTaskRunner(
34 FileSystemContext* context, 34 FileSystemContext* context,
35 StorageType storage_type, 35 StorageType storage_type,
36 std::set<GURL>* origins_ptr) { 36 std::set<GURL>* origins_ptr) {
37 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); 37 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
38 DCHECK(type != kFileSystemTypeUnknown); 38 DCHECK(type != kFileSystemTypeUnknown);
39 39
(...skipping 10 matching lines...) Expand all
50 std::set<GURL>* origins_ptr) { 50 std::set<GURL>* origins_ptr) {
51 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); 51 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
52 DCHECK(type != kFileSystemTypeUnknown); 52 DCHECK(type != kFileSystemTypeUnknown);
53 53
54 FileSystemQuotaUtil* quota_util = context->GetQuotaUtil(type); 54 FileSystemQuotaUtil* quota_util = context->GetQuotaUtil(type);
55 if (!quota_util) 55 if (!quota_util)
56 return; 56 return;
57 quota_util->GetOriginsForHostOnFileTaskRunner(type, host, origins_ptr); 57 quota_util->GetOriginsForHostOnFileTaskRunner(type, host, origins_ptr);
58 } 58 }
59 59
60 void DidGetOrigins( 60 void DidGetOrigins(const storage::QuotaClient::GetOriginsCallback& callback,
61 const quota::QuotaClient::GetOriginsCallback& callback, 61 std::set<GURL>* origins_ptr) {
62 std::set<GURL>* origins_ptr) {
63 callback.Run(*origins_ptr); 62 callback.Run(*origins_ptr);
64 } 63 }
65 64
66 quota::QuotaStatusCode DeleteOriginOnFileTaskRunner( 65 storage::QuotaStatusCode DeleteOriginOnFileTaskRunner(
67 FileSystemContext* context, 66 FileSystemContext* context,
68 const GURL& origin, 67 const GURL& origin,
69 FileSystemType type) { 68 FileSystemType type) {
70 FileSystemBackend* provider = context->GetFileSystemBackend(type); 69 FileSystemBackend* provider = context->GetFileSystemBackend(type);
71 if (!provider || !provider->GetQuotaUtil()) 70 if (!provider || !provider->GetQuotaUtil())
72 return quota::kQuotaErrorNotSupported; 71 return storage::kQuotaErrorNotSupported;
73 base::File::Error result = 72 base::File::Error result =
74 provider->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner( 73 provider->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner(
75 context, context->quota_manager_proxy(), origin, type); 74 context, context->quota_manager_proxy(), origin, type);
76 if (result == base::File::FILE_OK) 75 if (result == base::File::FILE_OK)
77 return quota::kQuotaStatusOk; 76 return storage::kQuotaStatusOk;
78 return quota::kQuotaErrorInvalidModification; 77 return storage::kQuotaErrorInvalidModification;
79 } 78 }
80 79
81 } // namespace 80 } // namespace
82 81
83 FileSystemQuotaClient::FileSystemQuotaClient( 82 FileSystemQuotaClient::FileSystemQuotaClient(
84 FileSystemContext* file_system_context, 83 FileSystemContext* file_system_context,
85 bool is_incognito) 84 bool is_incognito)
86 : file_system_context_(file_system_context), 85 : file_system_context_(file_system_context),
87 is_incognito_(is_incognito) { 86 is_incognito_(is_incognito) {
88 } 87 }
89 88
90 FileSystemQuotaClient::~FileSystemQuotaClient() {} 89 FileSystemQuotaClient::~FileSystemQuotaClient() {}
91 90
92 quota::QuotaClient::ID FileSystemQuotaClient::id() const { 91 storage::QuotaClient::ID FileSystemQuotaClient::id() const {
93 return quota::QuotaClient::kFileSystem; 92 return storage::QuotaClient::kFileSystem;
94 } 93 }
95 94
96 void FileSystemQuotaClient::OnQuotaManagerDestroyed() { 95 void FileSystemQuotaClient::OnQuotaManagerDestroyed() {
97 delete this; 96 delete this;
98 } 97 }
99 98
100 void FileSystemQuotaClient::GetOriginUsage( 99 void FileSystemQuotaClient::GetOriginUsage(
101 const GURL& origin_url, 100 const GURL& origin_url,
102 StorageType storage_type, 101 StorageType storage_type,
103 const GetUsageCallback& callback) { 102 const GetUsageCallback& callback) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 base::PostTaskAndReplyWithResult( 189 base::PostTaskAndReplyWithResult(
191 file_task_runner(), 190 file_task_runner(),
192 FROM_HERE, 191 FROM_HERE,
193 base::Bind(&DeleteOriginOnFileTaskRunner, 192 base::Bind(&DeleteOriginOnFileTaskRunner,
194 file_system_context_, 193 file_system_context_,
195 origin, 194 origin,
196 fs_type), 195 fs_type),
197 callback); 196 callback);
198 } 197 }
199 198
200 bool FileSystemQuotaClient::DoesSupport(quota::StorageType storage_type) const { 199 bool FileSystemQuotaClient::DoesSupport(
200 storage::StorageType storage_type) const {
201 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); 201 FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
202 DCHECK(type != kFileSystemTypeUnknown); 202 DCHECK(type != kFileSystemTypeUnknown);
203 return file_system_context_->IsSandboxFileSystem(type); 203 return file_system_context_->IsSandboxFileSystem(type);
204 } 204 }
205 205
206 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const { 206 base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const {
207 return file_system_context_->default_file_task_runner(); 207 return file_system_context_->default_file_task_runner();
208 } 208 }
209 209
210 } // namespace fileapi 210 } // namespace storage
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_quota_client.h ('k') | webkit/browser/fileapi/file_system_quota_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698