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 ContentSettingCallbacks_h | 5 #ifndef ContentSettingCallbacks_h |
6 #define ContentSettingCallbacks_h | 6 #define ContentSettingCallbacks_h |
7 | 7 |
| 8 #include <memory> |
8 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
9 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
10 #include "wtf/Functional.h" | 11 #include "wtf/Functional.h" |
11 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
12 #include <memory> | |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class PLATFORM_EXPORT ContentSettingCallbacks { | 16 class PLATFORM_EXPORT ContentSettingCallbacks { |
17 USING_FAST_MALLOC(ContentSettingCallbacks); | 17 USING_FAST_MALLOC(ContentSettingCallbacks); |
18 WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); | 18 WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); |
19 | 19 |
20 public: | 20 public: |
21 static std::unique_ptr<ContentSettingCallbacks> create( | 21 static std::unique_ptr<ContentSettingCallbacks> create( |
22 std::unique_ptr<WTF::Closure> allowed, | 22 std::unique_ptr<WTF::Closure> allowed, |
23 std::unique_ptr<WTF::Closure> denied); | 23 std::unique_ptr<WTF::Closure> denied); |
24 virtual ~ContentSettingCallbacks() {} | 24 virtual ~ContentSettingCallbacks() {} |
25 | 25 |
26 void onAllowed() { (*m_allowed)(); } | 26 void onAllowed() { (*m_allowed)(); } |
27 void onDenied() { (*m_denied)(); } | 27 void onDenied() { (*m_denied)(); } |
28 | 28 |
29 private: | 29 private: |
30 ContentSettingCallbacks(std::unique_ptr<WTF::Closure> allowed, | 30 ContentSettingCallbacks(std::unique_ptr<WTF::Closure> allowed, |
31 std::unique_ptr<WTF::Closure> denied); | 31 std::unique_ptr<WTF::Closure> denied); |
32 | 32 |
33 std::unique_ptr<WTF::Closure> m_allowed; | 33 std::unique_ptr<WTF::Closure> m_allowed; |
34 std::unique_ptr<WTF::Closure> m_denied; | 34 std::unique_ptr<WTF::Closure> m_denied; |
35 }; | 35 }; |
36 | 36 |
37 } // namespace blink | 37 } // namespace blink |
38 | 38 |
39 #endif // ContentSettingCallbacks_h | 39 #endif // ContentSettingCallbacks_h |
OLD | NEW |