Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebContentSettingCallbacks.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "public/platform/WebContentSettingCallbacks.h" 5 #include "public/platform/WebContentSettingCallbacks.h"
6 6
7 #include "platform/ContentSettingCallbacks.h" 7 #include "platform/ContentSettingCallbacks.h"
8 #include "wtf/RefCounted.h" 8 #include "wtf/RefCounted.h"
9 #include <memory>
10 9
11 namespace blink { 10 namespace blink {
12 11
13 class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCal lbacksPrivate> { 12 class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCal lbacksPrivate> {
14 public: 13 public:
15 static PassRefPtr<WebContentSettingCallbacksPrivate> create(std::unique_ptr< ContentSettingCallbacks> callbacks) 14 static PassRefPtr<WebContentSettingCallbacksPrivate> create(PassOwnPtr<Conte ntSettingCallbacks> callbacks)
16 { 15 {
17 return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callback s))); 16 return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callback s)));
18 } 17 }
19 18
20 ContentSettingCallbacks* callbacks() { return m_callbacks.get(); } 19 ContentSettingCallbacks* callbacks() { return m_callbacks.get(); }
21 20
22 private: 21 private:
23 WebContentSettingCallbacksPrivate(std::unique_ptr<ContentSettingCallbacks> c allbacks) : m_callbacks(std::move(callbacks)) { } 22 WebContentSettingCallbacksPrivate(PassOwnPtr<ContentSettingCallbacks> callba cks) : m_callbacks(std::move(callbacks)) { }
24 std::unique_ptr<ContentSettingCallbacks> m_callbacks; 23 OwnPtr<ContentSettingCallbacks> m_callbacks;
25 }; 24 };
26 25
27 WebContentSettingCallbacks::WebContentSettingCallbacks(std::unique_ptr<ContentSe ttingCallbacks>&& callbacks) 26 WebContentSettingCallbacks::WebContentSettingCallbacks(PassOwnPtr<ContentSetting Callbacks>&& callbacks)
28 { 27 {
29 m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks)); 28 m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks));
30 } 29 }
31 30
32 void WebContentSettingCallbacks::reset() 31 void WebContentSettingCallbacks::reset()
33 { 32 {
34 m_private.reset(); 33 m_private.reset();
35 } 34 }
36 35
37 void WebContentSettingCallbacks::assign(const WebContentSettingCallbacks& other) 36 void WebContentSettingCallbacks::assign(const WebContentSettingCallbacks& other)
38 { 37 {
39 m_private = other.m_private; 38 m_private = other.m_private;
40 } 39 }
41 40
42 void WebContentSettingCallbacks::doAllow() 41 void WebContentSettingCallbacks::doAllow()
43 { 42 {
44 ASSERT(!m_private.isNull()); 43 ASSERT(!m_private.isNull());
45 m_private->callbacks()->onAllowed(); 44 m_private->callbacks()->onAllowed();
46 m_private.reset(); 45 m_private.reset();
47 } 46 }
48 47
49 void WebContentSettingCallbacks::doDeny() 48 void WebContentSettingCallbacks::doDeny()
50 { 49 {
51 ASSERT(!m_private.isNull()); 50 ASSERT(!m_private.isNull());
52 m_private->callbacks()->onDenied(); 51 m_private->callbacks()->onDenied();
53 m_private.reset(); 52 m_private.reset();
54 } 53 }
55 54
56 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698