Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/feature_policy/FeaturePolicy.h" | 5 #include "platform/feature_policy/FeaturePolicy.h" |
| 6 | 6 |
| 7 #include "platform/json/JSONValues.h" | 7 #include "platform/json/JSONValues.h" |
| 8 #include "platform/network/HTTPParsers.h" | 8 #include "platform/network/HTTPParsers.h" |
| 9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
| 10 #include "platform/weborigin/SecurityOrigin.h" | 10 #include "platform/weborigin/SecurityOrigin.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 | 94 |
| 95 // Definitions of all features controlled by Feature Policy should appear here. | 95 // Definitions of all features controlled by Feature Policy should appear here. |
| 96 const FeaturePolicy::Feature kDocumentCookie{ | 96 const FeaturePolicy::Feature kDocumentCookie{ |
| 97 "cookie", FeaturePolicy::FeatureDefault::EnableForAll}; | 97 "cookie", FeaturePolicy::FeatureDefault::EnableForAll}; |
| 98 const FeaturePolicy::Feature kDocumentDomain{ | 98 const FeaturePolicy::Feature kDocumentDomain{ |
| 99 "domain", FeaturePolicy::FeatureDefault::EnableForAll}; | 99 "domain", FeaturePolicy::FeatureDefault::EnableForAll}; |
| 100 const FeaturePolicy::Feature kDocumentWrite{ | 100 const FeaturePolicy::Feature kDocumentWrite{ |
| 101 "docwrite", FeaturePolicy::FeatureDefault::EnableForAll}; | 101 "docwrite", FeaturePolicy::FeatureDefault::EnableForAll}; |
| 102 const FeaturePolicy::Feature kFullscreenFeature{ | |
| 103 "fullscreen", FeaturePolicy::FeatureDefault::EnableForAll}; | |
|
iclelland
2016/12/05 16:27:35
I think this should be EnableForSelf, to closely m
lunalu1
2016/12/05 20:09:12
Done.
| |
| 102 const FeaturePolicy::Feature kGeolocationFeature{ | 104 const FeaturePolicy::Feature kGeolocationFeature{ |
| 103 "geolocation", FeaturePolicy::FeatureDefault::EnableForSelf}; | 105 "geolocation", FeaturePolicy::FeatureDefault::EnableForSelf}; |
| 104 const FeaturePolicy::Feature kMidiFeature{ | 106 const FeaturePolicy::Feature kMidiFeature{ |
| 105 "midi", FeaturePolicy::FeatureDefault::EnableForAll}; | 107 "midi", FeaturePolicy::FeatureDefault::EnableForAll}; |
| 106 const FeaturePolicy::Feature kNotificationsFeature{ | 108 const FeaturePolicy::Feature kNotificationsFeature{ |
| 107 "notifications", FeaturePolicy::FeatureDefault::EnableForAll}; | 109 "notifications", FeaturePolicy::FeatureDefault::EnableForAll}; |
| 108 const FeaturePolicy::Feature kPaymentFeature{ | 110 const FeaturePolicy::Feature kPaymentFeature{ |
| 109 "payment", FeaturePolicy::FeatureDefault::EnableForSelf}; | 111 "payment", FeaturePolicy::FeatureDefault::EnableForSelf}; |
| 110 const FeaturePolicy::Feature kPushFeature{ | 112 const FeaturePolicy::Feature kPushFeature{ |
| 111 "push", FeaturePolicy::FeatureDefault::EnableForAll}; | 113 "push", FeaturePolicy::FeatureDefault::EnableForAll}; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 157 } |
| 156 sb.append("]"); | 158 sb.append("]"); |
| 157 return sb.toString(); | 159 return sb.toString(); |
| 158 } | 160 } |
| 159 | 161 |
| 160 // static | 162 // static |
| 161 const FeaturePolicy::FeatureList& FeaturePolicy::getDefaultFeatureList() { | 163 const FeaturePolicy::FeatureList& FeaturePolicy::getDefaultFeatureList() { |
| 162 DEFINE_STATIC_LOCAL( | 164 DEFINE_STATIC_LOCAL( |
| 163 Vector<const FeaturePolicy::Feature*>, defaultFeatureList, | 165 Vector<const FeaturePolicy::Feature*>, defaultFeatureList, |
| 164 ({&kDocumentCookie, &kDocumentDomain, &kDocumentWrite, | 166 ({&kDocumentCookie, &kDocumentDomain, &kDocumentWrite, |
| 165 &kGeolocationFeature, &kMidiFeature, &kNotificationsFeature, | 167 &kGeolocationFeature, &kFullscreenFeature, &kMidiFeature, |
| 166 &kPaymentFeature, &kPushFeature, &kSyncScript, &kSyncXHR, &kUsermedia, | 168 &kNotificationsFeature, &kPaymentFeature, &kPushFeature, &kSyncScript, |
| 167 &kVibrateFeature, &kWebRTC})); | 169 &kSyncXHR, &kUsermedia, &kVibrateFeature, &kWebRTC})); |
| 168 return defaultFeatureList; | 170 return defaultFeatureList; |
| 169 } | 171 } |
| 170 | 172 |
| 171 // static | 173 // static |
| 172 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( | 174 std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( |
| 173 const FeaturePolicy* parent, | 175 const FeaturePolicy* parent, |
| 174 RefPtr<SecurityOrigin> currentOrigin, | 176 RefPtr<SecurityOrigin> currentOrigin, |
| 175 FeaturePolicy::FeatureList& features) { | 177 FeaturePolicy::FeatureList& features) { |
| 176 DCHECK(currentOrigin); | 178 DCHECK(currentOrigin); |
| 177 std::unique_ptr<FeaturePolicy> newPolicy = | 179 std::unique_ptr<FeaturePolicy> newPolicy = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 sb.append(" "); | 260 sb.append(" "); |
| 259 sb.append(whitelist.key->featureName); | 261 sb.append(whitelist.key->featureName); |
| 260 sb.append(": "); | 262 sb.append(": "); |
| 261 sb.append(whitelist.value->toString()); | 263 sb.append(whitelist.value->toString()); |
| 262 sb.append("\n"); | 264 sb.append("\n"); |
| 263 } | 265 } |
| 264 return sb.toString(); | 266 return sb.toString(); |
| 265 } | 267 } |
| 266 | 268 |
| 267 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |