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 "google_apis/gcm/engine/instance_id_get_token_request_handler.h" | 5 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | |
7 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
8 #include "google_apis/gcm/base/gcm_util.h" | 9 #include "google_apis/gcm/base/gcm_util.h" |
9 #include "net/url_request/url_request_context_getter.h" | 10 #include "net/url_request/url_request_context_getter.h" |
10 | 11 |
11 namespace gcm { | 12 namespace gcm { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // Request constants. | 16 // Request constants. |
16 const char kAuthorizedEntityKey[] = "sender"; | 17 const char kAuthorizedEntityKey[] = "sender"; |
(...skipping 29 matching lines...) Expand all Loading... | |
46 for (auto iter = options_.begin(); iter != options_.end(); ++iter) | 47 for (auto iter = options_.begin(); iter != options_.end(); ++iter) |
47 BuildFormEncoding(kOptionKeyPrefix + iter->first, iter->second, body); | 48 BuildFormEncoding(kOptionKeyPrefix + iter->first, iter->second, body); |
48 BuildFormEncoding(kGMSVersionKey, base::IntToString(gcm_version_), body); | 49 BuildFormEncoding(kGMSVersionKey, base::IntToString(gcm_version_), body); |
49 BuildFormEncoding(kInstanceIDKey, instance_id_, body); | 50 BuildFormEncoding(kInstanceIDKey, instance_id_, body); |
50 BuildFormEncoding(kAuthorizedEntityKey, authorized_entity_, body); | 51 BuildFormEncoding(kAuthorizedEntityKey, authorized_entity_, body); |
51 // TODO(jianli): To work around server bug. To be removed when the server fix | 52 // TODO(jianli): To work around server bug. To be removed when the server fix |
52 // is deployed. | 53 // is deployed. |
53 BuildFormEncoding(kSubtypeKey, authorized_entity_, body); | 54 BuildFormEncoding(kSubtypeKey, authorized_entity_, body); |
54 } | 55 } |
55 | 56 |
57 void InstanceIDGetTokenRequestHandler::ReportUMAs( | |
58 RegistrationRequest::Status status, | |
59 int retry_count, | |
60 base::TimeDelta complete_time) { | |
61 UMA_HISTOGRAM_ENUMERATION("InstanceID.GetTokenRequestStatus", | |
62 status, | |
63 RegistrationRequest::STATUS_COUNT); | |
64 | |
65 // Other UMAs are only reported when the request succeeds. | |
66 if (status != RegistrationRequest::SUCCESS) | |
67 return; | |
68 | |
69 UMA_HISTOGRAM_COUNTS("InstanceID.GetTokenRetryCount", retry_count); | |
70 UMA_HISTOGRAM_TIMES("InstanceID.GetTokenCompleteTime", complete_time); | |
Alexei Svitkine (slow)
2015/06/04 18:59:32
Nit: Suggest putting an extra delimiter in all of
jianli
2015/06/04 20:50:22
Done.
| |
71 } | |
72 | |
56 } // namespace gcm | 73 } // namespace gcm |
OLD | NEW |