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

Side by Side Diff: url/scheme_host_port.h

Issue 2391383003: Add Origin::CreateFromNormalizedTuple and call from WebSecurityOrigin (Closed)
Patch Set: git cl format Created 4 years, 2 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 | « url/origin.cc ('k') | url/scheme_host_port.cc » ('j') | 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_SCHEME_HOST_PORT_H_ 5 #ifndef URL_SCHEME_HOST_PORT_H_
6 #define URL_SCHEME_HOST_PORT_H_ 6 #define URL_SCHEME_HOST_PORT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Creates a (scheme, host, port) tuple. |host| must be a canonicalized 81 // Creates a (scheme, host, port) tuple. |host| must be a canonicalized
82 // A-label (that is, '☃.net' must be provided as 'xn--n3h.net'). |scheme| 82 // A-label (that is, '☃.net' must be provided as 'xn--n3h.net'). |scheme|
83 // must be a standard scheme. |port| must not be 0, unless |scheme| does not 83 // must be a standard scheme. |port| must not be 0, unless |scheme| does not
84 // support ports (e.g. 'file'). In that case, |port| must be 0. 84 // support ports (e.g. 'file'). In that case, |port| must be 0.
85 // 85 //
86 // Copies the data in |scheme| and |host|. 86 // Copies the data in |scheme| and |host|.
87 SchemeHostPort(base::StringPiece scheme, 87 SchemeHostPort(base::StringPiece scheme,
88 base::StringPiece host, 88 base::StringPiece host,
89 uint16_t port); 89 uint16_t port);
90 90
91 // Metadata influencing whether or not the constructor should sanity check
92 // host canonicalization.
93 enum ConstructPolicy { CHECK_CANONICALIZATION, ALREADY_CANONICALIZED };
94
95 // Creates a (scheme, host, port) tuple without performing sanity checking
96 // that the host and port are canonicalized. This should only be used when
97 // converting between already normalized types, and should NOT be used for
98 // IPC.
99 SchemeHostPort(base::StringPiece scheme,
100 base::StringPiece host,
101 uint16_t port,
102 ConstructPolicy policy);
103
91 // Creates a (scheme, host, port) tuple from |url|, as described at 104 // Creates a (scheme, host, port) tuple from |url|, as described at
92 // https://tools.ietf.org/html/rfc6454#section-4 105 // https://tools.ietf.org/html/rfc6454#section-4
93 // 106 //
94 // If |url| is invalid or non-standard, the result will be an invalid 107 // If |url| is invalid or non-standard, the result will be an invalid
95 // SchemeHostPort object. 108 // SchemeHostPort object.
96 explicit SchemeHostPort(const GURL& url); 109 explicit SchemeHostPort(const GURL& url);
97 110
98 ~SchemeHostPort(); 111 ~SchemeHostPort();
99 112
100 // Returns the host component, in URL form. That is all IDN domain names will 113 // Returns the host component, in URL form. That is all IDN domain names will
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 std::string SerializeInternal(url::Parsed* parsed) const; 146 std::string SerializeInternal(url::Parsed* parsed) const;
134 147
135 std::string scheme_; 148 std::string scheme_;
136 std::string host_; 149 std::string host_;
137 uint16_t port_; 150 uint16_t port_;
138 }; 151 };
139 152
140 } // namespace url 153 } // namespace url
141 154
142 #endif // URL_SCHEME_HOST_PORT_H_ 155 #endif // URL_SCHEME_HOST_PORT_H_
OLDNEW
« no previous file with comments | « url/origin.cc ('k') | url/scheme_host_port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698