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

Unified Diff: webkit/dom_storage/dom_storage_context.cc

Issue 9695013: DOMStorageContextImpl that's implemented in terms of the new dom_storage classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « webkit/dom_storage/dom_storage_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_context.cc
===================================================================
--- webkit/dom_storage/dom_storage_context.cc (revision 127221)
+++ webkit/dom_storage/dom_storage_context.cc (working copy)
@@ -6,20 +6,33 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/file_util.h"
#include "base/time.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
+#include "webkit/dom_storage/dom_storage_area.h"
#include "webkit/dom_storage/dom_storage_namespace.h"
#include "webkit/dom_storage/dom_storage_task_runner.h"
#include "webkit/dom_storage/dom_storage_types.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/quota/special_storage_policy.h"
+using file_util::FileEnumerator;
+
namespace dom_storage {
+DomStorageContext::UsageInfo::UsageInfo() {}
+DomStorageContext::UsageInfo::~UsageInfo() {}
+
DomStorageContext::DomStorageContext(
const FilePath& directory,
quota::SpecialStoragePolicy* special_storage_policy,
DomStorageTaskRunner* task_runner)
: directory_(directory),
- task_runner_(task_runner) {
+ task_runner_(task_runner),
+ clear_local_state_(false),
+ save_session_state_(false),
+ special_storage_policy_(special_storage_policy) {
// AtomicSequenceNum starts at 0 but we want to start session
// namespace ids at one since zero is reserved for the
// kLocalStorageNamespaceId.
@@ -44,6 +57,45 @@
return found->second;
}
+void DomStorageContext::GetUsageInfo(std::vector<UsageInfo>* infos) {
+ FileEnumerator enumerator(directory_, false, FileEnumerator::FILES);
+ for (FilePath path = enumerator.Next(); !path.empty();
+ path = enumerator.Next()) {
+ if (path.MatchesExtension(DomStorageArea::kDatabaseFileExtension)) {
+ UsageInfo info;
+
+ // Extract origin id from the path and construct a GURL.
+ WebKit::WebString origin_id = webkit_glue::FilePathToWebString(
+ path.BaseName().RemoveExtension());
+ info.origin = GURL(WebKit::WebSecurityOrigin::
+ createFromDatabaseIdentifier(origin_id).toString());
+
+ FileEnumerator::FindInfo find_info;
+ enumerator.GetFindInfo(&find_info);
+ info.data_size = FileEnumerator::GetFilesize(find_info);
+ info.last_modified = FileEnumerator::GetLastModifiedTime(find_info);
+
+ infos->push_back(info);
+ }
+ }
+}
+
+void DomStorageContext::DeleteOrigin(const GURL& origin) {
+ // TODO(michaeln): write me
+}
+
+void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) {
+ // TODO(michaeln): write me
+}
+
+void DomStorageContext::PurgeMemory() {
+ // TODO(michaeln): write me
+}
+
+void DomStorageContext::Shutdown() {
+ // TODO(michaeln): write me
+}
+
void DomStorageContext::AddEventObserver(EventObserver* observer) {
event_observers_.AddObserver(observer);
}
« no previous file with comments | « webkit/dom_storage/dom_storage_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698