blob: 2ba54dc3e596ee7fdfb76f27a0815ef07f335f1c [file] [log] [blame]
Alex Chaud6eff3c2019-08-20 15:57:091// 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
9namespace gcm {
10
11void 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
19void LogSendWebPushMessagePayloadSize(int size) {
20 // Note: The maximum size accepted by FCM is 4096.
21 base::UmaHistogramCounts10000("GCM.SendWebPushMessagePayloadSize", size);
22}
23
Alex Chau36b830a2019-11-12 14:19:1524void LogSendWebPushMessageStatusCode(int status_code) {
25 base::UmaHistogramSparse("GCM.SendWebPushMessageStatusCode", status_code);
26}
27
Alex Chaud6eff3c2019-08-20 15:57:0928} // namespace gcm