OLD | NEW |
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/domain_reliability/header.h" | 5 #include "components/domain_reliability/header.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 std::string DomainReliabilityHeader::ToString() const { | 279 std::string DomainReliabilityHeader::ToString() const { |
280 std::string string = ""; | 280 std::string string = ""; |
281 int64_t max_age_s = max_age_.InSeconds(); | 281 int64_t max_age_s = max_age_.InSeconds(); |
282 | 282 |
283 if (config_->collectors.empty()) { | 283 if (config_->collectors.empty()) { |
284 DCHECK_EQ(0, max_age_s); | 284 DCHECK_EQ(0, max_age_s); |
285 } else { | 285 } else { |
286 string += "report-uri="; | 286 string += "report-uri="; |
287 for (const auto& uri : config_->collectors) | 287 for (const auto* uri : config_->collectors) |
288 string += uri->spec() + " "; | 288 string += uri->spec() + " "; |
289 // Remove trailing space. | 289 // Remove trailing space. |
290 string.erase(string.length() - 1, 1); | 290 string.erase(string.length() - 1, 1); |
291 string += "; "; | 291 string += "; "; |
292 } | 292 } |
293 | 293 |
294 string += "max-age=" + base::Int64ToString(max_age_s) + "; "; | 294 string += "max-age=" + base::Int64ToString(max_age_s) + "; "; |
295 | 295 |
296 if (config_->include_subdomains) | 296 if (config_->include_subdomains) |
297 string += "includeSubdomains; "; | 297 string += "includeSubdomains; "; |
(...skipping 13 matching lines...) Expand all Loading... |
311 ParseStatus status, | 311 ParseStatus status, |
312 std::unique_ptr<DomainReliabilityConfig> config, | 312 std::unique_ptr<DomainReliabilityConfig> config, |
313 base::TimeDelta max_age) | 313 base::TimeDelta max_age) |
314 : status_(status), config_(std::move(config)), max_age_(max_age) { | 314 : status_(status), config_(std::move(config)), max_age_(max_age) { |
315 DCHECK_EQ(PARSE_SET_CONFIG, status_); | 315 DCHECK_EQ(PARSE_SET_CONFIG, status_); |
316 DCHECK(config_.get()); | 316 DCHECK(config_.get()); |
317 DCHECK_NE(0, max_age_.InMicroseconds()); | 317 DCHECK_NE(0, max_age_.InMicroseconds()); |
318 } | 318 } |
319 | 319 |
320 } // namespace domain_reliability | 320 } // namespace domain_reliability |
OLD | NEW |