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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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>
9 10
10 namespace blink { 11 namespace blink {
11 12
12 class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCal lbacksPrivate> { 13 class WebContentSettingCallbacksPrivate : public RefCounted<WebContentSettingCal lbacksPrivate> {
13 public: 14 public:
14 static PassRefPtr<WebContentSettingCallbacksPrivate> create(PassOwnPtr<Conte ntSettingCallbacks> callbacks) 15 static PassRefPtr<WebContentSettingCallbacksPrivate> create(std::unique_ptr< ContentSettingCallbacks> callbacks)
15 { 16 {
16 return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callback s))); 17 return adoptRef(new WebContentSettingCallbacksPrivate(std::move(callback s)));
17 } 18 }
18 19
19 ContentSettingCallbacks* callbacks() { return m_callbacks.get(); } 20 ContentSettingCallbacks* callbacks() { return m_callbacks.get(); }
20 21
21 private: 22 private:
22 WebContentSettingCallbacksPrivate(PassOwnPtr<ContentSettingCallbacks> callba cks) : m_callbacks(std::move(callbacks)) { } 23 WebContentSettingCallbacksPrivate(std::unique_ptr<ContentSettingCallbacks> c allbacks) : m_callbacks(std::move(callbacks)) { }
23 OwnPtr<ContentSettingCallbacks> m_callbacks; 24 std::unique_ptr<ContentSettingCallbacks> m_callbacks;
24 }; 25 };
25 26
26 WebContentSettingCallbacks::WebContentSettingCallbacks(PassOwnPtr<ContentSetting Callbacks>&& callbacks) 27 WebContentSettingCallbacks::WebContentSettingCallbacks(std::unique_ptr<ContentSe ttingCallbacks>&& callbacks)
27 { 28 {
28 m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks)); 29 m_private = WebContentSettingCallbacksPrivate::create(std::move(callbacks));
29 } 30 }
30 31
31 void WebContentSettingCallbacks::reset() 32 void WebContentSettingCallbacks::reset()
32 { 33 {
33 m_private.reset(); 34 m_private.reset();
34 } 35 }
35 36
36 void WebContentSettingCallbacks::assign(const WebContentSettingCallbacks& other) 37 void WebContentSettingCallbacks::assign(const WebContentSettingCallbacks& other)
37 { 38 {
38 m_private = other.m_private; 39 m_private = other.m_private;
39 } 40 }
40 41
41 void WebContentSettingCallbacks::doAllow() 42 void WebContentSettingCallbacks::doAllow()
42 { 43 {
43 ASSERT(!m_private.isNull()); 44 ASSERT(!m_private.isNull());
44 m_private->callbacks()->onAllowed(); 45 m_private->callbacks()->onAllowed();
45 m_private.reset(); 46 m_private.reset();
46 } 47 }
47 48
48 void WebContentSettingCallbacks::doDeny() 49 void WebContentSettingCallbacks::doDeny()
49 { 50 {
50 ASSERT(!m_private.isNull()); 51 ASSERT(!m_private.isNull());
51 m_private->callbacks()->onDenied(); 52 m_private->callbacks()->onDenied();
52 m_private.reset(); 53 m_private.reset();
53 } 54 }
54 55
55 } // namespace blink 56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698