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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityPolicy.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 17 matching lines...) Expand all
28 28
29 #include "platform/weborigin/SecurityPolicy.h" 29 #include "platform/weborigin/SecurityPolicy.h"
30 30
31 #include "platform/RuntimeEnabledFeatures.h" 31 #include "platform/RuntimeEnabledFeatures.h"
32 #include "platform/weborigin/KURL.h" 32 #include "platform/weborigin/KURL.h"
33 #include "platform/weborigin/OriginAccessEntry.h" 33 #include "platform/weborigin/OriginAccessEntry.h"
34 #include "platform/weborigin/SchemeRegistry.h" 34 #include "platform/weborigin/SchemeRegistry.h"
35 #include "platform/weborigin/SecurityOrigin.h" 35 #include "platform/weborigin/SecurityOrigin.h"
36 #include "wtf/HashMap.h" 36 #include "wtf/HashMap.h"
37 #include "wtf/HashSet.h" 37 #include "wtf/HashSet.h"
38 #include "wtf/OwnPtr.h" 38 #include "wtf/PtrUtil.h"
39 #include "wtf/PassOwnPtr.h"
40 #include "wtf/Threading.h" 39 #include "wtf/Threading.h"
41 #include "wtf/text/StringHash.h" 40 #include "wtf/text/StringHash.h"
41 #include <memory>
42 42
43 namespace blink { 43 namespace blink {
44 44
45 using OriginAccessWhiteList = Vector<OriginAccessEntry>; 45 using OriginAccessWhiteList = Vector<OriginAccessEntry>;
46 using OriginAccessMap = HashMap<String, OwnPtr<OriginAccessWhiteList>>; 46 using OriginAccessMap = HashMap<String, std::unique_ptr<OriginAccessWhiteList>>;
47 using OriginSet = HashSet<String>; 47 using OriginSet = HashSet<String>;
48 48
49 static OriginAccessMap& originAccessMap() 49 static OriginAccessMap& originAccessMap()
50 { 50 {
51 DEFINE_STATIC_LOCAL(OriginAccessMap, originAccessMap, ()); 51 DEFINE_STATIC_LOCAL(OriginAccessMap, originAccessMap, ());
52 return originAccessMap; 52 return originAccessMap;
53 } 53 }
54 54
55 static OriginSet& trustworthyOriginSet() 55 static OriginSet& trustworthyOriginSet()
56 { 56 {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO rigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains) 179 void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO rigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
180 { 180 {
181 ASSERT(isMainThread()); 181 ASSERT(isMainThread());
182 ASSERT(!sourceOrigin.isUnique()); 182 ASSERT(!sourceOrigin.isUnique());
183 if (sourceOrigin.isUnique()) 183 if (sourceOrigin.isUnique())
184 return; 184 return;
185 185
186 String sourceString = sourceOrigin.toString(); 186 String sourceString = sourceOrigin.toString();
187 OriginAccessMap::AddResult result = originAccessMap().add(sourceString, null ptr); 187 OriginAccessMap::AddResult result = originAccessMap().add(sourceString, null ptr);
188 if (result.isNewEntry) 188 if (result.isNewEntry)
189 result.storedValue->value = adoptPtr(new OriginAccessWhiteList); 189 result.storedValue->value = wrapUnique(new OriginAccessWhiteList);
190 190
191 OriginAccessWhiteList* list = result.storedValue->value.get(); 191 OriginAccessWhiteList* list = result.storedValue->value.get();
192 list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allow DestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry:: DisallowSubdomains)); 192 list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allow DestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry:: DisallowSubdomains));
193 } 193 }
194 194
195 void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sour ceOrigin, const String& destinationProtocol, const String& destinationDomain, bo ol allowDestinationSubdomains) 195 void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sour ceOrigin, const String& destinationProtocol, const String& destinationDomain, bo ol allowDestinationSubdomains)
196 { 196 {
197 ASSERT(isMainThread()); 197 ASSERT(isMainThread());
198 ASSERT(!sourceOrigin.isUnique()); 198 ASSERT(!sourceOrigin.isUnique());
199 if (sourceOrigin.isUnique()) 199 if (sourceOrigin.isUnique())
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return true; 244 return true;
245 } 245 }
246 if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoring Case(policy, "default")) { 246 if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoring Case(policy, "default")) {
247 *result = ReferrerPolicyNoReferrerWhenDowngrade; 247 *result = ReferrerPolicyNoReferrerWhenDowngrade;
248 return true; 248 return true;
249 } 249 }
250 return false; 250 return false;
251 } 251 }
252 252
253 } // namespace blink 253 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp ('k') | third_party/WebKit/Source/web/AssociatedURLLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698