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

Side by Side Diff: webkit/dom_storage/dom_storage_context.cc

Issue 10413072: Teaching BrowsingDataRemover how to delete application data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bernhard. Created 8 years, 6 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/dom_storage/dom_storage_context.h" 5 #include "webkit/dom_storage/dom_storage_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void DomStorageContext::DeleteOrigin(const GURL& origin) { 92 void DomStorageContext::DeleteOrigin(const GURL& origin) {
93 DCHECK(!is_shutdown_); 93 DCHECK(!is_shutdown_);
94 DomStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId); 94 DomStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId);
95 local->DeleteOrigin(origin); 95 local->DeleteOrigin(origin);
96 } 96 }
97 97
98 void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) {
99 std::vector<UsageInfo> infos;
100 const bool kIncludeFileInfo = true;
101 GetUsageInfo(&infos, kIncludeFileInfo);
102 for (size_t i = 0; i < infos.size(); ++i) {
103 if (infos[i].last_modified > cutoff) {
104 if (!special_storage_policy_ ||
105 !special_storage_policy_->IsStorageProtected(infos[i].origin)) {
106 DeleteOrigin(infos[i].origin);
107 }
108 }
109 }
110 }
111
112 void DomStorageContext::PurgeMemory() { 98 void DomStorageContext::PurgeMemory() {
113 // We can only purge memory from the local storage namespace 99 // We can only purge memory from the local storage namespace
114 // which is backed by disk. 100 // which is backed by disk.
115 StorageNamespaceMap::iterator found = 101 StorageNamespaceMap::iterator found =
116 namespaces_.find(kLocalStorageNamespaceId); 102 namespaces_.find(kLocalStorageNamespaceId);
117 if (found != namespaces_.end()) 103 if (found != namespaces_.end())
118 found->second->PurgeMemory(); 104 found->second->PurgeMemory();
119 } 105 }
120 106
121 void DomStorageContext::Shutdown() { 107 void DomStorageContext::Shutdown() {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 FilePath database_file_path = localstorage_directory_.Append( 217 FilePath database_file_path = localstorage_directory_.Append(
232 DomStorageArea::DatabaseFileNameFromOrigin(origin)); 218 DomStorageArea::DatabaseFileNameFromOrigin(origin));
233 file_util::Delete(database_file_path, kNotRecursive); 219 file_util::Delete(database_file_path, kNotRecursive);
234 file_util::Delete( 220 file_util::Delete(
235 DomStorageDatabase::GetJournalFilePath(database_file_path), 221 DomStorageDatabase::GetJournalFilePath(database_file_path),
236 kNotRecursive); 222 kNotRecursive);
237 } 223 }
238 } 224 }
239 225
240 } // namespace dom_storage 226 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_context.h ('k') | webkit/dom_storage/dom_storage_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698