| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "platform/RuntimeEnabledFeatures.h" | 31 #include "platform/RuntimeEnabledFeatures.h" |
| 32 #include "platform/weborigin/KURL.h" | 32 #include "platform/weborigin/KURL.h" |
| 33 #include "platform/weborigin/KnownPorts.h" | 33 #include "platform/weborigin/KnownPorts.h" |
| 34 #include "platform/weborigin/SchemeRegistry.h" | 34 #include "platform/weborigin/SchemeRegistry.h" |
| 35 #include "platform/weborigin/SecurityOriginCache.h" | 35 #include "platform/weborigin/SecurityOriginCache.h" |
| 36 #include "platform/weborigin/SecurityPolicy.h" | 36 #include "platform/weborigin/SecurityPolicy.h" |
| 37 #include "url/url_canon_ip.h" | 37 #include "url/url_canon_ip.h" |
| 38 #include "wtf/HexNumber.h" | 38 #include "wtf/HexNumber.h" |
| 39 #include "wtf/NotFound.h" | 39 #include "wtf/NotFound.h" |
| 40 #include "wtf/PtrUtil.h" | 40 #include "wtf/OwnPtr.h" |
| 41 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/StdLibExtras.h" | 42 #include "wtf/StdLibExtras.h" |
| 42 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
| 43 #include <memory> | |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 const int InvalidPort = 0; | 47 const int InvalidPort = 0; |
| 48 const int MaxAllowedPort = 65535; | 48 const int MaxAllowedPort = 65535; |
| 49 | 49 |
| 50 static SecurityOriginCache* s_originCache = 0; | 50 static SecurityOriginCache* s_originCache = 0; |
| 51 | 51 |
| 52 static SecurityOrigin* cachedOrigin(const KURL& url) | 52 static SecurityOrigin* cachedOrigin(const KURL& url) |
| 53 { | 53 { |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 return isSameSchemeHostPort(other) && sameSuborigins; | 558 return isSameSchemeHostPort(other) && sameSuborigins; |
| 559 } | 559 } |
| 560 | 560 |
| 561 const KURL& SecurityOrigin::urlWithUniqueSecurityOrigin() | 561 const KURL& SecurityOrigin::urlWithUniqueSecurityOrigin() |
| 562 { | 562 { |
| 563 ASSERT(isMainThread()); | 563 ASSERT(isMainThread()); |
| 564 DEFINE_STATIC_LOCAL(const KURL, uniqueSecurityOriginURL, (ParsedURLString, "
data:,")); | 564 DEFINE_STATIC_LOCAL(const KURL, uniqueSecurityOriginURL, (ParsedURLString, "
data:,")); |
| 565 return uniqueSecurityOriginURL; | 565 return uniqueSecurityOriginURL; |
| 566 } | 566 } |
| 567 | 567 |
| 568 std::unique_ptr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeDa
ta() const | 568 PassOwnPtr<SecurityOrigin::PrivilegeData> SecurityOrigin::createPrivilegeData()
const |
| 569 { | 569 { |
| 570 std::unique_ptr<PrivilegeData> privilegeData = wrapUnique(new PrivilegeData)
; | 570 OwnPtr<PrivilegeData> privilegeData = adoptPtr(new PrivilegeData); |
| 571 privilegeData->m_universalAccess = m_universalAccess; | 571 privilegeData->m_universalAccess = m_universalAccess; |
| 572 privilegeData->m_canLoadLocalResources = m_canLoadLocalResources; | 572 privilegeData->m_canLoadLocalResources = m_canLoadLocalResources; |
| 573 privilegeData->m_blockLocalAccessFromLocalOrigin = m_blockLocalAccessFromLoc
alOrigin; | 573 privilegeData->m_blockLocalAccessFromLocalOrigin = m_blockLocalAccessFromLoc
alOrigin; |
| 574 return privilegeData; | 574 return privilegeData; |
| 575 } | 575 } |
| 576 | 576 |
| 577 void SecurityOrigin::transferPrivilegesFrom(std::unique_ptr<PrivilegeData> privi
legeData) | 577 void SecurityOrigin::transferPrivilegesFrom(PassOwnPtr<PrivilegeData> privilegeD
ata) |
| 578 { | 578 { |
| 579 m_universalAccess = privilegeData->m_universalAccess; | 579 m_universalAccess = privilegeData->m_universalAccess; |
| 580 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; | 580 m_canLoadLocalResources = privilegeData->m_canLoadLocalResources; |
| 581 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc
alOrigin; | 581 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc
alOrigin; |
| 582 } | 582 } |
| 583 | 583 |
| 584 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin
PotentiallyTrustworthy) | 584 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin
PotentiallyTrustworthy) |
| 585 { | 585 { |
| 586 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique()); | 586 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique()); |
| 587 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth
y; | 587 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth
y; |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace blink | 590 } // namespace blink |
| OLD | NEW |