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

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 updated. Created 3 years, 7 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("CRD_ice_config_request", R"(
103 semantics {
104 sender: "Chrome Remote Desktop"
105 description:
106 "Request is used by Chrome Remote Desktop to fetch ICE "
107 "configuration which contains list of STUN & TURN servers and TURN "
108 "credentials."
109 trigger:
110 "When a Chrome Remote Desktop session is being connected and "
111 "periodically while a session is active, as necessary. Currently "
112 "the API issues credentials that expire every 24 hours, so this "
113 "request will only be sent again while session is active more than "
114 "24 hours and it needs to renegotiate the ICE connection. The 24 "
115 "hour period is controlled by the server and may change. In some "
116 "cases, e.g. if direct connection is used, it will not trigger "
117 "periodically.
118 data: "None."
119 destination: GOOGLE_OWNED_SERVICE
120 }
121 policy {
122 cookies_allowed: false
123 setting:
124 "This feature cannot be disabled by settings. You can block Chrome "
125 "Remote Desktop as specified here: "
126 "https://support.google.com/chrome/?p=remote_desktop"
127 chrome_policy {
128 RemoteAccessHostFirewallTraversal {
129 policy_options {mode: MANDATORY}
130 RemoteAccessHostFirewallTraversal: false
131 }
132 }
133 policy_exception_justification:
134 "Above specified policy is only applicable on the host side and "
135 "doesn't have effect in Android and iOS client apps. The product "
136 "is shipped separately from Chromium, except on Chrome OS."
137 })");
138 url_request_ = url_request_factory->CreateUrlRequest(
139 UrlRequest::Type::POST, url_, traffic_annotation);
102 url_request_->SetPostData("application/json", ""); 140 url_request_->SetPostData("application/json", "");
103 } 141 }
104 142
105 HttpIceConfigRequest::~HttpIceConfigRequest() {} 143 HttpIceConfigRequest::~HttpIceConfigRequest() {}
106 144
107 void HttpIceConfigRequest::Send(const OnIceConfigCallback& callback) { 145 void HttpIceConfigRequest::Send(const OnIceConfigCallback& callback) {
108 DCHECK(on_ice_config_callback_.is_null()); 146 DCHECK(on_ice_config_callback_.is_null());
109 DCHECK(!callback.is_null()); 147 DCHECK(!callback.is_null());
110 148
111 on_ice_config_callback_ = callback; 149 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() || 240 if (errors_found || ice_config.stun_servers.empty() ||
203 ice_config.turn_servers.empty()) { 241 ice_config.turn_servers.empty()) {
204 ice_config.expiration_time = base::Time::Now(); 242 ice_config.expiration_time = base::Time::Now();
205 } 243 }
206 244
207 base::ResetAndReturn(&on_ice_config_callback_).Run(ice_config); 245 base::ResetAndReturn(&on_ice_config_callback_).Run(ice_config);
208 } 246 }
209 247
210 } // namespace protocol 248 } // namespace protocol
211 } // namespace remoting 249 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_url_request.cc ('k') | remoting/protocol/http_ice_config_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698