Lines Matching full:origin
5 #include "url/origin.h"
33 Origin::Origin() : nonce_(Nonce()) {} in Origin() function in url::Origin
35 Origin Origin::Create(const GURL& url) { in Create()
37 return Origin(); in Create()
44 // If we're dealing with a 'blob:' URL, https://url.spec.whatwg.org/#origin in Create()
45 // defines the origin as the origin of the URL which results from parsing in Create()
60 return Origin(); in Create()
61 return Origin(std::move(tuple)); in Create()
64 Origin Origin::Resolve(const GURL& url, const Origin& base_origin) { in Resolve()
67 Origin result = Origin::Create(url); in Resolve()
73 Origin::Origin(const Origin&) = default;
74 Origin& Origin::operator=(const Origin&) = default;
75 Origin::Origin(Origin&&) noexcept = default;
76 Origin& Origin::operator=(Origin&&) noexcept = default;
77 Origin::~Origin() = default;
80 absl::optional<Origin> Origin::UnsafelyCreateTupleOriginWithoutNormalization( in UnsafelyCreateTupleOriginWithoutNormalization()
88 return Origin(std::move(tuple)); in UnsafelyCreateTupleOriginWithoutNormalization()
92 absl::optional<Origin> Origin::UnsafelyCreateOpaqueOriginWithoutNormalization( in UnsafelyCreateOpaqueOriginWithoutNormalization()
96 const Origin::Nonce& nonce) { in UnsafelyCreateOpaqueOriginWithoutNormalization()
108 return Origin(std::move(nonce), std::move(precursor)); in UnsafelyCreateOpaqueOriginWithoutNormalization()
112 Origin Origin::CreateFromNormalizedTuple(std::string scheme, in CreateFromNormalizedTuple()
118 return Origin(); in CreateFromNormalizedTuple()
119 return Origin(std::move(tuple)); in CreateFromNormalizedTuple()
123 Origin Origin::CreateOpaqueFromNormalizedPrecursorTuple( in CreateOpaqueFromNormalizedPrecursorTuple()
127 const Origin::Nonce& nonce) { in CreateOpaqueFromNormalizedPrecursorTuple()
132 return Origin(std::move(nonce), std::move(precursor)); in CreateOpaqueFromNormalizedPrecursorTuple()
135 std::string Origin::Serialize() const { in Serialize()
145 GURL Origin::GetURL() const { in GetURL()
155 const base::UnguessableToken* Origin::GetNonceForSerialization() const { in GetNonceForSerialization()
159 bool Origin::IsSameOriginWith(const Origin& other) const { in IsSameOriginWith()
161 // the precursor origin. in IsSameOriginWith()
165 bool Origin::IsSameOriginWith(const GURL& url) const { in IsSameOriginWith()
169 // The `url::Origin::Create` call here preserves how IsSameOriginWith was used in IsSameOriginWith()
171 // - Origin of about:blank and about:srcdoc cannot be correctly in IsSameOriginWith()
176 return IsSameOriginWith(url::Origin::Create(url)); in IsSameOriginWith()
179 bool Origin::CanBeDerivedFrom(const GURL& url) const { in CanBeDerivedFrom()
188 // is for opaque origin. in CanBeDerivedFrom()
192 // And if it is unique opaque origin, it definitely is fine. But if there in CanBeDerivedFrom()
202 // origin can always create an opaque tuple origin. in CanBeDerivedFrom()
214 // Blob URLs still contain an inner origin, however it is not accessible in CanBeDerivedFrom()
218 // opaque origin. It is valid case, as any browser-initiated navigation in CanBeDerivedFrom()
220 // origin and it is valid for it to create blob: URLs. in CanBeDerivedFrom()
231 // All about: URLs (about:blank, about:srcdoc) inherit their origin from in CanBeDerivedFrom()
233 // type of origin. in CanBeDerivedFrom()
242 // If |this| does not have valid precursor tuple, it is unique opaque origin, in CanBeDerivedFrom()
251 bool Origin::DomainIs(base::StringPiece canonical_domain) const { in DomainIs()
255 bool Origin::operator<(const Origin& other) const { in operator <()
259 Origin Origin::DeriveNewOpaqueOrigin() const { in DeriveNewOpaqueOrigin()
260 return Origin(Nonce(), tuple_); in DeriveNewOpaqueOrigin()
263 std::string Origin::GetDebugString(bool include_nonce) const { in GetDebugString()
291 Origin::Origin(SchemeHostPort tuple) : tuple_(std::move(tuple)) { in Origin() function in url::Origin
296 // Constructs an opaque origin derived from |precursor|.
297 Origin::Origin(const Nonce& nonce, SchemeHostPort precursor) in Origin() function in url::Origin
306 absl::optional<std::string> Origin::SerializeWithNonce() const { in SerializeWithNonce()
310 absl::optional<std::string> Origin::SerializeWithNonceAndInitIfNeeded() { in SerializeWithNonceAndInitIfNeeded()
319 absl::optional<std::string> Origin::SerializeWithNonceImpl() const { in SerializeWithNonceImpl()
341 absl::optional<Origin> Origin::Deserialize(const std::string& value) { in Deserialize()
353 // If only a tuple was serialized, then this origin is not opaque. For opaque in Deserialize()
362 // Possible successful early return if the pickled Origin was not opaque. in Deserialize()
364 Origin origin(tuple); in Deserialize() local
365 if (origin.opaque()) in Deserialize()
367 return origin; in Deserialize()
381 Origin::Nonce nonce; in Deserialize()
384 nonce = Origin::Nonce(nonce_token.value()); in Deserialize()
386 Origin origin; in Deserialize() local
387 origin.nonce_ = std::move(nonce); in Deserialize()
388 origin.tuple_ = tuple; in Deserialize()
389 return origin; in Deserialize()
392 void Origin::WriteIntoTrace(perfetto::TracedValue context) const { in WriteIntoTrace()
396 std::ostream& operator<<(std::ostream& out, const url::Origin& origin) { in operator <<() argument
397 out << origin.GetDebugString(); in operator <<()
401 std::ostream& operator<<(std::ostream& out, const url::Origin::Nonce& nonce) { in operator <<()
410 return Origin::Create(a).IsSameOriginWith(Origin::Create(b)); in IsSameOriginWith()
413 Origin::Nonce::Nonce() = default;
414 Origin::Nonce::Nonce(const base::UnguessableToken& token) : token_(token) { in Nonce()
418 const base::UnguessableToken& Origin::Nonce::token() const { in token()
427 const base::UnguessableToken& Origin::Nonce::raw_token() const { in raw_token()
432 Origin::Nonce::Nonce(const Origin::Nonce& other) : token_(other.token()) {} in Nonce()
434 Origin::Nonce& Origin::Nonce::operator=(const Origin::Nonce& other) { in operator =()
441 Origin::Nonce::Nonce(Origin::Nonce&& other) noexcept : token_(other.token_) { in Nonce()
445 Origin::Nonce& Origin::Nonce::operator=(Origin::Nonce&& other) noexcept { in operator =()
451 bool Origin::Nonce::operator<(const Origin::Nonce& other) const { in operator <()
457 bool Origin::Nonce::operator==(const Origin::Nonce& other) const { in operator ==()
464 bool Origin::Nonce::operator!=(const Origin::Nonce& other) const { in operator !=()
472 const url::Origin* value) in ScopedOriginCrashKey()