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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

Issue 1900793003: Allow to clear session and local storage when not backed on disk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/dom_storage/dom_storage_context_impl.cc
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc
index dad99c8462873eab07bc6e1dd36da7e62687eaac..1e6afa770e521e38a77f85825d066a4760759e4e 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -108,8 +108,18 @@ DOMStorageNamespace* DOMStorageContextImpl::GetStorageNamespace(
void DOMStorageContextImpl::GetLocalStorageUsage(
std::vector<LocalStorageUsageInfo>* infos,
bool include_file_info) {
- if (localstorage_directory_.empty())
+ if (localstorage_directory_.empty()) {
+ DOMStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId);
+ std::vector<GURL> origins;
+ local->GetOriginsWithAreas(&origins);
+ for (const GURL& origin : origins) {
+ LocalStorageUsageInfo info;
+ info.origin = origin;
+ infos->push_back(info);
+ }
return;
+ }
+
base::FileEnumerator enumerator(localstorage_directory_, false,
base::FileEnumerator::FILES);
for (base::FilePath path = enumerator.Next(); !path.empty();
@@ -129,8 +139,20 @@ void DOMStorageContextImpl::GetLocalStorageUsage(
void DOMStorageContextImpl::GetSessionStorageUsage(
std::vector<SessionStorageUsageInfo>* infos) {
- if (!session_storage_database_.get())
+ if (!session_storage_database_.get()) {
+ for (const auto& entry : namespaces_) {
+ std::vector<GURL> origins;
+ entry.second->GetOriginsWithAreas(&origins);
+ for (const GURL& origin : origins) {
+ SessionStorageUsageInfo info;
+ info.persistent_namespace_id = entry.second->persistent_namespace_id();
+ info.origin = origin;
+ infos->push_back(info);
+ }
+ }
return;
+ }
+
std::map<std::string, std::vector<GURL> > namespaces_and_origins;
session_storage_database_->ReadNamespacesAndOrigins(
&namespaces_and_origins);
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698