| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class WebSecurityOriginPrivate : public SecurityOrigin {}; | 41 class WebSecurityOriginPrivate : public SecurityOrigin {}; |
| 42 | 42 |
| 43 WebSecurityOrigin WebSecurityOrigin::createFromString(const WebString& origin) { | 43 WebSecurityOrigin WebSecurityOrigin::createFromString(const WebString& origin) { |
| 44 return WebSecurityOrigin(SecurityOrigin::createFromString(origin)); | 44 return WebSecurityOrigin(SecurityOrigin::createFromString(origin)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebSecurityOrigin WebSecurityOrigin::create(const WebURL& url) { | 47 WebSecurityOrigin WebSecurityOrigin::create(const WebURL& url) { |
| 48 return WebSecurityOrigin(SecurityOrigin::create(url)); | 48 return WebSecurityOrigin(SecurityOrigin::create(url)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 WebSecurityOrigin WebSecurityOrigin::createFromTuple(const WebString& protocol, | 51 WebSecurityOrigin WebSecurityOrigin::createFromTupleWithSuborigin( |
| 52 const WebString& host, | 52 const WebString& protocol, |
| 53 int port) { | 53 const WebString& host, |
| 54 return WebSecurityOrigin(SecurityOrigin::create(protocol, host, port)); | 54 int port, |
| 55 const WebString& suborigin) { |
| 56 return WebSecurityOrigin( |
| 57 SecurityOrigin::create(protocol, host, port, suborigin)); |
| 55 } | 58 } |
| 56 | 59 |
| 57 WebSecurityOrigin WebSecurityOrigin::createUnique() { | 60 WebSecurityOrigin WebSecurityOrigin::createUnique() { |
| 58 return WebSecurityOrigin(SecurityOrigin::createUnique()); | 61 return WebSecurityOrigin(SecurityOrigin::createUnique()); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void WebSecurityOrigin::reset() { | 64 void WebSecurityOrigin::reset() { |
| 62 assign(0); | 65 assign(0); |
| 63 } | 66 } |
| 64 | 67 |
| 65 void WebSecurityOrigin::assign(const WebSecurityOrigin& other) { | 68 void WebSecurityOrigin::assign(const WebSecurityOrigin& other) { |
| 66 WebSecurityOriginPrivate* p = | 69 WebSecurityOriginPrivate* p = |
| 67 const_cast<WebSecurityOriginPrivate*>(other.m_private); | 70 const_cast<WebSecurityOriginPrivate*>(other.m_private); |
| 68 if (p) | 71 if (p) |
| 69 p->ref(); | 72 p->ref(); |
| 70 assign(p); | 73 assign(p); |
| 71 } | 74 } |
| 72 | 75 |
| 73 WebString WebSecurityOrigin::protocol() const { | 76 WebString WebSecurityOrigin::protocol() const { |
| 74 ASSERT(m_private); | 77 DCHECK(m_private); |
| 75 return m_private->protocol(); | 78 return m_private->protocol(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 WebString WebSecurityOrigin::host() const { | 81 WebString WebSecurityOrigin::host() const { |
| 79 ASSERT(m_private); | 82 DCHECK(m_private); |
| 80 return m_private->host(); | 83 return m_private->host(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 unsigned short WebSecurityOrigin::port() const { | 86 unsigned short WebSecurityOrigin::port() const { |
| 84 ASSERT(m_private); | 87 DCHECK(m_private); |
| 85 return m_private->port(); | 88 return m_private->port(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 unsigned short WebSecurityOrigin::effectivePort() const { | 91 unsigned short WebSecurityOrigin::effectivePort() const { |
| 89 ASSERT(m_private); | 92 DCHECK(m_private); |
| 90 return m_private->effectivePort(); | 93 return m_private->effectivePort(); |
| 91 } | 94 } |
| 92 | 95 |
| 96 WebString WebSecurityOrigin::suborigin() const { |
| 97 DCHECK(m_private); |
| 98 return m_private->hasSuborigin() ? m_private->suborigin()->name() : ""; |
| 99 } |
| 100 |
| 93 bool WebSecurityOrigin::isUnique() const { | 101 bool WebSecurityOrigin::isUnique() const { |
| 94 ASSERT(m_private); | 102 DCHECK(m_private); |
| 95 return m_private->isUnique(); | 103 return m_private->isUnique(); |
| 96 } | 104 } |
| 97 | 105 |
| 98 bool WebSecurityOrigin::canAccess(const WebSecurityOrigin& other) const { | 106 bool WebSecurityOrigin::canAccess(const WebSecurityOrigin& other) const { |
| 99 ASSERT(m_private); | 107 DCHECK(m_private); |
| 100 ASSERT(other.m_private); | 108 DCHECK(other.m_private); |
| 101 return m_private->canAccess(other.m_private); | 109 return m_private->canAccess(other.m_private); |
| 102 } | 110 } |
| 103 | 111 |
| 104 bool WebSecurityOrigin::canRequest(const WebURL& url) const { | 112 bool WebSecurityOrigin::canRequest(const WebURL& url) const { |
| 105 ASSERT(m_private); | 113 DCHECK(m_private); |
| 106 return m_private->canRequest(url); | 114 return m_private->canRequest(url); |
| 107 } | 115 } |
| 108 | 116 |
| 109 bool WebSecurityOrigin::isPotentiallyTrustworthy() const { | 117 bool WebSecurityOrigin::isPotentiallyTrustworthy() const { |
| 110 ASSERT(m_private); | 118 DCHECK(m_private); |
| 111 return m_private->isPotentiallyTrustworthy(); | 119 return m_private->isPotentiallyTrustworthy(); |
| 112 } | 120 } |
| 113 | 121 |
| 114 WebString WebSecurityOrigin::toString() const { | 122 WebString WebSecurityOrigin::toString() const { |
| 115 ASSERT(m_private); | 123 DCHECK(m_private); |
| 116 return m_private->toString(); | 124 return m_private->toString(); |
| 117 } | 125 } |
| 118 | 126 |
| 119 bool WebSecurityOrigin::canAccessPasswordManager() const { | 127 bool WebSecurityOrigin::canAccessPasswordManager() const { |
| 120 ASSERT(m_private); | 128 DCHECK(m_private); |
| 121 return m_private->canAccessPasswordManager(); | 129 return m_private->canAccessPasswordManager(); |
| 122 } | 130 } |
| 123 | 131 |
| 124 WebSecurityOrigin::WebSecurityOrigin(WTF::PassRefPtr<SecurityOrigin> origin) | 132 WebSecurityOrigin::WebSecurityOrigin(WTF::PassRefPtr<SecurityOrigin> origin) |
| 125 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())) {} | 133 : m_private(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())) {} |
| 126 | 134 |
| 127 WebSecurityOrigin& WebSecurityOrigin::operator=( | 135 WebSecurityOrigin& WebSecurityOrigin::operator=( |
| 128 WTF::PassRefPtr<SecurityOrigin> origin) { | 136 WTF::PassRefPtr<SecurityOrigin> origin) { |
| 129 assign(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())); | 137 assign(static_cast<WebSecurityOriginPrivate*>(origin.leakRef())); |
| 130 return *this; | 138 return *this; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 144 if (m_private) | 152 if (m_private) |
| 145 m_private->deref(); | 153 m_private->deref(); |
| 146 m_private = p; | 154 m_private = p; |
| 147 } | 155 } |
| 148 | 156 |
| 149 void WebSecurityOrigin::grantLoadLocalResources() const { | 157 void WebSecurityOrigin::grantLoadLocalResources() const { |
| 150 get()->grantLoadLocalResources(); | 158 get()->grantLoadLocalResources(); |
| 151 } | 159 } |
| 152 | 160 |
| 153 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |