Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / domain_reliability / beacon.h
blob9e9dfb20b9e917cd13d9d9d9f8645bd0bedca6d7
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_
8 #include <string>
10 #include "base/time/time.h"
11 #include "components/domain_reliability/domain_reliability_export.h"
13 namespace base {
14 class Value;
15 } // namespace base
17 namespace domain_reliability {
19 // The per-request data that is uploaded to the Domain Reliability collector.
20 struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon {
21 public:
22 DomainReliabilityBeacon();
23 ~DomainReliabilityBeacon();
25 // Converts the Beacon to JSON format for uploading. Calculates the age
26 // relative to an upload time of |upload_time|.
27 base::Value* ToValue(base::TimeTicks upload_time) const;
29 // The URL that the beacon is reporting on, if included.
30 std::string url;
31 // The resource name that the beacon is reporting on, if included.
32 std::string resource;
33 // Status string (e.g. "ok", "dns.nxdomain", "http.403").
34 std::string status;
35 // Net error code. Encoded as a string in the final JSON.
36 int chrome_error;
37 // IP address of the server the request went to.
38 std::string server_ip;
39 // Protocol used to make the request.
40 std::string protocol;
41 // HTTP response code returned by the server, or -1 if none was received.
42 int http_response_code;
43 // Elapsed time between starting and completing the request.
44 base::TimeDelta elapsed;
45 // Start time of the request. Encoded as the request age in the final JSON.
46 base::TimeTicks start_time;
48 // Okay to copy and assign.
51 } // namespace domain_reliability
53 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_