Home | History | Annotate | Download | only in platform
      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 PermissionCallbacks_h
      6 #define PermissionCallbacks_h
      7 
      8 #include "platform/PlatformExport.h"
      9 #include "wtf/Functional.h"
     10 #include "wtf/Noncopyable.h"
     11 #include "wtf/PassOwnPtr.h"
     12 
     13 namespace blink {
     14 
     15 class PLATFORM_EXPORT PermissionCallbacks {
     16     WTF_MAKE_NONCOPYABLE(PermissionCallbacks);
     17 public:
     18     static PassOwnPtr<PermissionCallbacks> create(const Closure& allowed, const Closure& denied);
     19     virtual ~PermissionCallbacks() { }
     20 
     21     void onAllowed() { m_allowed(); }
     22     void onDenied() { m_denied(); }
     23 
     24 private:
     25     PermissionCallbacks(const Closure& allowed, const Closure& denied);
     26 
     27     Closure m_allowed;
     28     Closure m_denied;
     29 };
     30 
     31 } // namespace blink
     32 
     33 #endif // PermissionCallbacks_h
     34