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

Side by Side Diff: third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp

Issue 2814153002: Move feature policy vibrate tests to correct directory (Closed)
Patch Set: Bug fix Created 3 years, 8 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 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/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/json/JSONValues.h" 8 #include "platform/json/JSONValues.h"
9 #include "platform/network/HTTPParsers.h" 9 #include "platform/network/HTTPParsers.h"
10 #include "platform/weborigin/SecurityOrigin.h" 10 #include "platform/weborigin/SecurityOrigin.h"
11 #include "platform/wtf/PtrUtil.h" 11 #include "platform/wtf/PtrUtil.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 WebFeaturePolicyFeature GetWebFeaturePolicyFeature(const String& feature) { 15 WebFeaturePolicyFeature GetWebFeaturePolicyFeature(const String& feature) {
16 if (feature == "fullscreen") 16 if (feature == "fullscreen")
17 return WebFeaturePolicyFeature::kFullscreen; 17 return WebFeaturePolicyFeature::kFullscreen;
18 if (feature == "payment") 18 if (feature == "payment")
19 return WebFeaturePolicyFeature::kPayment; 19 return WebFeaturePolicyFeature::kPayment;
20 if (feature == "vibrate")
21 return WebFeaturePolicyFeature::kVibrate;
22 if (RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled()) { 20 if (RuntimeEnabledFeatures::featurePolicyExperimentalFeaturesEnabled()) {
21 if (feature == "vibrate")
22 return WebFeaturePolicyFeature::kVibrate;
23 if (feature == "camera") 23 if (feature == "camera")
24 return WebFeaturePolicyFeature::kCamera; 24 return WebFeaturePolicyFeature::kCamera;
25 if (feature == "eme") 25 if (feature == "eme")
26 return WebFeaturePolicyFeature::kEme; 26 return WebFeaturePolicyFeature::kEme;
27 if (feature == "microphone") 27 if (feature == "microphone")
28 return WebFeaturePolicyFeature::kMicrophone; 28 return WebFeaturePolicyFeature::kMicrophone;
29 if (feature == "speaker") 29 if (feature == "speaker")
30 return WebFeaturePolicyFeature::kSpeaker; 30 return WebFeaturePolicyFeature::kSpeaker;
31 if (feature == "cookie") 31 if (feature == "cookie")
32 return WebFeaturePolicyFeature::kDocumentCookie; 32 return WebFeaturePolicyFeature::kDocumentCookie;
33 if (feature == "domain") 33 if (feature == "domain")
34 return WebFeaturePolicyFeature::kDocumentDomain; 34 return WebFeaturePolicyFeature::kDocumentDomain;
35 if (feature == "docwrite") 35 if (feature == "docwrite")
36 return WebFeaturePolicyFeature::kDocumentWrite; 36 return WebFeaturePolicyFeature::kDocumentWrite;
37 if (feature == "geolocation") 37 if (feature == "geolocation")
38 return WebFeaturePolicyFeature::kGeolocation; 38 return WebFeaturePolicyFeature::kGeolocation;
39 if (feature == "midi") 39 if (feature == "midi")
40 return WebFeaturePolicyFeature::kMidiFeature; 40 return WebFeaturePolicyFeature::kMidiFeature;
41 if (feature == "notifications") 41 if (feature == "notifications")
42 return WebFeaturePolicyFeature::kNotifications; 42 return WebFeaturePolicyFeature::kNotifications;
43 if (feature == "push") 43 if (feature == "push")
44 return WebFeaturePolicyFeature::kPush; 44 return WebFeaturePolicyFeature::kPush;
45 if (feature == "sync-script") 45 if (feature == "sync-script")
46 return WebFeaturePolicyFeature::kSyncScript; 46 return WebFeaturePolicyFeature::kSyncScript;
47 if (feature == "sync-xhr") 47 if (feature == "sync-xhr")
48 return WebFeaturePolicyFeature::kSyncXHR; 48 return WebFeaturePolicyFeature::kSyncXHR;
49 if (feature == "webrtc") 49 if (feature == "webrtc")
50 return WebFeaturePolicyFeature::kWebRTC; 50 return WebFeaturePolicyFeature::kWebRTC;
51 } 51 }
52 return WebFeaturePolicyFeature::kNotFound; 52 return WebFeaturePolicyFeature::kNotFound;
iclelland 2017/04/19 17:23:28 Can you check to see if kNotFound is used anywhere
53 } 53 }
54 54
55 WebParsedFeaturePolicy ParseFeaturePolicy(const String& policy, 55 WebParsedFeaturePolicy ParseFeaturePolicy(const String& policy,
56 RefPtr<SecurityOrigin> origin, 56 RefPtr<SecurityOrigin> origin,
57 Vector<String>* messages) { 57 Vector<String>* messages) {
58 Vector<WebParsedFeaturePolicyDeclaration> whitelists; 58 Vector<WebParsedFeaturePolicyDeclaration> whitelists;
59 59
60 // Use a reasonable parse depth limit; the actual maximum depth is only going 60 // Use a reasonable parse depth limit; the actual maximum depth is only going
61 // to be 4 for a valid policy, but we'll give the featurePolicyParser a chance 61 // to be 4 for a valid policy, but we'll give the featurePolicyParser a chance
62 // to report more specific errors, unless the string is really invalid. 62 // to report more specific errors, unless the string is really invalid.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 for (const WebFeaturePolicyFeature feature : features) { 125 for (const WebFeaturePolicyFeature feature : features) {
126 WebParsedFeaturePolicyDeclaration whitelist; 126 WebParsedFeaturePolicyDeclaration whitelist;
127 whitelist.feature = feature; 127 whitelist.feature = feature;
128 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); 128 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin});
129 whitelists.push_back(whitelist); 129 whitelists.push_back(whitelist);
130 } 130 }
131 return whitelists; 131 return whitelists;
132 } 132 }
133 133
134 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698