| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/dom/SecurityContext.h" | 27 #include "core/dom/SecurityContext.h" |
| 28 | 28 |
| 29 #include "core/frame/csp/ContentSecurityPolicy.h" | 29 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 30 #include "platform/RuntimeEnabledFeatures.h" | 30 #include "platform/RuntimeEnabledFeatures.h" |
| 31 #include "platform/weborigin/SecurityOrigin.h" | 31 #include "platform/weborigin/SecurityOrigin.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 // static |
| 36 std::vector<unsigned> SecurityContext::serializeInsecureNavigationSet( |
| 37 const InsecureNavigationsSet& set) { |
| 38 // The set is serialized as a sorted vector. |
| 39 std::vector<unsigned> serialized; |
| 40 serialized.reserve(set.size()); |
| 41 for (unsigned host : set) |
| 42 serialized.push_back(host); |
| 43 std::sort(serialized.begin(), serialized.end()); |
| 44 |
| 45 return serialized; |
| 46 } |
| 47 |
| 35 SecurityContext::SecurityContext() | 48 SecurityContext::SecurityContext() |
| 36 : m_sandboxFlags(SandboxNone), | 49 : m_sandboxFlags(SandboxNone), |
| 37 m_addressSpace(WebAddressSpacePublic), | 50 m_addressSpace(WebAddressSpacePublic), |
| 38 m_insecureRequestPolicy(kLeaveInsecureRequestsAlone) {} | 51 m_insecureRequestPolicy(kLeaveInsecureRequestsAlone) {} |
| 39 | 52 |
| 40 SecurityContext::~SecurityContext() {} | 53 SecurityContext::~SecurityContext() {} |
| 41 | 54 |
| 42 DEFINE_TRACE(SecurityContext) { | 55 DEFINE_TRACE(SecurityContext) { |
| 43 visitor->trace(m_contentSecurityPolicy); | 56 visitor->trace(m_contentSecurityPolicy); |
| 44 } | 57 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void SecurityContext::setFeaturePolicyFromHeader( | 115 void SecurityContext::setFeaturePolicyFromHeader( |
| 103 const WebParsedFeaturePolicy& parsedHeader, | 116 const WebParsedFeaturePolicy& parsedHeader, |
| 104 FeaturePolicy* parentFeaturePolicy) { | 117 FeaturePolicy* parentFeaturePolicy) { |
| 105 DCHECK(!m_featurePolicy); | 118 DCHECK(!m_featurePolicy); |
| 106 m_featurePolicy = FeaturePolicy::createFromParentPolicy(parentFeaturePolicy, | 119 m_featurePolicy = FeaturePolicy::createFromParentPolicy(parentFeaturePolicy, |
| 107 m_securityOrigin); | 120 m_securityOrigin); |
| 108 m_featurePolicy->setHeaderPolicy(parsedHeader); | 121 m_featurePolicy->setHeaderPolicy(parsedHeader); |
| 109 } | 122 } |
| 110 | 123 |
| 111 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |