| 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 #include "components/domain_reliability/beacon.h" | 5 #include "components/domain_reliability/beacon.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 | 9 |
| 10 namespace domain_reliability { | 10 namespace domain_reliability { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (!resource.empty()) | 26 if (!resource.empty()) |
| 27 beacon_value->SetString("resource", resource); | 27 beacon_value->SetString("resource", resource); |
| 28 beacon_value->SetString("status", status); | 28 beacon_value->SetString("status", status); |
| 29 if (chrome_error != net::OK) { | 29 if (chrome_error != net::OK) { |
| 30 DictionaryValue* failure_value = new DictionaryValue(); | 30 DictionaryValue* failure_value = new DictionaryValue(); |
| 31 failure_value->SetString("custom_error", | 31 failure_value->SetString("custom_error", |
| 32 net::ErrorToString(chrome_error)); | 32 net::ErrorToString(chrome_error)); |
| 33 beacon_value->Set("failure_data", failure_value); | 33 beacon_value->Set("failure_data", failure_value); |
| 34 } | 34 } |
| 35 beacon_value->SetString("server_ip", server_ip); | 35 beacon_value->SetString("server_ip", server_ip); |
| 36 beacon_value->SetBoolean("was_proxied", was_proxied); |
| 36 beacon_value->SetString("protocol", protocol); | 37 beacon_value->SetString("protocol", protocol); |
| 37 if (http_response_code >= 0) | 38 if (http_response_code >= 0) |
| 38 beacon_value->SetInteger("http_response_code", http_response_code); | 39 beacon_value->SetInteger("http_response_code", http_response_code); |
| 39 beacon_value->SetInteger("request_elapsed_ms", | 40 beacon_value->SetInteger("request_elapsed_ms", |
| 40 elapsed.InMilliseconds()); | 41 elapsed.InMilliseconds()); |
| 41 beacon_value->SetInteger("request_age_ms", | 42 beacon_value->SetInteger("request_age_ms", |
| 42 (upload_time - start_time).InMilliseconds()); | 43 (upload_time - start_time).InMilliseconds()); |
| 43 bool network_changed = last_network_change_time > start_time; | 44 bool network_changed = last_network_change_time > start_time; |
| 44 beacon_value->SetBoolean("network_changed", network_changed); | 45 beacon_value->SetBoolean("network_changed", network_changed); |
| 45 return beacon_value; | 46 return beacon_value; |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace domain_reliability | 49 } // namespace domain_reliability |
| OLD | NEW |