OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/in_process_webkit/indexed_db_context.h" | 5 #include "content/browser/in_process_webkit/indexed_db_context.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 FilePath idb_directory = GetIndexedDBFilePath(origin_id); | 149 FilePath idb_directory = GetIndexedDBFilePath(origin_id); |
150 if (idb_directory.BaseName().value().substr(0, strlen("chrome-extension")) == | 150 if (idb_directory.BaseName().value().substr(0, strlen("chrome-extension")) == |
151 FILE_PATH_LITERAL("chrome-extension") || | 151 FILE_PATH_LITERAL("chrome-extension") || |
152 connection_count_.find(origin_url) == connection_count_.end()) { | 152 connection_count_.find(origin_url) == connection_count_.end()) { |
153 EnsureDiskUsageCacheInitialized(origin_url); | 153 EnsureDiskUsageCacheInitialized(origin_url); |
154 file_util::Delete(idb_directory, true /*recursive*/); | 154 file_util::Delete(idb_directory, true /*recursive*/); |
155 QueryDiskAndUpdateQuotaUsage(origin_url); | 155 QueryDiskAndUpdateQuotaUsage(origin_url); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 bool IndexedDBContext::IsUnlimitedStorageGranted( | |
160 const GURL& origin) const { | |
161 return special_storage_policy_->IsStorageUnlimited(origin); | |
162 } | |
163 | |
164 // TODO(dgrogan): Merge this code with the similar loop in | 159 // TODO(dgrogan): Merge this code with the similar loop in |
165 // BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread. | 160 // BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInWebKitThread. |
166 void IndexedDBContext::GetAllOriginIdentifiers( | 161 void IndexedDBContext::GetAllOriginIdentifiers( |
167 std::vector<string16>* origin_ids) { | 162 std::vector<string16>* origin_ids) { |
168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
169 file_util::FileEnumerator file_enumerator(data_path_, | 164 file_util::FileEnumerator file_enumerator(data_path_, |
170 false, file_util::FileEnumerator::DIRECTORIES); | 165 false, file_util::FileEnumerator::DIRECTORIES); |
171 for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); | 166 for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); |
172 file_path = file_enumerator.Next()) { | 167 file_path = file_enumerator.Next()) { |
173 if (file_path.Extension() == IndexedDBContext::kIndexedDBExtension) { | 168 if (file_path.Extension() == IndexedDBContext::kIndexedDBExtension) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 quota_manager_proxy()->quota_manager()->GetUsageAndQuota( | 277 quota_manager_proxy()->quota_manager()->GetUsageAndQuota( |
283 origin_url, | 278 origin_url, |
284 quota::kStorageTypeTemporary, | 279 quota::kStorageTypeTemporary, |
285 callback); | 280 callback); |
286 } | 281 } |
287 | 282 |
288 int64 IndexedDBContext::ResetDiskUsageCache(const GURL& origin_url) { | 283 int64 IndexedDBContext::ResetDiskUsageCache(const GURL& origin_url) { |
289 origin_size_map_[origin_url] = ReadUsageFromDisk(origin_url); | 284 origin_size_map_[origin_url] = ReadUsageFromDisk(origin_url); |
290 return origin_size_map_[origin_url]; | 285 return origin_size_map_[origin_url]; |
291 } | 286 } |
OLD | NEW |