Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / components / domain_reliability / beacon.cc
blobf826a20344e5c4c3192dd4948e04094c023de7b2
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 #include "components/domain_reliability/beacon.h"
7 #include "base/values.h"
8 #include "net/base/net_errors.h"
10 namespace domain_reliability {
12 using base::Value;
13 using base::DictionaryValue;
15 DomainReliabilityBeacon::DomainReliabilityBeacon() {}
16 DomainReliabilityBeacon::~DomainReliabilityBeacon() {}
18 Value* DomainReliabilityBeacon::ToValue(base::TimeTicks upload_time) const {
19 DictionaryValue* beacon_value = new DictionaryValue();
20 beacon_value->SetString("status", status);
21 if (chrome_error != net::OK) {
22 DictionaryValue* failure_value = new DictionaryValue();
23 failure_value->SetString("custom_error",
24 net::ErrorToString(chrome_error));
25 beacon_value->Set("failure_data", failure_value);
27 beacon_value->SetString("server_ip", server_ip);
28 if (http_response_code >= 0)
29 beacon_value->SetInteger("http_response_code", http_response_code);
30 beacon_value->SetInteger("request_elapsed_ms",
31 elapsed.InMilliseconds());
32 beacon_value->SetInteger("request_age_ms",
33 (upload_time - start_time).InMilliseconds());
34 return beacon_value;
37 } // namespace domain_reliability