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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 WebSecurityOrigin& operator=(const WebSecurityOrigin& s) | 55 WebSecurityOrigin& operator=(const WebSecurityOrigin& s) |
56 { | 56 { |
57 assign(s); | 57 assign(s); |
58 return *this; | 58 return *this; |
59 } | 59 } |
60 | 60 |
61 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromDatabaseIdentifier(
const WebString& databaseIdentifier); | 61 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromDatabaseIdentifier(
const WebString& databaseIdentifier); |
62 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromString(const WebStr
ing&); | 62 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromString(const WebStr
ing&); |
63 BLINK_PLATFORM_EXPORT static WebSecurityOrigin create(const WebURL&); | 63 BLINK_PLATFORM_EXPORT static WebSecurityOrigin create(const WebURL&); |
64 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createUnique(); | 64 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createUnique(); |
| 65 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createUnique(bool isPotential
lyTrustworthy, bool shouldBypassSecureContextCheck); |
65 | 66 |
66 BLINK_PLATFORM_EXPORT void reset(); | 67 BLINK_PLATFORM_EXPORT void reset(); |
67 BLINK_PLATFORM_EXPORT void assign(const WebSecurityOrigin&); | 68 BLINK_PLATFORM_EXPORT void assign(const WebSecurityOrigin&); |
68 | 69 |
69 bool isNull() const { return !m_private; } | 70 bool isNull() const { return !m_private; } |
70 | 71 |
71 BLINK_PLATFORM_EXPORT WebString protocol() const; | 72 BLINK_PLATFORM_EXPORT WebString protocol() const; |
72 BLINK_PLATFORM_EXPORT WebString host() const; | 73 BLINK_PLATFORM_EXPORT WebString host() const; |
73 BLINK_PLATFORM_EXPORT unsigned short port() const; | 74 BLINK_PLATFORM_EXPORT unsigned short port() const; |
74 | 75 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #if INSIDE_BLINK | 117 #if INSIDE_BLINK |
117 BLINK_PLATFORM_EXPORT WebSecurityOrigin(const WTF::PassRefPtr<SecurityOrigin
>&); | 118 BLINK_PLATFORM_EXPORT WebSecurityOrigin(const WTF::PassRefPtr<SecurityOrigin
>&); |
118 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=(const WTF::PassRefPtr<Sec
urityOrigin>&); | 119 BLINK_PLATFORM_EXPORT WebSecurityOrigin& operator=(const WTF::PassRefPtr<Sec
urityOrigin>&); |
119 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const; | 120 BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<SecurityOrigin>() const; |
120 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const; | 121 BLINK_PLATFORM_EXPORT SecurityOrigin* get() const; |
121 #else | 122 #else |
122 // TODO(mkwst): A number of properties don't survive a round-trip ('document
.domain', for instance). | 123 // TODO(mkwst): A number of properties don't survive a round-trip ('document
.domain', for instance). |
123 // We'll need to fix that for OOPI-enabled embedders: https://crbug.com/4900
74. | 124 // We'll need to fix that for OOPI-enabled embedders: https://crbug.com/4900
74. |
124 operator url::Origin() const | 125 operator url::Origin() const |
125 { | 126 { |
126 return isUnique() | 127 if (!isUnique()) |
127 ? url::Origin() | 128 return url::Origin::UnsafelyCreateOriginWithoutNormalization(protoco
l().utf8(), host().utf8(), effectivePort()); |
128 : url::Origin::UnsafelyCreateOriginWithoutNormalization(protocol().u
tf8(), host().utf8(), effectivePort()); | 129 |
| 130 url::Origin origin; |
| 131 origin.set_is_unique_origin_potentially_trustworthy(isUniqueOriginPotent
iallyTrustworthy()); |
| 132 origin.set_should_unique_origin_bypass_secure_context_check(shouldUnique
OriginBypassSecureContextCheck()); |
| 133 return origin; |
129 } | 134 } |
130 | 135 |
131 WebSecurityOrigin(const url::Origin& origin) | 136 WebSecurityOrigin(const url::Origin& origin) |
132 : m_private(0) | 137 : m_private(0) |
133 { | 138 { |
134 if (origin.unique()) { | 139 if (origin.unique()) { |
135 assign(WebSecurityOrigin::createUnique()); | 140 assign(WebSecurityOrigin::createUnique(origin.is_unique_origin_poten
tially_trustworthy(), origin.should_unique_origin_bypass_secure_context_check())
); |
136 return; | 141 return; |
137 } | 142 } |
138 | 143 |
139 // TODO(mkwst): This might open up issues by double-canonicalizing the h
ost. | 144 // TODO(mkwst): This might open up issues by double-canonicalizing the h
ost. |
140 assign(WebSecurityOrigin::createFromTuple(WebString::fromUTF8(origin.sch
eme()), | 145 assign(WebSecurityOrigin::createFromTuple(WebString::fromUTF8(origin.sch
eme()), |
141 WebString::fromUTF8(origin.host()), | 146 WebString::fromUTF8(origin.host()), |
142 origin.port())); | 147 origin.port())); |
143 } | 148 } |
144 #endif | 149 #endif |
145 | 150 |
146 private: | 151 private: |
147 // Present only to facilitate conversion from 'url::Origin'; this constructo
r shouldn't be used anywhere else. | 152 // Present only to facilitate conversion from 'url::Origin'; this constructo
r shouldn't be used anywhere else. |
148 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromTuple(const WebStri
ng& protocol, const WebString& host, int port); | 153 BLINK_PLATFORM_EXPORT static WebSecurityOrigin createFromTuple(const WebStri
ng& protocol, const WebString& host, int port); |
149 | 154 |
150 void assign(WebSecurityOriginPrivate*); | 155 void assign(WebSecurityOriginPrivate*); |
| 156 bool isUniqueOriginPotentiallyTrustworthy() const; |
| 157 bool shouldUniqueOriginBypassSecureContextCheck() const; |
| 158 |
151 WebSecurityOriginPrivate* m_private; | 159 WebSecurityOriginPrivate* m_private; |
152 }; | 160 }; |
153 | 161 |
154 } // namespace blink | 162 } // namespace blink |
155 | 163 |
156 #endif | 164 #endif |
OLD | NEW |