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 "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Functional.h" | 10 #include "wtf/Functional.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include <memory> | 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 public: | 19 public: |
20 static std::unique_ptr<ContentSettingCallbacks> create(std::unique_ptr<SameT
hreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); | 20 static std::unique_ptr<ContentSettingCallbacks> create(std::unique_ptr<WTF::
Closure> allowed, std::unique_ptr<WTF::Closure> denied); |
21 virtual ~ContentSettingCallbacks() { } | 21 virtual ~ContentSettingCallbacks() { } |
22 | 22 |
23 void onAllowed() { (*m_allowed)(); } | 23 void onAllowed() { (*m_allowed)(); } |
24 void onDenied() { (*m_denied)(); } | 24 void onDenied() { (*m_denied)(); } |
25 | 25 |
26 private: | 26 private: |
27 ContentSettingCallbacks(std::unique_ptr<SameThreadClosure> allowed, std::uni
que_ptr<SameThreadClosure> denied); | 27 ContentSettingCallbacks(std::unique_ptr<WTF::Closure> allowed, std::unique_p
tr<WTF::Closure> denied); |
28 | 28 |
29 std::unique_ptr<SameThreadClosure> m_allowed; | 29 std::unique_ptr<WTF::Closure> m_allowed; |
30 std::unique_ptr<SameThreadClosure> m_denied; | 30 std::unique_ptr<WTF::Closure> m_denied; |
31 }; | 31 }; |
32 | 32 |
33 } // namespace blink | 33 } // namespace blink |
34 | 34 |
35 #endif // ContentSettingCallbacks_h | 35 #endif // ContentSettingCallbacks_h |
OLD | NEW |