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/instance_id_delete_token_request_handler.h" | 5 #include "google_apis/gcm/engine/instance_id_delete_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_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
10 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
11 | 12 |
12 namespace gcm { | 13 namespace gcm { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Request constants. | 17 // Request constants. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 DVLOG(1) << "Failed to get response body."; | 60 DVLOG(1) << "Failed to get response body."; |
60 return UnregistrationRequest::NO_RESPONSE_BODY; | 61 return UnregistrationRequest::NO_RESPONSE_BODY; |
61 } | 62 } |
62 | 63 |
63 if (response.find(kTokenPrefix) == std::string::npos) | 64 if (response.find(kTokenPrefix) == std::string::npos) |
64 return UnregistrationRequest::RESPONSE_PARSING_FAILED; | 65 return UnregistrationRequest::RESPONSE_PARSING_FAILED; |
65 | 66 |
66 return UnregistrationRequest::SUCCESS; | 67 return UnregistrationRequest::SUCCESS; |
67 } | 68 } |
68 | 69 |
| 70 void InstanceIDDeleteTokenRequestHandler::ReportUMAs( |
| 71 UnregistrationRequest::Status status, |
| 72 int retry_count, |
| 73 base::TimeDelta complete_time) { |
| 74 UMA_HISTOGRAM_ENUMERATION("InstanceID.DeleteTokenRequestStatus", |
| 75 status, |
| 76 UnregistrationRequest::UNREGISTRATION_STATUS_COUNT); |
| 77 |
| 78 // Other UMAs are only reported when the request succeeds. |
| 79 if (status != UnregistrationRequest::SUCCESS) |
| 80 return; |
| 81 |
| 82 UMA_HISTOGRAM_COUNTS("InstanceID.DeleteTokenRetryCount", retry_count); |
| 83 UMA_HISTOGRAM_TIMES("InstanceID.DeleteTokenCompleteTime", complete_time); |
| 84 } |
| 85 |
69 } // namespace gcm | 86 } // namespace gcm |
OLD | NEW |