Alex Chau | d6eff3c | 2019-08-20 15:57:09 | [diff] [blame] | 1 | // Copyright 2019 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. |
| 4 | |
| 5 | #include "components/gcm_driver/web_push_common.h" |
| 6 | |
| 7 | #include "base/metrics/histogram_functions.h" |
| 8 | |
| 9 | namespace gcm { |
| 10 | |
| 11 | void InvokeWebPushCallback(WebPushCallback callback, |
| 12 | SendWebPushMessageResult result, |
| 13 | base::Optional<std::string> message_id) { |
| 14 | DCHECK(message_id || result != SendWebPushMessageResult::kSuccessful); |
| 15 | base::UmaHistogramEnumeration("GCM.SendWebPushMessageResult", result); |
| 16 | std::move(callback).Run(result, std::move(message_id)); |
| 17 | } |
| 18 | |
| 19 | void LogSendWebPushMessagePayloadSize(int size) { |
| 20 | // Note: The maximum size accepted by FCM is 4096. |
| 21 | base::UmaHistogramCounts10000("GCM.SendWebPushMessagePayloadSize", size); |
| 22 | } |
| 23 | |
Alex Chau | 36b830a | 2019-11-12 14:19:15 | [diff] [blame] | 24 | void LogSendWebPushMessageStatusCode(int status_code) { |
| 25 | base::UmaHistogramSparse("GCM.SendWebPushMessageStatusCode", status_code); |
| 26 | } |
| 27 | |
Alex Chau | d6eff3c | 2019-08-20 15:57:09 | [diff] [blame] | 28 | } // namespace gcm |