| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gcm_registration_request_handler.h" | 5 #include "google_apis/gcm/engine/gcm_registration_request_handler.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" |
| 7 #include "google_apis/gcm/base/gcm_util.h" | 8 #include "google_apis/gcm/base/gcm_util.h" |
| 8 | 9 |
| 9 namespace gcm { | 10 namespace gcm { |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 // Request constants. | 14 // Request constants. |
| 14 const char kSenderKey[] = "sender"; | 15 const char kSenderKey[] = "sender"; |
| 15 | 16 |
| 16 } // namespace | 17 } // namespace |
| 17 | 18 |
| 18 GCMRegistrationRequestHandler::GCMRegistrationRequestHandler( | 19 GCMRegistrationRequestHandler::GCMRegistrationRequestHandler( |
| 19 const std::string& senders) | 20 const std::string& senders) |
| 20 : senders_(senders) { | 21 : senders_(senders) { |
| 21 } | 22 } |
| 22 | 23 |
| 23 GCMRegistrationRequestHandler::~GCMRegistrationRequestHandler() {} | 24 GCMRegistrationRequestHandler::~GCMRegistrationRequestHandler() {} |
| 24 | 25 |
| 25 void GCMRegistrationRequestHandler::BuildRequestBody(std::string* body){ | 26 void GCMRegistrationRequestHandler::BuildRequestBody(std::string* body){ |
| 26 BuildFormEncoding(kSenderKey, senders_, body); | 27 BuildFormEncoding(kSenderKey, senders_, body); |
| 27 } | 28 } |
| 28 | 29 |
| 30 void GCMRegistrationRequestHandler::ReportUMAs( |
| 31 RegistrationRequest::Status status, |
| 32 int retry_count, |
| 33 base::TimeDelta complete_time) { |
| 34 UMA_HISTOGRAM_ENUMERATION("GCM.RegistrationRequestStatus", |
| 35 status, |
| 36 RegistrationRequest::STATUS_COUNT); |
| 37 |
| 38 // Other UMAs are only reported when the request succeeds. |
| 39 if (status != RegistrationRequest::SUCCESS) |
| 40 return; |
| 41 |
| 42 UMA_HISTOGRAM_COUNTS("GCM.RegistrationRetryCount", retry_count); |
| 43 UMA_HISTOGRAM_TIMES("GCM.RegistrationCompleteTime", complete_time); |
| 44 } |
| 45 |
| 29 } // namespace gcm | 46 } // namespace gcm |
| OLD | NEW |