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 "wtf/OwnPtr.h" | 12 #include <memory> |
13 #include "wtf/PassOwnPtr.h" | |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 class PLATFORM_EXPORT ContentSettingCallbacks { | 16 class PLATFORM_EXPORT ContentSettingCallbacks { |
18 USING_FAST_MALLOC(ContentSettingCallbacks); | 17 USING_FAST_MALLOC(ContentSettingCallbacks); |
19 WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); | 18 WTF_MAKE_NONCOPYABLE(ContentSettingCallbacks); |
20 public: | 19 public: |
21 static PassOwnPtr<ContentSettingCallbacks> create(std::unique_ptr<SameThread
Closure> allowed, std::unique_ptr<SameThreadClosure> denied); | 20 static std::unique_ptr<ContentSettingCallbacks> create(std::unique_ptr<SameT
hreadClosure> allowed, std::unique_ptr<SameThreadClosure> denied); |
22 virtual ~ContentSettingCallbacks() { } | 21 virtual ~ContentSettingCallbacks() { } |
23 | 22 |
24 void onAllowed() { (*m_allowed)(); } | 23 void onAllowed() { (*m_allowed)(); } |
25 void onDenied() { (*m_denied)(); } | 24 void onDenied() { (*m_denied)(); } |
26 | 25 |
27 private: | 26 private: |
28 ContentSettingCallbacks(std::unique_ptr<SameThreadClosure> allowed, std::uni
que_ptr<SameThreadClosure> denied); | 27 ContentSettingCallbacks(std::unique_ptr<SameThreadClosure> allowed, std::uni
que_ptr<SameThreadClosure> denied); |
29 | 28 |
30 std::unique_ptr<SameThreadClosure> m_allowed; | 29 std::unique_ptr<SameThreadClosure> m_allowed; |
31 std::unique_ptr<SameThreadClosure> m_denied; | 30 std::unique_ptr<SameThreadClosure> m_denied; |
32 }; | 31 }; |
33 | 32 |
34 } // namespace blink | 33 } // namespace blink |
35 | 34 |
36 #endif // ContentSettingCallbacks_h | 35 #endif // ContentSettingCallbacks_h |
OLD | NEW |