| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=( | 113 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=( |
| 114 WTF::PassRefPtr<SecurityOrigin>); | 114 WTF::PassRefPtr<SecurityOrigin>); |
| 115 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const; | 115 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const; |
| 116 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const; | 116 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const; |
| 117 #else | 117 #else |
| 118 // TODO(mkwst): A number of properties don't survive a round-trip | 118 // TODO(mkwst): A number of properties don't survive a round-trip |
| 119 // ('document.domain', for instance). We'll need to fix that for OOPI-enabled | 119 // ('document.domain', for instance). We'll need to fix that for OOPI-enabled |
| 120 // embedders, https://crbug.com/490074. | 120 // embedders, https://crbug.com/490074. |
| 121 operator url::Origin() const { | 121 operator url::Origin() const { |
| 122 return isUnique() ? url::Origin() | 122 return isUnique() ? url::Origin() |
| 123 : url::Origin::UnsafelyCreateOriginWithoutNormalization( | 123 : url::Origin::CreateFromNormalizedTuple( |
| 124 protocol().utf8(), host().utf8(), effectivePort()); | 124 protocol().utf8(), host().utf8(), effectivePort()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 WebSecurityOrigin(const url::Origin& origin) : m_private(0) { | 127 WebSecurityOrigin(const url::Origin& origin) : m_private(0) { |
| 128 if (origin.unique()) { | 128 if (origin.unique()) { |
| 129 assign(WebSecurityOrigin::createUnique()); | 129 assign(WebSecurityOrigin::createUnique()); |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // TODO(mkwst): This might open up issues by double-canonicalizing the host. | 133 // TODO(mkwst): This might open up issues by double-canonicalizing the host. |
| 134 assign(WebSecurityOrigin::createFromTuple( | 134 assign(WebSecurityOrigin::createFromTuple( |
| 135 WebString::fromUTF8(origin.scheme()), | 135 WebString::fromUTF8(origin.scheme()), |
| 136 WebString::fromUTF8(origin.host()), origin.port())); | 136 WebString::fromUTF8(origin.host()), origin.port())); |
| 137 } | 137 } |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 // Present only to facilitate conversion from 'url::Origin'; this constructor | 141 // Present only to facilitate conversion from 'url::Origin'; this constructor |
| 142 // shouldn't be used anywhere else. | 142 // shouldn't be used anywhere else. |
| 143 BLINK_PLATFORM_EXPORT static WebSecurityOrigin | 143 BLINK_PLATFORM_EXPORT static WebSecurityOrigin |
| 144 createFromTuple(const WebString& protocol, const WebString& host, int port); | 144 createFromTuple(const WebString& protocol, const WebString& host, int port); |
| 145 | 145 |
| 146 void assign(WebSecurityOriginPrivate*); | 146 void assign(WebSecurityOriginPrivate*); |
| 147 WebSecurityOriginPrivate* m_private; | 147 WebSecurityOriginPrivate* m_private; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace blink | 150 } // namespace blink |
| 151 | 151 |
| 152 #endif | 152 #endif |
| OLD | NEW |