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/memory/scoped_vector.h" | |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "components/domain_reliability/domain_reliability_export.h" | 12 #include "components/domain_reliability/domain_reliability_export.h" |
13 #include "url/gurl.h" | |
12 | 14 |
13 namespace base { | 15 namespace base { |
14 class Value; | 16 class Value; |
15 } // namespace base | 17 } // namespace base |
16 | 18 |
17 namespace domain_reliability { | 19 namespace domain_reliability { |
18 | 20 |
19 // The per-request data that is uploaded to the Domain Reliability collector. | 21 // The per-request data that is uploaded to the Domain Reliability collector. |
20 struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon { | 22 struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon { |
21 public: | 23 public: |
22 DomainReliabilityBeacon(); | 24 DomainReliabilityBeacon(); |
23 ~DomainReliabilityBeacon(); | 25 ~DomainReliabilityBeacon(); |
24 | 26 |
27 struct DOMAIN_RELIABILITY_EXPORT ReportParams { | |
davidben
2015/10/20 23:35:54
Does this actually buy you anything over a four-ar
Deprecated (see juliatuttle)
2015/10/26 19:08:41
Done.
| |
28 public: | |
29 ReportParams(base::TimeTicks upload_time, | |
30 base::TimeTicks last_network_change_time, | |
31 const GURL& collector_url, | |
32 const ScopedVector<std::string>& path_prefixes); | |
33 | |
34 base::TimeTicks upload_time; | |
35 base::TimeTicks last_network_change_time; | |
36 const GURL& collector_url; | |
37 const ScopedVector<std::string>& path_prefixes; | |
38 }; | |
39 | |
25 // Converts the Beacon to JSON format for uploading. Calculates the age | 40 // Converts the Beacon to JSON format for uploading. Calculates the age |
26 // relative to an upload time of |upload_time|. | 41 // relative to an upload time of |upload_time|. |
27 base::Value* ToValue(base::TimeTicks upload_time, | 42 base::Value* ToValue(const ReportParams& report_params) const; |
davidben
2015/10/20 23:35:54
Existing code, but this would probably be better r
Deprecated (see juliatuttle)
2015/10/26 19:08:41
Done.
| |
28 base::TimeTicks last_network_change_time) const; | |
29 | 43 |
30 // The URL that the beacon is reporting on, if included. | 44 // The URL that the beacon is reporting on, if included. |
31 std::string url; | 45 GURL url; |
32 // The domain that the beacon is reporting on, if included. | |
33 std::string domain; | |
34 // The resource name that the beacon is reporting on, if included. | 46 // The resource name that the beacon is reporting on, if included. |
35 std::string resource; | 47 std::string resource; |
36 // Status string (e.g. "ok", "dns.nxdomain", "http.403"). | 48 // Status string (e.g. "ok", "dns.nxdomain", "http.403"). |
37 std::string status; | 49 std::string status; |
38 // Net error code. Encoded as a string in the final JSON. | 50 // Net error code. Encoded as a string in the final JSON. |
39 int chrome_error; | 51 int chrome_error; |
40 // IP address of the server the request went to. | 52 // IP address of the server the request went to. |
41 std::string server_ip; | 53 std::string server_ip; |
42 // Whether the request went through a proxy. If true, |server_ip| will be | 54 // Whether the request went through a proxy. If true, |server_ip| will be |
43 // empty. | 55 // empty. |
44 bool was_proxied; | 56 bool was_proxied; |
45 // Protocol used to make the request. | 57 // Protocol used to make the request. |
46 std::string protocol; | 58 std::string protocol; |
47 // HTTP response code returned by the server, or -1 if none was received. | 59 // HTTP response code returned by the server, or -1 if none was received. |
48 int http_response_code; | 60 int http_response_code; |
49 // Elapsed time between starting and completing the request. | 61 // Elapsed time between starting and completing the request. |
50 base::TimeDelta elapsed; | 62 base::TimeDelta elapsed; |
51 // Start time of the request. Encoded as the request age in the final JSON. | 63 // Start time of the request. Encoded as the request age in the final JSON. |
52 base::TimeTicks start_time; | 64 base::TimeTicks start_time; |
53 | 65 |
54 // Okay to copy and assign. | 66 // Okay to copy and assign. |
55 }; | 67 }; |
56 | 68 |
57 } // namespace domain_reliability | 69 } // namespace domain_reliability |
58 | 70 |
59 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ | 71 #endif // COMPONENTS_DOMAIN_RELIABILITY_BEACON_H_ |
OLD | NEW |