| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/csp_validator.h" | 5 #include "extensions/common/csp_validator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 manifest_errors::kInvalidCSPMissingSecureSrc, kScriptSrc))); | 290 manifest_errors::kInvalidCSPMissingSecureSrc, kScriptSrc))); |
| 291 } | 291 } |
| 292 if (!object_src_status.seen_in_policy && !allow_insecure_object_src) { | 292 if (!object_src_status.seen_in_policy && !allow_insecure_object_src) { |
| 293 sane_csp_parts.push_back(kObjectSrcDefaultDirective); | 293 sane_csp_parts.push_back(kObjectSrcDefaultDirective); |
| 294 if (warnings) | 294 if (warnings) |
| 295 warnings->push_back(CSPInstallWarning(ErrorUtils::FormatErrorMessage( | 295 warnings->push_back(CSPInstallWarning(ErrorUtils::FormatErrorMessage( |
| 296 manifest_errors::kInvalidCSPMissingSecureSrc, kObjectSrc))); | 296 manifest_errors::kInvalidCSPMissingSecureSrc, kObjectSrc))); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 return base::JoinString(sane_csp_parts, " "); | 300 return JoinString(sane_csp_parts, ' '); |
| 301 } | 301 } |
| 302 | 302 |
| 303 bool ContentSecurityPolicyIsSandboxed( | 303 bool ContentSecurityPolicyIsSandboxed( |
| 304 const std::string& policy, Manifest::Type type) { | 304 const std::string& policy, Manifest::Type type) { |
| 305 // See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. | 305 // See http://www.w3.org/TR/CSP/#parse-a-csp-policy for parsing algorithm. |
| 306 std::vector<std::string> directives; | 306 std::vector<std::string> directives; |
| 307 base::SplitString(policy, ';', &directives); | 307 base::SplitString(policy, ';', &directives); |
| 308 | 308 |
| 309 bool seen_sandbox = false; | 309 bool seen_sandbox = false; |
| 310 | 310 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 return seen_sandbox; | 341 return seen_sandbox; |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace csp_validator | 344 } // namespace csp_validator |
| 345 | 345 |
| 346 } // namespace extensions | 346 } // namespace extensions |
| OLD | NEW |