| 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 15 matching lines...) Expand all Loading... |
| 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/weborigin/SecurityOrigin.h" | 30 #include "platform/weborigin/SecurityOrigin.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 SecurityContext::SecurityContext() | 34 SecurityContext::SecurityContext() |
| 35 : m_sandboxFlags(SandboxNone) | 35 : m_sandboxFlags(SandboxNone) |
| 36 , m_hostedInReservedIPRange(false) | 36 , m_addressSpace(WebURLRequest::AddressSpacePublic) |
| 37 , m_insecureRequestsPolicy(InsecureRequestsDoNotUpgrade) | 37 , m_insecureRequestsPolicy(InsecureRequestsDoNotUpgrade) |
| 38 , m_enforceStrictMixedContentChecking(false) | 38 , m_enforceStrictMixedContentChecking(false) |
| 39 { | 39 { |
| 40 } | 40 } |
| 41 | 41 |
| 42 SecurityContext::~SecurityContext() | 42 SecurityContext::~SecurityContext() |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 DEFINE_TRACE(SecurityContext) | 46 DEFINE_TRACE(SecurityContext) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 void SecurityContext::enforceSandboxFlags(SandboxFlags mask) | 61 void SecurityContext::enforceSandboxFlags(SandboxFlags mask) |
| 62 { | 62 { |
| 63 m_sandboxFlags |= mask; | 63 m_sandboxFlags |= mask; |
| 64 | 64 |
| 65 if (isSandboxed(SandboxOrigin) && securityOrigin() && !securityOrigin()->isU
nique()) { | 65 if (isSandboxed(SandboxOrigin) && securityOrigin() && !securityOrigin()->isU
nique()) { |
| 66 setSecurityOrigin(SecurityOrigin::createUnique()); | 66 setSecurityOrigin(SecurityOrigin::createUnique()); |
| 67 didUpdateSecurityOrigin(); | 67 didUpdateSecurityOrigin(); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 WebURLRequest::AddressSpace SecurityContext::addressSpace() const | |
| 72 { | |
| 73 if (m_hostedInReservedIPRange) | |
| 74 return securityOrigin()->isLocalhost() ? WebURLRequest::AddressSpaceLoca
l : WebURLRequest::AddressSpacePrivate; | |
| 75 | |
| 76 return WebURLRequest::AddressSpacePublic; | |
| 77 } | |
| 78 | |
| 79 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |