OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "remoting/protocol/port_allocator.h" | 5 #include "remoting/protocol/port_allocator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
15 #include "net/http/http_status_code.h" | 15 #include "net/http/http_status_code.h" |
16 #include "net/traffic_annotation/network_traffic_annotation.h" | |
16 #include "remoting/protocol/network_settings.h" | 17 #include "remoting/protocol/network_settings.h" |
17 #include "remoting/protocol/transport_context.h" | 18 #include "remoting/protocol/transport_context.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 typedef std::map<std::string, std::string> StringMap; | 22 typedef std::map<std::string, std::string> StringMap; |
22 | 23 |
23 // Parses the lines in the result of the HTTP request that are of the form | 24 // Parses the lines in the result of the HTTP request that are of the form |
24 // 'a=b' and returns them in a map. | 25 // 'a=b' and returns them in a map. |
25 StringMap ParseMap(const std::string& string) { | 26 StringMap ParseMap(const std::string& string) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 std::string host = | 144 std::string host = |
144 ice_config_.relay_servers[attempts_ % ice_config_.relay_servers.size()]; | 145 ice_config_.relay_servers[attempts_ % ice_config_.relay_servers.size()]; |
145 attempts_++; | 146 attempts_++; |
146 | 147 |
147 DCHECK(!username().empty()); | 148 DCHECK(!username().empty()); |
148 DCHECK(!password().empty()); | 149 DCHECK(!password().empty()); |
149 std::string url = "https://" + host + "/create_session?username=" + | 150 std::string url = "https://" + host + "/create_session?username=" + |
150 net::EscapeUrlEncodedData(username(), false) + | 151 net::EscapeUrlEncodedData(username(), false) + |
151 "&password=" + | 152 "&password=" + |
152 net::EscapeUrlEncodedData(password(), false) + "&sn=1"; | 153 net::EscapeUrlEncodedData(password(), false) + "&sn=1"; |
154 net::NetworkTrafficAnnotationTag traffic_annotation = | |
155 net::DefineNetworkTrafficAnnotation("...", R"( | |
Sergey Ulanov
2017/03/17 18:59:33
"CRD Relay Session Request"
Ramin Halavati
2017/04/03 10:01:25
Done.
| |
156 semantics { | |
157 sender: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
Chrome Remote Desktop
Ramin Halavati
2017/04/03 10:01:26
Done.
| |
158 description: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
"Request used by Chrome Remote Desktop to allocate
Ramin Halavati
2017/04/03 10:01:26
Done.
| |
159 trigger: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
Chrome Remote Desktop usage.
Ramin Halavati
2017/04/03 10:01:25
Again, please elaborate if possible.
| |
160 data: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
Relay token (received over XMPP)
Ramin Halavati
2017/04/03 10:01:25
Please either elaborate here or in description. Th
Sergey Ulanov
2017/04/04 00:16:48
Maybe "A temporary authentication token issues by
Ramin Halavati
2017/04/04 07:37:18
Done.
| |
161 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER | |
Sergey Ulanov
2017/03/17 18:59:33
GOOGLE_OWNED_SERVICE
Ramin Halavati
2017/04/03 10:01:25
Done.
| |
162 } | |
163 policy { | |
164 cookies_allowed: false/true | |
Sergey Ulanov
2017/03/17 18:59:33
false
Ramin Halavati
2017/04/03 10:01:25
Again, cookies are not specifically disabled. Can
Sergey Ulanov
2017/04/04 00:16:47
Yes, please
Ramin Halavati
2017/04/04 07:37:18
Done, in https://codereview.chromium.org/279228300
| |
165 cookies_store: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
N/A
Ramin Halavati
2017/04/03 10:01:25
Acknowledged.
| |
166 setting: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
Block Chrome Remote Desktop (see
https://support.g
Ramin Halavati
2017/04/03 10:01:25
Done.
| |
167 chrome_policy { | |
168 [POLICY_NAME] { | |
Sergey Ulanov
2017/03/17 18:59:33
RemoteAccessHostFirewallTraversal
(only applicable
Ramin Halavati
2017/04/03 10:01:26
Done.
| |
169 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
170 [POLICY_NAME]: ... //(value to disable it) | |
Sergey Ulanov
2017/03/17 18:59:33
0, false
Ramin Halavati
2017/04/03 10:01:25
Done.
| |
171 } | |
172 } | |
173 policy_exception_justification: "..." | |
Sergey Ulanov
2017/03/17 18:59:33
The product is shipped separate from Chrome, excep
Ramin Halavati
2017/04/03 10:01:26
Done.
| |
174 })"); | |
153 std::unique_ptr<UrlRequest> url_request = | 175 std::unique_ptr<UrlRequest> url_request = |
154 transport_context_->url_request_factory()->CreateUrlRequest( | 176 transport_context_->url_request_factory()->CreateUrlRequest( |
155 UrlRequest::Type::GET, url); | 177 UrlRequest::Type::GET, url, traffic_annotation); |
156 url_request->AddHeader("X-Talk-Google-Relay-Auth: " + | 178 url_request->AddHeader("X-Talk-Google-Relay-Auth: " + |
157 ice_config_.relay_token); | 179 ice_config_.relay_token); |
158 url_request->AddHeader("X-Google-Relay-Auth: " + ice_config_.relay_token); | 180 url_request->AddHeader("X-Google-Relay-Auth: " + ice_config_.relay_token); |
159 url_request->AddHeader("X-Stream-Type: chromoting"); | 181 url_request->AddHeader("X-Stream-Type: chromoting"); |
160 url_request->Start(base::Bind(&PortAllocatorSession::OnSessionRequestResult, | 182 url_request->Start(base::Bind(&PortAllocatorSession::OnSessionRequestResult, |
161 base::Unretained(this))); | 183 base::Unretained(this))); |
162 url_requests_.insert(std::move(url_request)); | 184 url_requests_.insert(std::move(url_request)); |
163 } | 185 } |
164 | 186 |
165 void PortAllocatorSession::OnSessionRequestResult( | 187 void PortAllocatorSession::OnSessionRequestResult( |
(...skipping 27 matching lines...) Expand all Loading... | |
193 relay_config.ports.push_back( | 215 relay_config.ports.push_back( |
194 cricket::ProtocolAddress(address, cricket::PROTO_UDP)); | 216 cricket::ProtocolAddress(address, cricket::PROTO_UDP)); |
195 config->AddRelay(relay_config); | 217 config->AddRelay(relay_config); |
196 } | 218 } |
197 | 219 |
198 ConfigReady(config.release()); | 220 ConfigReady(config.release()); |
199 } | 221 } |
200 | 222 |
201 } // namespace protocol | 223 } // namespace protocol |
202 } // namespace remoting | 224 } // namespace remoting |
OLD | NEW |