Home | History | Annotate | Download | only in notifications
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef NotificationPermissionClient_h
      6 #define NotificationPermissionClient_h
      7 
      8 #include "modules/notifications/NotificationPermissionCallback.h"
      9 #include "platform/Supplementable.h"
     10 #include "wtf/PassOwnPtr.h"
     11 
     12 namespace blink {
     13 
     14 class ExecutionContext;
     15 class LocalFrame;
     16 
     17 class NotificationPermissionClient : public WillBeHeapSupplement<LocalFrame> {
     18 public:
     19     virtual ~NotificationPermissionClient() { }
     20 
     21     // Requests user permission to show platform notifications from the origin
     22     // of the current frame. The provided callback will be ran when the user
     23     // has made a decision.
     24     virtual void requestPermission(ExecutionContext*, NotificationPermissionCallback*) = 0;
     25 
     26     // WillBeHeapSupplement requirements.
     27     static const char* supplementName();
     28     static NotificationPermissionClient* from(ExecutionContext*);
     29 };
     30 
     31 void provideNotificationPermissionClientTo(LocalFrame&, PassOwnPtrWillBeRawPtr<NotificationPermissionClient>);
     32 
     33 } // namespace blink
     34 
     35 #endif // NotificationPermissionClient_h
     36