| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ |
| 6 #define COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "components/domain_reliability/domain_reliability_export.h" | 11 #include "components/domain_reliability/domain_reliability_export.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class Value; | 14 class Value; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 namespace domain_reliability { | 17 namespace domain_reliability { |
| 18 | 18 |
| 19 // The per-request data that is uploaded to the Domain Reliability collector. | 19 // The per-request data that is uploaded to the Domain Reliability collector. |
| 20 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon { | 20 struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon { |
| 21 public: | 21 public: |
| 22 DomainReliabilityBeacon(); | 22 DomainReliabilityBeacon(); |
| 23 ~DomainReliabilityBeacon(); | 23 ~DomainReliabilityBeacon(); |
| 24 | 24 |
| 25 // Converts the Beacon to JSON format for uploading. Calculates the age | 25 // Converts the Beacon to JSON format for uploading. Calculates the age |
| 26 // relative to an upload time of |upload_time|. | 26 // relative to an upload time of |upload_time|. |
| 27 base::Value* ToValue(base::TimeTicks upload_time) const; | 27 base::Value* ToValue(base::TimeTicks upload_time) const; |
| 28 | 28 |
| 29 // Status string (e.g. "ok", "dns.nxdomain", "http.403"). | 29 // Status string (e.g. "ok", "dns.nxdomain", "http.403"). |
| 30 std::string status; | 30 std::string status; |
| 31 // Net error code. Encoded as a string in the final JSON. | 31 // Net error code. Encoded as a string in the final JSON. |
| 32 int chrome_error; | 32 int chrome_error; |
| 33 // IP address of the server the request went to. | 33 // IP address of the server the request went to. |
| 34 std::string server_ip; | 34 std::string server_ip; |
| 35 // HTTP response code returned by the server, or -1 if none was received. | 35 // HTTP response code returned by the server, or -1 if none was received. |
| 36 int http_response_code; | 36 int http_response_code; |
| 37 // Elapsed time between starting and completing the request. | 37 // Elapsed time between starting and completing the request. |
| 38 base::TimeDelta elapsed; | 38 base::TimeDelta elapsed; |
| 39 // Start time of the request. Encoded as the request age in the final JSON. | 39 // Start time of the request. Encoded as the request age in the final JSON. |
| 40 base::TimeTicks start_time; | 40 base::TimeTicks start_time; |
| 41 | 41 |
| 42 // Okay to copy and assign :) | 42 // Okay to copy and assign. |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace domain_reliability | 45 } // namespace domain_reliability |
| 46 | 46 |
| 47 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ | 47 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ |
| OLD | NEW |