| 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_unregistration_request_handler.h" | 5 #include "google_apis/gcm/engine/gcm_unregistration_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 #include "net/url_request/url_fetcher.h" | 9 #include "net/url_request/url_fetcher.h" |
| 9 | 10 |
| 10 namespace gcm { | 11 namespace gcm { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 // Request constants. | 15 // Request constants. |
| 15 const char kUnregistrationCallerKey[] = "gcm_unreg_caller"; | 16 const char kUnregistrationCallerKey[] = "gcm_unreg_caller"; |
| 16 // We are going to set the value to "false" in order to forcefully unregister | 17 // We are going to set the value to "false" in order to forcefully unregister |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return error == kInvalidParameters ? | 59 return error == kInvalidParameters ? |
| 59 UnregistrationRequest::INVALID_PARAMETERS : | 60 UnregistrationRequest::INVALID_PARAMETERS : |
| 60 UnregistrationRequest::UNKNOWN_ERROR; | 61 UnregistrationRequest::UNKNOWN_ERROR; |
| 61 } | 62 } |
| 62 | 63 |
| 63 DVLOG(1) << "Not able to parse a meaningful output from response body." | 64 DVLOG(1) << "Not able to parse a meaningful output from response body." |
| 64 << response; | 65 << response; |
| 65 return UnregistrationRequest::RESPONSE_PARSING_FAILED; | 66 return UnregistrationRequest::RESPONSE_PARSING_FAILED; |
| 66 } | 67 } |
| 67 | 68 |
| 69 void GCMUnregistrationRequestHandler::ReportUMAs( |
| 70 UnregistrationRequest::Status status, |
| 71 int retry_count, |
| 72 base::TimeDelta complete_time) { |
| 73 UMA_HISTOGRAM_ENUMERATION("GCM.UnregistrationRequestStatus", |
| 74 status, |
| 75 UnregistrationRequest::UNREGISTRATION_STATUS_COUNT); |
| 76 |
| 77 // Other UMAs are only reported when the request succeeds. |
| 78 if (status != UnregistrationRequest::SUCCESS) |
| 79 return; |
| 80 |
| 81 UMA_HISTOGRAM_COUNTS("GCM.UnregistrationRetryCount", retry_count); |
| 82 UMA_HISTOGRAM_TIMES("GCM.UnregistrationCompleteTime", complete_time); |
| 83 } |
| 84 |
| 68 } // namespace gcm | 85 } // namespace gcm |
| OLD | NEW |