| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef SecurityContext_h | 27 #ifndef SecurityContext_h |
| 28 #define SecurityContext_h | 28 #define SecurityContext_h |
| 29 | 29 |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/SandboxFlags.h" | 31 #include "core/dom/SandboxFlags.h" |
| 32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
| 33 #include "public/platform/WebURLRequest.h" | 33 #include "public/platform/WebAddressSpace.h" |
| 34 #include "wtf/HashSet.h" | 34 #include "wtf/HashSet.h" |
| 35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
| 36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 #include "wtf/text/StringHash.h" | 38 #include "wtf/text/StringHash.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class SecurityOrigin; | 43 class SecurityOrigin; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 // Explicitly override the security origin for this security context. | 63 // Explicitly override the security origin for this security context. |
| 64 // Note: It is dangerous to change the security origin of a script context | 64 // Note: It is dangerous to change the security origin of a script context |
| 65 // that already contains content. | 65 // that already contains content. |
| 66 void setSecurityOrigin(PassRefPtr<SecurityOrigin>); | 66 void setSecurityOrigin(PassRefPtr<SecurityOrigin>); |
| 67 virtual void didUpdateSecurityOrigin() = 0; | 67 virtual void didUpdateSecurityOrigin() = 0; |
| 68 | 68 |
| 69 SandboxFlags getSandboxFlags() const { return m_sandboxFlags; } | 69 SandboxFlags getSandboxFlags() const { return m_sandboxFlags; } |
| 70 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; } | 70 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; } |
| 71 void enforceSandboxFlags(SandboxFlags mask); | 71 void enforceSandboxFlags(SandboxFlags mask); |
| 72 | 72 |
| 73 void setAddressSpace(WebURLRequest::AddressSpace space) { m_addressSpace = s
pace; } | 73 void setAddressSpace(WebAddressSpace space) { m_addressSpace = space; } |
| 74 WebURLRequest::AddressSpace addressSpace() const { return m_addressSpace; } | 74 WebAddressSpace addressSpace() const { return m_addressSpace; } |
| 75 String addressSpaceForBindings() const; | 75 String addressSpaceForBindings() const; |
| 76 | 76 |
| 77 void setInsecureRequestsPolicy(InsecureRequestsPolicy policy) { m_insecureRe
questsPolicy = policy; } | 77 void setInsecureRequestsPolicy(InsecureRequestsPolicy policy) { m_insecureRe
questsPolicy = policy; } |
| 78 InsecureRequestsPolicy getInsecureRequestsPolicy() const { return m_insecure
RequestsPolicy; } | 78 InsecureRequestsPolicy getInsecureRequestsPolicy() const { return m_insecure
RequestsPolicy; } |
| 79 | 79 |
| 80 void addInsecureNavigationUpgrade(unsigned hashedHost) { m_insecureNavigatio
nsToUpgrade.add(hashedHost); } | 80 void addInsecureNavigationUpgrade(unsigned hashedHost) { m_insecureNavigatio
nsToUpgrade.add(hashedHost); } |
| 81 InsecureNavigationsSet* insecureNavigationsToUpgrade() { return &m_insecureN
avigationsToUpgrade; } | 81 InsecureNavigationsSet* insecureNavigationsToUpgrade() { return &m_insecureN
avigationsToUpgrade; } |
| 82 | 82 |
| 83 void setShouldEnforceStrictMixedContentChecking(bool shouldEnforce) { m_enfo
rceStrictMixedContentChecking = shouldEnforce; } | 83 void setShouldEnforceStrictMixedContentChecking(bool shouldEnforce) { m_enfo
rceStrictMixedContentChecking = shouldEnforce; } |
| 84 bool shouldEnforceStrictMixedContentChecking() { return m_enforceStrictMixed
ContentChecking; } | 84 bool shouldEnforceStrictMixedContentChecking() { return m_enforceStrictMixed
ContentChecking; } |
| 85 | 85 |
| 86 void enforceSuborigin(const String& name); | 86 void enforceSuborigin(const String& name); |
| 87 bool hasSuborigin(); | 87 bool hasSuborigin(); |
| 88 String suboriginName(); | 88 String suboriginName(); |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 SecurityContext(); | 91 SecurityContext(); |
| 92 virtual ~SecurityContext(); | 92 virtual ~SecurityContext(); |
| 93 | 93 |
| 94 void setContentSecurityPolicy(PassRefPtrWillBeRawPtr<ContentSecurityPolicy>)
; | 94 void setContentSecurityPolicy(PassRefPtrWillBeRawPtr<ContentSecurityPolicy>)
; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 RefPtr<SecurityOrigin> m_securityOrigin; | 97 RefPtr<SecurityOrigin> m_securityOrigin; |
| 98 RefPtrWillBeMember<ContentSecurityPolicy> m_contentSecurityPolicy; | 98 RefPtrWillBeMember<ContentSecurityPolicy> m_contentSecurityPolicy; |
| 99 | 99 |
| 100 SandboxFlags m_sandboxFlags; | 100 SandboxFlags m_sandboxFlags; |
| 101 | 101 |
| 102 WebURLRequest::AddressSpace m_addressSpace; | 102 WebAddressSpace m_addressSpace; |
| 103 InsecureRequestsPolicy m_insecureRequestsPolicy; | 103 InsecureRequestsPolicy m_insecureRequestsPolicy; |
| 104 InsecureNavigationsSet m_insecureNavigationsToUpgrade; | 104 InsecureNavigationsSet m_insecureNavigationsToUpgrade; |
| 105 bool m_enforceStrictMixedContentChecking; | 105 bool m_enforceStrictMixedContentChecking; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| 109 | 109 |
| 110 #endif // SecurityContext_h | 110 #endif // SecurityContext_h |
| OLD | NEW |