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

Unified Diff: Source/modules/quota/DurableStorageController.cpp

Issue 1154573005: Expose Durable Storage API to script (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rename WebSomeCallbacks and SomeCallbacks Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/quota/DurableStorageController.cpp
diff --git a/Source/modules/quota/DurableStorageController.cpp b/Source/modules/quota/DurableStorageController.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5d0c66f03e625fc86aa51eceb8857512576471ae
--- /dev/null
+++ b/Source/modules/quota/DurableStorageController.cpp
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/quota/DurableStorageController.h"
+
+#include "core/frame/LocalFrame.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "public/platform/modules/quota/WebDurableStorageDispatcher.h"
+
+namespace blink {
+
+DurableStorageController::~DurableStorageController()
+{
+}
+
+void DurableStorageController::provideTo(LocalFrame& frame, WebDurableStorageDispatcher* client)
+{
+ ASSERT(RuntimeEnabledFeatures::permissionsEnabled());
+
+ DurableStorageController* controller = new DurableStorageController(frame, client);
+ WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), adoptPtrWillBeNoop(controller));
+}
+
+DurableStorageController* DurableStorageController::from(LocalFrame& frame)
+{
+ return static_cast<DurableStorageController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName()));
+}
+
+DurableStorageController::DurableStorageController(LocalFrame& frame, WebDurableStorageDispatcher* client)
+ : LocalFrameLifecycleObserver(&frame)
+ , m_client(client)
+{
+}
+
+const char* DurableStorageController::supplementName()
+{
+ return "DurableStorageController";
+}
+
+WebDurableStorageDispatcher* DurableStorageController::client() const
+{
+ return m_client;
+}
+
+void DurableStorageController::willDetachFrameHost()
+{
+// m_client = nullptr;
+}
+
+DEFINE_TRACE(DurableStorageController)
+{
+ LocalFrameLifecycleObserver::trace(visitor);
+ WillBeHeapSupplement<LocalFrame>::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698