Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | 98 void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff, |
| 99 bool include_protected_origins) { | |
|
jochen (gone - plz use gerrit)
2012/05/23 11:02:21
nit. all arguments on their own line
Mike West
2012/05/23 11:23:51
Done.
| |
| 99 std::vector<UsageInfo> infos; | 100 std::vector<UsageInfo> infos; |
| 100 const bool kIncludeFileInfo = true; | 101 const bool kIncludeFileInfo = true; |
| 101 GetUsageInfo(&infos, kIncludeFileInfo); | 102 GetUsageInfo(&infos, kIncludeFileInfo); |
| 102 for (size_t i = 0; i < infos.size(); ++i) { | 103 for (size_t i = 0; i < infos.size(); ++i) { |
| 103 if (infos[i].last_modified > cutoff) { | 104 if (infos[i].last_modified > cutoff) { |
| 104 if (!special_storage_policy_ || | 105 if (include_protected_origins || |
| 106 !special_storage_policy_ || | |
| 105 !special_storage_policy_->IsStorageProtected(infos[i].origin)) { | 107 !special_storage_policy_->IsStorageProtected(infos[i].origin)) { |
|
jochen (gone - plz use gerrit)
2012/05/23 11:02:21
this will also delete data on chrome-extensions://
Mike West
2012/05/23 11:23:51
My understanding of the feature was that it should
jochen (gone - plz use gerrit)
2012/05/23 11:38:36
ok, if that's the desired behavior meanwhile. We u
| |
| 106 DeleteOrigin(infos[i].origin); | 108 DeleteOrigin(infos[i].origin); |
| 107 } | 109 } |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 } | 112 } |
| 111 | 113 |
| 112 void DomStorageContext::PurgeMemory() { | 114 void DomStorageContext::PurgeMemory() { |
| 113 // We can only purge memory from the local storage namespace | 115 // We can only purge memory from the local storage namespace |
| 114 // which is backed by disk. | 116 // which is backed by disk. |
| 115 StorageNamespaceMap::iterator found = | 117 StorageNamespaceMap::iterator found = |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 FilePath database_file_path = localstorage_directory_.Append( | 233 FilePath database_file_path = localstorage_directory_.Append( |
| 232 DomStorageArea::DatabaseFileNameFromOrigin(origin)); | 234 DomStorageArea::DatabaseFileNameFromOrigin(origin)); |
| 233 file_util::Delete(database_file_path, kNotRecursive); | 235 file_util::Delete(database_file_path, kNotRecursive); |
| 234 file_util::Delete( | 236 file_util::Delete( |
| 235 DomStorageDatabase::GetJournalFilePath(database_file_path), | 237 DomStorageDatabase::GetJournalFilePath(database_file_path), |
| 236 kNotRecursive); | 238 kNotRecursive); |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace dom_storage | 242 } // namespace dom_storage |
| OLD | NEW |