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

Side by Side Diff: remoting/protocol/http_ice_config_request.cc

Issue 2729423003: Network traffic annotation added to chromium_url_request. (Closed)
Patch Set: Annotation templates added. Created 3 years, 9 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
OLDNEW
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/http_ice_config_request.h" 5 #include "remoting/protocol/http_ice_config_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "net/base/url_util.h" 13 #include "net/base/url_util.h"
14 #include "net/traffic_annotation/network_traffic_annotation.h"
14 #include "remoting/protocol/ice_config.h" 15 #include "remoting/protocol/ice_config.h"
15 16
16 namespace remoting { 17 namespace remoting {
17 namespace protocol { 18 namespace protocol {
18 19
19 namespace { 20 namespace {
20 21
21 // Ensure ICE config is correct at least one hour after session starts. 22 // Ensure ICE config is correct at least one hour after session starts.
22 const int kMinimumConfigLifetimeSeconds = 3600; 23 const int kMinimumConfigLifetimeSeconds = 3600;
23 24
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 return true; 92 return true;
92 } 93 }
93 94
94 } // namespace 95 } // namespace
95 96
96 HttpIceConfigRequest::HttpIceConfigRequest( 97 HttpIceConfigRequest::HttpIceConfigRequest(
97 UrlRequestFactory* url_request_factory, 98 UrlRequestFactory* url_request_factory,
98 const std::string& url) 99 const std::string& url)
99 : url_(url) { 100 : url_(url) {
100 url_request_ = 101 net::NetworkTrafficAnnotationTag traffic_annotation =
101 url_request_factory->CreateUrlRequest(UrlRequest::Type::POST, url_); 102 net::DefineNetworkTrafficAnnotation("...", R"(
Sergey Ulanov 2017/03/17 18:59:32 "CRD ICE Config Request"
Ramin Halavati 2017/04/03 10:01:25 Done.
103 semantics {
104 sender: "..."
Sergey Ulanov 2017/03/17 18:59:33 Chrome Remote Desktop
Ramin Halavati 2017/04/03 10:01:25 Done.
105 description: "..."
Sergey Ulanov 2017/03/17 18:59:33 "Request used by Chrome Remote Desktop to fetch IC
Ramin Halavati 2017/04/03 10:01:25 Done.
106 trigger: "..."
Sergey Ulanov 2017/03/17 18:59:32 Chrome Remote Desktop usage.
Ramin Halavati 2017/04/03 10:01:25 Can it be more specific? Like on startup or every
Sergey Ulanov 2017/04/04 00:16:47 When a Chrome Remote Desktop session is being conn
Ramin Halavati 2017/04/04 07:37:18 Done.
107 data: "..."
Sergey Ulanov 2017/03/17 18:59:32 None
Ramin Halavati 2017/04/03 10:01:25 Done.
108 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
Sergey Ulanov 2017/03/17 18:59:32 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/04/03 10:01:25 Done.
109 }
110 policy {
111 cookies_allowed: false/true
Sergey Ulanov 2017/03/17 18:59:32 false
Ramin Halavati 2017/04/03 10:01:25 Again, cookies are not specifically disabled. Are
Sergey Ulanov 2017/04/04 00:16:47 They are not needed. Yes, please disable them.
Ramin Halavati 2017/04/04 07:37:18 Done, in https://codereview.chromium.org/279228300
112 cookies_store: "..."
Sergey Ulanov 2017/03/17 18:59:32 N/A
Ramin Halavati 2017/04/03 10:01:25 Acknowledged.
113 setting: "..."
Sergey Ulanov 2017/03/17 18:59:32 Block Chrome Remote Desktop (see https://support.g
Ramin Halavati 2017/04/03 10:01:25 Done.
114 chrome_policy {
115 [POLICY_NAME] {
Sergey Ulanov 2017/03/17 18:59:32 RemoteAccessHostFirewallTraversal (only applicable
Ramin Halavati 2017/04/03 10:01:25 Done.
116 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
Sergey Ulanov 2017/03/17 18:59:32 It's not clear to me what this means.
Ramin Halavati 2017/04/03 10:01:25 Acknowledged.
117 [POLICY_NAME]: ... //(value to disable it)
Sergey Ulanov 2017/03/17 18:59:32 0, false
Ramin Halavati 2017/04/03 10:01:25 Done.
118 }
119 }
120 policy_exception_justification: "..."
Sergey Ulanov 2017/03/17 18:59:32 The product is shipped separate from Chrome, excep
Ramin Halavati 2017/04/03 10:01:25 Done.
121 })");
122 url_request_ = url_request_factory->CreateUrlRequest(
123 UrlRequest::Type::POST, url_, traffic_annotation);
102 url_request_->SetPostData("application/json", ""); 124 url_request_->SetPostData("application/json", "");
103 } 125 }
104 126
105 HttpIceConfigRequest::~HttpIceConfigRequest() {} 127 HttpIceConfigRequest::~HttpIceConfigRequest() {}
106 128
107 void HttpIceConfigRequest::Send(const OnIceConfigCallback& callback) { 129 void HttpIceConfigRequest::Send(const OnIceConfigCallback& callback) {
108 DCHECK(on_ice_config_callback_.is_null()); 130 DCHECK(on_ice_config_callback_.is_null());
109 DCHECK(!callback.is_null()); 131 DCHECK(!callback.is_null());
110 132
111 on_ice_config_callback_ = callback; 133 on_ice_config_callback_ = callback;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (errors_found || ice_config.stun_servers.empty() || 224 if (errors_found || ice_config.stun_servers.empty() ||
203 ice_config.turn_servers.empty()) { 225 ice_config.turn_servers.empty()) {
204 ice_config.expiration_time = base::Time::Now(); 226 ice_config.expiration_time = base::Time::Now();
205 } 227 }
206 228
207 base::ResetAndReturn(&on_ice_config_callback_).Run(ice_config); 229 base::ResetAndReturn(&on_ice_config_callback_).Run(ice_config);
208 } 230 }
209 231
210 } // namespace protocol 232 } // namespace protocol
211 } // namespace remoting 233 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698