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

Side by Side Diff: third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 #include "core/fetch/CrossOriginAccessControl.h" 27 #include "core/fetch/CrossOriginAccessControl.h"
28 28
29 #include "core/fetch/FetchUtils.h" 29 #include "core/fetch/FetchUtils.h"
30 #include "core/fetch/Resource.h" 30 #include "core/fetch/Resource.h"
31 #include "core/fetch/ResourceLoaderOptions.h" 31 #include "core/fetch/ResourceLoaderOptions.h"
32 #include "platform/network/HTTPParsers.h" 32 #include "platform/network/HTTPParsers.h"
33 #include "platform/network/ResourceRequest.h" 33 #include "platform/network/ResourceRequest.h"
34 #include "platform/network/ResourceResponse.h" 34 #include "platform/network/ResourceResponse.h"
35 #include "platform/weborigin/SchemeRegistry.h" 35 #include "platform/weborigin/SchemeRegistry.h"
36 #include "platform/weborigin/SecurityOrigin.h" 36 #include "platform/weborigin/SecurityOrigin.h"
37 #include "wtf/PtrUtil.h"
37 #include "wtf/Threading.h" 38 #include "wtf/Threading.h"
38 #include "wtf/text/AtomicString.h" 39 #include "wtf/text/AtomicString.h"
39 #include "wtf/text/StringBuilder.h" 40 #include "wtf/text/StringBuilder.h"
40 #include <algorithm> 41 #include <algorithm>
42 #include <memory>
41 43
42 namespace blink { 44 namespace blink {
43 45
44 static PassOwnPtr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet() 46 static std::unique_ptr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet ()
45 { 47 {
46 OwnPtr<HTTPHeaderSet> headerSet = adoptPtr(new HashSet<String, CaseFoldingHa sh>); 48 std::unique_ptr<HTTPHeaderSet> headerSet = wrapUnique(new HashSet<String, Ca seFoldingHash>);
47 49
48 headerSet->add("cache-control"); 50 headerSet->add("cache-control");
49 headerSet->add("content-language"); 51 headerSet->add("content-language");
50 headerSet->add("content-type"); 52 headerSet->add("content-type");
51 headerSet->add("expires"); 53 headerSet->add("expires");
52 headerSet->add("last-modified"); 54 headerSet->add("last-modified");
53 headerSet->add("pragma"); 55 headerSet->add("pragma");
54 56
55 return headerSet; 57 return headerSet;
56 } 58 }
57 59
58 bool isOnAccessControlResponseHeaderWhitelist(const String& name) 60 bool isOnAccessControlResponseHeaderWhitelist(const String& name)
59 { 61 {
60 DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHea ders, (createAllowedCrossOriginResponseHeadersSet().leakPtr())); 62 DEFINE_THREAD_SAFE_STATIC_LOCAL(HTTPHeaderSet, allowedCrossOriginResponseHea ders, (createAllowedCrossOriginResponseHeadersSet().release()));
61 63
62 return allowedCrossOriginResponseHeaders.contains(name); 64 return allowedCrossOriginResponseHeaders.contains(name);
63 } 65 }
64 66
65 void updateRequestForAccessControl(ResourceRequest& request, SecurityOrigin* sec urityOrigin, StoredCredentials allowCredentials) 67 void updateRequestForAccessControl(ResourceRequest& request, SecurityOrigin* sec urityOrigin, StoredCredentials allowCredentials)
66 { 68 {
67 request.removeCredentials(); 69 request.removeCredentials();
68 request.setAllowStoredCredentials(allowCredentials == AllowStoredCredentials ); 70 request.setAllowStoredCredentials(allowCredentials == AllowStoredCredentials );
69 71
70 if (securityOrigin) 72 if (securityOrigin)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 newRequest.setHTTPOrigin(securityOrigin); 328 newRequest.setHTTPOrigin(securityOrigin);
327 // If the user didn't request credentials in the first place, update our 329 // If the user didn't request credentials in the first place, update our
328 // state so we neither request them nor expect they must be allowed. 330 // state so we neither request them nor expect they must be allowed.
329 if (options.credentialsRequested == ClientDidNotRequestCredentials) 331 if (options.credentialsRequested == ClientDidNotRequestCredentials)
330 options.allowCredentials = DoNotAllowStoredCredentials; 332 options.allowCredentials = DoNotAllowStoredCredentials;
331 } 333 }
332 return true; 334 return true;
333 } 335 }
334 336
335 } // namespace blink 337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698