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

Side by Side Diff: components/certificate_reporting/error_report.cc

Issue 2964283002: Add chrome channel to cert logger reports (Closed)
Patch Set: Clean up test comments Created 3 years, 5 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 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 #include "components/certificate_reporting/error_report.h" 5 #include "components/certificate_reporting/error_report.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "components/certificate_reporting/cert_logger.pb.h" 12 #include "components/certificate_reporting/cert_logger.pb.h"
13 #include "components/network_time/network_time_tracker.h" 13 #include "components/network_time/network_time_tracker.h"
14 #include "components/version_info/version_info.h"
14 #include "net/cert/cert_status_flags.h" 15 #include "net/cert/cert_status_flags.h"
15 #include "net/cert/x509_certificate.h" 16 #include "net/cert/x509_certificate.h"
16 #include "net/ssl/ssl_info.h" 17 #include "net/ssl/ssl_info.h"
17 18
18 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
19 #include "net/cert/cert_verify_proc_android.h" 20 #include "net/cert/cert_verify_proc_android.h"
20 #endif 21 #endif
21 22
22 using network_time::NetworkTimeTracker; 23 using network_time::NetworkTimeTracker;
23 24
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 NETWORK_TIME_FETCHES_ON_DEMAND_ONLY; 168 NETWORK_TIME_FETCHES_ON_DEMAND_ONLY;
168 break; 169 break;
169 case NetworkTimeTracker::FETCHES_IN_BACKGROUND_AND_ON_DEMAND: 170 case NetworkTimeTracker::FETCHES_IN_BACKGROUND_AND_ON_DEMAND:
170 report_behavior = CertLoggerFeaturesInfo::NetworkTimeQueryingInfo:: 171 report_behavior = CertLoggerFeaturesInfo::NetworkTimeQueryingInfo::
171 NETWORK_TIME_FETCHES_IN_BACKGROUND_AND_ON_DEMAND; 172 NETWORK_TIME_FETCHES_IN_BACKGROUND_AND_ON_DEMAND;
172 break; 173 break;
173 } 174 }
174 network_time_info->set_network_time_query_behavior(report_behavior); 175 network_time_info->set_network_time_query_behavior(report_behavior);
175 } 176 }
176 177
178 void ErrorReport::AddChromeChannel(const version_info::Channel channel) {
179 CertLoggerRequest::ChromeChannel code;
180 switch (channel) {
181 case version_info::Channel::STABLE:
182 code = CertLoggerRequest::STABLE;
meacer 2017/06/30 22:24:46 Don't forget "break;"s after each case :)
sperigo 2017/06/30 23:37:27 Done.
sperigo 2017/06/30 23:37:27 Oh no! I'm embarrassed. Good catch.
183
184 case version_info::Channel::BETA:
185 code = CertLoggerRequest::BETA;
186
187 case version_info::Channel::CANARY:
188 code = CertLoggerRequest::CANARY;
189
190 case version_info::Channel::DEV:
191 code = CertLoggerRequest::DEV;
192
193 case version_info::Channel::UNKNOWN:
194 code = CertLoggerRequest::UNKNOWN;
195
196 default:
197 code = CertLoggerRequest::NONE;
198 }
199 cert_report_->set_chrome_channel(code);
200 }
201
177 void ErrorReport::SetIsRetryUpload(bool is_retry_upload) { 202 void ErrorReport::SetIsRetryUpload(bool is_retry_upload) {
178 cert_report_->set_is_retry_upload(is_retry_upload); 203 cert_report_->set_is_retry_upload(is_retry_upload);
179 } 204 }
180 205
181 const std::string& ErrorReport::hostname() const { 206 const std::string& ErrorReport::hostname() const {
182 return cert_report_->hostname(); 207 return cert_report_->hostname();
183 } 208 }
184 209
185 bool ErrorReport::is_retry_upload() const { 210 bool ErrorReport::is_retry_upload() const {
186 return cert_report_->is_retry_upload(); 211 return cert_report_->is_retry_upload();
187 } 212 }
188 213
189 } // namespace certificate_reporting 214 } // namespace certificate_reporting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698