Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: url/origin.h

Issue 1656933003: Add origins argument to registerForeignFetchScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add url::Origin::operator== to make tests simpler Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef URL_ORIGIN_H_ 5 #ifndef URL_ORIGIN_H_
6 #define URL_ORIGIN_H_ 6 #define URL_ORIGIN_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 bool unique() const { return unique_; } 112 bool unique() const { return unique_; }
113 113
114 // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with 114 // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with
115 // the addition that all Origins with a 'file' scheme serialize to "file://". 115 // the addition that all Origins with a 'file' scheme serialize to "file://".
116 std::string Serialize() const; 116 std::string Serialize() const;
117 117
118 // Two Origins are "same-origin" if their schemes, hosts, and ports are exact 118 // Two Origins are "same-origin" if their schemes, hosts, and ports are exact
119 // matches; and neither is unique. 119 // matches; and neither is unique.
120 bool IsSameOriginWith(const Origin& other) const; 120 bool IsSameOriginWith(const Origin& other) const;
121 bool operator==(const Origin& other) const {
122 return IsSameOriginWith(other);
123 }
121 124
122 // Allows Origin to be used as a key in STL (for example, a std::set or 125 // Allows Origin to be used as a key in STL (for example, a std::set or
123 // std::map). 126 // std::map).
124 bool operator<(const Origin& other) const; 127 bool operator<(const Origin& other) const;
125 128
126 private: 129 private:
127 Origin(base::StringPiece scheme, base::StringPiece host, uint16_t port); 130 Origin(base::StringPiece scheme, base::StringPiece host, uint16_t port);
128 131
129 SchemeHostPort tuple_; 132 SchemeHostPort tuple_;
130 bool unique_; 133 bool unique_;
131 }; 134 };
132 135
133 URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin); 136 URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin);
134 137
135 URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b); 138 URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b);
136 139
137 } // namespace url 140 } // namespace url
138 141
139 #endif // URL_ORIGIN_H_ 142 #endif // URL_ORIGIN_H_
OLDNEW
« no previous file with comments | « third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698