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

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

Issue 10449103: Update the DOMStorageContext public interface in the content layer to remove FilePaths and origin_i… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
Index: content/browser/dom_storage/dom_storage_context_impl.cc
===================================================================
--- content/browser/dom_storage/dom_storage_context_impl.cc (revision 139818)
+++ content/browser/dom_storage/dom_storage_context_impl.cc (working copy)
@@ -23,10 +23,43 @@
using dom_storage::DomStorageWorkerPoolTaskRunner;
using webkit_database::DatabaseUtil;
+namespace content {
+DOMStorageContext::UsageInfo::UsageInfo() : data_size(0) {}
+DOMStorageContext::UsageInfo::~UsageInfo() {}
+}
+
namespace {
const char kLocalStorageDirectory[] = "Local Storage";
+void InvokeUsageInfoCallbackHelper(
+ const DOMStorageContext::GetUsageInfoCallback& callback,
+ const std::vector<DOMStorageContext::UsageInfo>* infos) {
+ callback.Run(*infos);
+}
+
+void GetUsageInfoHelper(
+ base::MessageLoopProxy* reply_loop,
+ DomStorageContext* context,
+ const DOMStorageContext::GetUsageInfoCallback& callback) {
+ std::vector<DomStorageContext::UsageInfo> infos;
+ const bool kIncludeFileInfo = true;
+ context->GetUsageInfo(&infos, kIncludeFileInfo);
+
+ std::vector<DOMStorageContext::UsageInfo>* public_infos =
+ new std::vector<DOMStorageContext::UsageInfo>(infos.size());
+ for (size_t i = 0; i < infos.size(); ++i) {
+ (*public_infos)[i].origin = infos[i].origin;
+ (*public_infos)[i].data_size = infos[i].data_size;
+ (*public_infos)[i].last_modified = infos[i].last_modified;
+ }
+
+ reply_loop->PostTask(
+ FROM_HERE,
+ base::Bind(&InvokeUsageInfoCallbackHelper,
+ callback, base::Owned(public_infos)));
+}
+
// TODO(michaeln): Fix the content layer api, FilePaths and
// string16 origin_ids are just wrong. Then get rid of
// this conversion non-sense. Most of the includes are just
@@ -98,6 +131,24 @@
DOMStorageContextImpl::~DOMStorageContextImpl() {
}
+void DOMStorageContextImpl::GetUsageInfo(const GetUsageInfoCallback& callback) {
+ DCHECK(context_);
+ context_->task_runner()->PostShutdownBlockingTask(
+ FROM_HERE,
+ DomStorageTaskRunner::PRIMARY_SEQUENCE,
+ base::Bind(&GetUsageInfoHelper,
+ base::MessageLoopProxy::current(),
+ context_, callback));
+}
+
+void DOMStorageContextImpl::DeleteOrigin(const GURL& origin) {
+ DCHECK(context_);
+ context_->task_runner()->PostShutdownBlockingTask(
+ FROM_HERE,
+ DomStorageTaskRunner::PRIMARY_SEQUENCE,
+ base::Bind(&DomStorageContext::DeleteOrigin, context_, origin));
+}
+
void DOMStorageContextImpl::GetAllStorageFiles(
const GetAllStorageFilesCallback& callback) {
DCHECK(context_);

Powered by Google App Engine
This is Rietveld 408576698