OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NotificationPermissionClient_h | 5 #ifndef NotificationPermissionClient_h |
6 #define NotificationPermissionClient_h | 6 #define NotificationPermissionClient_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class ExecutionContext; | 15 class ExecutionContext; |
16 class LocalFrame; | 16 class LocalFrame; |
17 class NotificationPermissionCallback; | 17 class NotificationPermissionCallback; |
18 class ScriptState; | 18 class ScriptState; |
19 | 19 |
20 class NotificationPermissionClient : public HeapSupplement<LocalFrame> { | 20 class NotificationPermissionClient : public Supplement<LocalFrame> { |
21 public: | 21 public: |
22 virtual ~NotificationPermissionClient() { } | 22 virtual ~NotificationPermissionClient() { } |
23 | 23 |
24 // Requests user permission to show platform notifications from the origin o
f the | 24 // Requests user permission to show platform notifications from the origin o
f the |
25 // current frame. The provided callback will be ran when the user has made a
decision. | 25 // current frame. The provided callback will be ran when the user has made a
decision. |
26 virtual ScriptPromise requestPermission(ScriptState*, NotificationPermission
Callback*) = 0; | 26 virtual ScriptPromise requestPermission(ScriptState*, NotificationPermission
Callback*) = 0; |
27 | 27 |
28 // HeapSupplement requirements. | 28 // Supplement requirements. |
29 static const char* supplementName(); | 29 static const char* supplementName(); |
30 static NotificationPermissionClient* from(ExecutionContext*); | 30 static NotificationPermissionClient* from(ExecutionContext*); |
31 }; | 31 }; |
32 | 32 |
33 MODULES_EXPORT void provideNotificationPermissionClientTo(LocalFrame&, RawPtr<No
tificationPermissionClient>); | 33 MODULES_EXPORT void provideNotificationPermissionClientTo(LocalFrame&, RawPtr<No
tificationPermissionClient>); |
34 | 34 |
35 } // namespace blink | 35 } // namespace blink |
36 | 36 |
37 #endif // NotificationPermissionClient_h | 37 #endif // NotificationPermissionClient_h |
OLD | NEW |