| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/csp/CSPDirectiveList.h" | 5 #include "core/frame/csp/CSPDirectiveList.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/SourceLocation.h" | 7 #include "bindings/core/v8/SourceLocation.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/SecurityContext.h" | 9 #include "core/dom/SecurityContext.h" |
| 10 #include "core/dom/SpaceSplitString.h" | 10 #include "core/dom/SpaceSplitString.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 String getSha256String(const String& content) { | 28 String getSha256String(const String& content) { |
| 29 DigestValue digest; | 29 DigestValue digest; |
| 30 StringUTF8Adaptor utf8Content(content); | 30 StringUTF8Adaptor utf8Content(content); |
| 31 bool digestSuccess = computeDigest(HashAlgorithmSha256, utf8Content.data(), | 31 bool digestSuccess = computeDigest(HashAlgorithmSha256, utf8Content.data(), |
| 32 utf8Content.length(), digest); | 32 utf8Content.length(), digest); |
| 33 if (!digestSuccess) { | 33 if (!digestSuccess) { |
| 34 return "sha256-..."; | 34 return "sha256-..."; |
| 35 } | 35 } |
| 36 | 36 |
| 37 return "sha256-" + base64Encode(reinterpret_cast<char*>(digest.data()), | 37 return "sha256-" + |
| 38 digest.size(), Base64DoNotInsertLFs); | 38 base64Encode(reinterpret_cast<char*>(digest.data()), digest.size(), |
| 39 Base64DoNotInsertLFs); |
| 39 } | 40 } |
| 40 | 41 |
| 41 template <typename CharType> | 42 template <typename CharType> |
| 42 inline bool isASCIIAlphanumericOrHyphen(CharType c) { | 43 inline bool isASCIIAlphanumericOrHyphen(CharType c) { |
| 43 return isASCIIAlphanumeric(c) || c == '-'; | 44 return isASCIIAlphanumeric(c) || c == '-'; |
| 44 } | 45 } |
| 45 | 46 |
| 46 } // namespace | 47 } // namespace |
| 47 | 48 |
| 48 CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, | 49 CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 visitor->trace(m_imgSrc); | 1303 visitor->trace(m_imgSrc); |
| 1303 visitor->trace(m_mediaSrc); | 1304 visitor->trace(m_mediaSrc); |
| 1304 visitor->trace(m_manifestSrc); | 1305 visitor->trace(m_manifestSrc); |
| 1305 visitor->trace(m_objectSrc); | 1306 visitor->trace(m_objectSrc); |
| 1306 visitor->trace(m_scriptSrc); | 1307 visitor->trace(m_scriptSrc); |
| 1307 visitor->trace(m_styleSrc); | 1308 visitor->trace(m_styleSrc); |
| 1308 visitor->trace(m_workerSrc); | 1309 visitor->trace(m_workerSrc); |
| 1309 } | 1310 } |
| 1310 | 1311 |
| 1311 } // namespace blink | 1312 } // namespace blink |
| OLD | NEW |