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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContextFeatures.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 11 matching lines...) Expand all
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "core/dom/ContextFeatures.h" 27 #include "core/dom/ContextFeatures.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/page/Page.h" 30 #include "core/page/Page.h"
31 #include "platform/RuntimeEnabledFeatures.h" 31 #include "platform/RuntimeEnabledFeatures.h"
32 #include "wtf/PtrUtil.h"
32 #include "wtf/StdLibExtras.h" 33 #include "wtf/StdLibExtras.h"
34 #include <memory>
33 35
34 namespace blink { 36 namespace blink {
35 37
36 PassOwnPtr<ContextFeaturesClient> ContextFeaturesClient::empty() 38 std::unique_ptr<ContextFeaturesClient> ContextFeaturesClient::empty()
37 { 39 {
38 return adoptPtr(new ContextFeaturesClient()); 40 return wrapUnique(new ContextFeaturesClient());
39 } 41 }
40 42
41 const char* ContextFeatures::supplementName() 43 const char* ContextFeatures::supplementName()
42 { 44 {
43 return "ContextFeatures"; 45 return "ContextFeatures";
44 } 46 }
45 47
46 ContextFeatures& ContextFeatures::defaultSwitch() 48 ContextFeatures& ContextFeatures::defaultSwitch()
47 { 49 {
48 DEFINE_STATIC_LOCAL(ContextFeatures, instance, (ContextFeatures::create(Cont extFeaturesClient::empty()))); 50 DEFINE_STATIC_LOCAL(ContextFeatures, instance, (ContextFeatures::create(Cont extFeaturesClient::empty())));
49 return instance; 51 return instance;
50 } 52 }
51 53
52 bool ContextFeatures::pagePopupEnabled(Document* document) 54 bool ContextFeatures::pagePopupEnabled(Document* document)
53 { 55 {
54 if (!document) 56 if (!document)
55 return false; 57 return false;
56 return document->contextFeatures().isEnabled(document, PagePopup, false); 58 return document->contextFeatures().isEnabled(document, PagePopup, false);
57 } 59 }
58 60
59 bool ContextFeatures::mutationEventsEnabled(Document* document) 61 bool ContextFeatures::mutationEventsEnabled(Document* document)
60 { 62 {
61 DCHECK(document); 63 DCHECK(document);
62 if (!document) 64 if (!document)
63 return true; 65 return true;
64 return document->contextFeatures().isEnabled(document, MutationEvents, true) ; 66 return document->contextFeatures().isEnabled(document, MutationEvents, true) ;
65 } 67 }
66 68
67 void provideContextFeaturesTo(Page& page, PassOwnPtr<ContextFeaturesClient> clie nt) 69 void provideContextFeaturesTo(Page& page, std::unique_ptr<ContextFeaturesClient> client)
68 { 70 {
69 Supplement<Page>::provideTo(page, ContextFeatures::supplementName(), Context Features::create(std::move(client))); 71 Supplement<Page>::provideTo(page, ContextFeatures::supplementName(), Context Features::create(std::move(client)));
70 } 72 }
71 73
72 void provideContextFeaturesToDocumentFrom(Document& document, Page& page) 74 void provideContextFeaturesToDocumentFrom(Document& document, Page& page)
73 { 75 {
74 ContextFeatures* provided = static_cast<ContextFeatures*>(Supplement<Page>:: from(page, ContextFeatures::supplementName())); 76 ContextFeatures* provided = static_cast<ContextFeatures*>(Supplement<Page>:: from(page, ContextFeatures::supplementName()));
75 if (!provided) 77 if (!provided)
76 return; 78 return;
77 document.setContextFeatures(*provided); 79 document.setContextFeatures(*provided);
78 } 80 }
79 81
80 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContextFeatures.h ('k') | third_party/WebKit/Source/core/dom/CrossThreadTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698