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

Unified Diff: content/renderer/durable_dispatcher.h

Issue 1164073005: Allow script to request durable storage permission (chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased onto content setting patch 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: content/renderer/durable_dispatcher.h
diff --git a/content/renderer/durable_dispatcher.h b/content/renderer/durable_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3571542c0a32c0d1621f470f12b0bbcdf18b48c
--- /dev/null
+++ b/content/renderer/durable_dispatcher.h
@@ -0,0 +1,43 @@
+// Copyright 2013 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.
+
+#ifndef CONTENT_RENDERER_DURABLE_DISPATCHER_H_
+#define CONTENT_RENDERER_DURABLE_DISPATCHER_H_
+
+#include "base/id_map.h"
+#include "content/common/permission_service.mojom.h"
+#include "content/public/renderer/render_frame_observer.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/platform/modules/quota/WebDurableStorageDispatcher.h"
+
+using blink::WebURL;
+
+namespace content {
+
+// It works as RenderFrameObserver to keep a 1:1 relationship with a RenderFrame
+// and make sure it has the same life cycle.
+class DurableStorageDispatcher : public RenderFrameObserver,
+ public blink::WebDurableStorageDispatcher {
+ public:
+ explicit DurableStorageDispatcher(RenderFrame* render_frame);
+ virtual ~DurableStorageDispatcher();
+
+ private:
+ virtual void requestPermission(
+ const WebURL& url,
+ blink::WebDurableStoragePermissionCallbacks* callbacks);
mlamouri (slow - plz ping) 2015/07/02 09:53:01 Technically, the Blink code could directly call th
dgrogan 2015/07/07 04:15:11 That would involve adding some kind of requestPerm
dgrogan 2015/07/09 02:59:22 I deleted durable_dispatcher.h in favor of adding
+
+ void OnPermissionSet(PermissionStatus status);
+
+ // TODO:
+ // Is this sufficient? What if permission is requested in the promise handler?
+ scoped_ptr<blink::WebDurableStoragePermissionCallbacks> callbacks_;
+ PermissionServicePtr permission_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(DurableStorageDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_DURABLE_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698