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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLIFrameElementAllow.cpp

Issue 2656533004: Remove unused blink::FeaturePolicy class. (Closed)
Patch Set: Rebase before commit Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "core/html/HTMLIFrameElementAllow.h" 5 #include "core/html/HTMLIFrameElementAllow.h"
6 6
7 #include "core/html/HTMLIFrameElement.h" 7 #include "core/html/HTMLIFrameElement.h"
8 #include "platform/feature_policy/FeaturePolicy.h" 8 #include "platform/feature_policy/FeaturePolicy.h"
9 9
10 using blink::WebFeaturePolicyFeature; 10 using blink::WebFeaturePolicyFeature;
(...skipping 14 matching lines...) Expand all
25 Vector<WebFeaturePolicyFeature> 25 Vector<WebFeaturePolicyFeature>
26 HTMLIFrameElementAllow::parseAllowedFeatureNames( 26 HTMLIFrameElementAllow::parseAllowedFeatureNames(
27 String& invalidTokensErrorMessage) const { 27 String& invalidTokensErrorMessage) const {
28 Vector<WebFeaturePolicyFeature> featureNames; 28 Vector<WebFeaturePolicyFeature> featureNames;
29 unsigned numTokenErrors = 0; 29 unsigned numTokenErrors = 0;
30 StringBuilder tokenErrors; 30 StringBuilder tokenErrors;
31 const SpaceSplitString& tokens = this->tokens(); 31 const SpaceSplitString& tokens = this->tokens();
32 32
33 // Collects a list of valid feature names. 33 // Collects a list of valid feature names.
34 for (size_t i = 0; i < tokens.size(); ++i) { 34 for (size_t i = 0; i < tokens.size(); ++i) {
35 WebFeaturePolicyFeature feature = 35 WebFeaturePolicyFeature feature = getWebFeaturePolicyFeature(tokens[i]);
36 FeaturePolicy::getWebFeaturePolicyFeature(tokens[i]);
37 if (feature == WebFeaturePolicyFeature::NotFound) { 36 if (feature == WebFeaturePolicyFeature::NotFound) {
38 tokenErrors.append(tokenErrors.isEmpty() ? "'" : ", '"); 37 tokenErrors.append(tokenErrors.isEmpty() ? "'" : ", '");
39 tokenErrors.append(tokens[i]); 38 tokenErrors.append(tokens[i]);
40 tokenErrors.append("'"); 39 tokenErrors.append("'");
41 ++numTokenErrors; 40 ++numTokenErrors;
42 } else { 41 } else {
43 featureNames.push_back(feature); 42 featureNames.push_back(feature);
44 } 43 }
45 } 44 }
46 45
47 if (numTokenErrors) { 46 if (numTokenErrors) {
48 tokenErrors.append(numTokenErrors > 1 ? " are invalid feature names." 47 tokenErrors.append(numTokenErrors > 1 ? " are invalid feature names."
49 : " is an invalid feature name."); 48 : " is an invalid feature name.");
50 invalidTokensErrorMessage = tokenErrors.toString(); 49 invalidTokensErrorMessage = tokenErrors.toString();
51 } 50 }
52 51
53 // Create a unique set of feature names. 52 // Create a unique set of feature names.
54 std::sort(featureNames.begin(), featureNames.end()); 53 std::sort(featureNames.begin(), featureNames.end());
55 auto it = std::unique(featureNames.begin(), featureNames.end()); 54 auto it = std::unique(featureNames.begin(), featureNames.end());
56 featureNames.shrink(it - featureNames.begin()); 55 featureNames.shrink(it - featureNames.begin());
57 56
58 return featureNames; 57 return featureNames;
59 } 58 }
60 59
61 bool HTMLIFrameElementAllow::validateTokenValue(const AtomicString& tokenValue, 60 bool HTMLIFrameElementAllow::validateTokenValue(const AtomicString& tokenValue,
62 ExceptionState&) const { 61 ExceptionState&) const {
63 return FeaturePolicy::getWebFeaturePolicyFeature(tokenValue.getString()) != 62 return getWebFeaturePolicyFeature(tokenValue.getString()) !=
64 WebFeaturePolicyFeature::NotFound; 63 WebFeaturePolicyFeature::NotFound;
65 } 64 }
66 65
67 void HTMLIFrameElementAllow::valueWasSet() { 66 void HTMLIFrameElementAllow::valueWasSet() {
68 DCHECK(m_element); 67 DCHECK(m_element);
69 m_element->allowValueWasSet(); 68 m_element->allowValueWasSet();
70 } 69 }
71 70
72 } // namespace blink 71 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698