| Index: content/renderer/manifest/manifest_uma_util.cc
|
| diff --git a/content/renderer/manifest/manifest_uma_util.cc b/content/renderer/manifest/manifest_uma_util.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..513c4d8648b60d025ab77016fe2cfa1a9cf5f1d9
|
| --- /dev/null
|
| +++ b/content/renderer/manifest/manifest_uma_util.cc
|
| @@ -0,0 +1,78 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/renderer/manifest/manifest_uma_util.h"
|
| +
|
| +#include "base/metrics/histogram.h"
|
| +#include "content/public/common/manifest.h"
|
| +
|
| +namespace content {
|
| +
|
| +namespace {
|
| +
|
| +static const char kUMANameParseSuccess[] = "Manifest.ParseSuccess";
|
| +static const char kUMANameFetchResult[] = "Manifest.FetchResult";
|
| +
|
| +// Enum for UMA purposes, make sure you update histograms.xml if you add new
|
| +// result types. Never delete or reorder an entry; only add new entries
|
| +// immediately before MANIFEST_FETCH_RESULT_TYPE_COUNT.
|
| +enum ManifestFetchResultType {
|
| + MANIFEST_FETCH_SUCCESS = 0,
|
| + MANIFEST_FETCH_ERROR_EMPTY_URL = 1,
|
| + MANIFEST_FETCH_ERROR_UNSPECIFIED = 2,
|
| +
|
| + // Must stay at the end.
|
| + MANIFEST_FETCH_RESULT_TYPE_COUNT
|
| +};
|
| +
|
| +} // anonymous namespace
|
| +
|
| +void ManifestUmaUtil::ParseSucceeded(const Manifest& manifest) {
|
| + UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true);
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty());
|
| + if (manifest.IsEmpty())
|
| + return;
|
| +
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.name", !manifest.name.is_null());
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.short_name",
|
| + !manifest.short_name.is_null());
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.start_url",
|
| + !manifest.start_url.is_empty());
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.display",
|
| + manifest.display != Manifest::DISPLAY_MODE_UNSPECIFIED);
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.orientation",
|
| + manifest.orientation != blink::WebScreenOrientationLockDefault);
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.icons", !manifest.icons.empty());
|
| + UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.gcm_sender_id",
|
| + !manifest.gcm_sender_id.is_null());
|
| +}
|
| +
|
| +void ManifestUmaUtil::ParseFailed() {
|
| + UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, false);
|
| +}
|
| +
|
| +void ManifestUmaUtil::FetchSucceeded() {
|
| + UMA_HISTOGRAM_ENUMERATION(kUMANameFetchResult,
|
| + MANIFEST_FETCH_SUCCESS,
|
| + MANIFEST_FETCH_RESULT_TYPE_COUNT);
|
| +}
|
| +
|
| +void ManifestUmaUtil::FetchFailed(FetchFailureReason reason) {
|
| + ManifestFetchResultType fetch_result_type = MANIFEST_FETCH_RESULT_TYPE_COUNT;
|
| + switch (reason) {
|
| + case FETCH_EMPTY_URL:
|
| + fetch_result_type = MANIFEST_FETCH_ERROR_EMPTY_URL;
|
| + break;
|
| + case FETCH_UNSPECIFIED_REASON:
|
| + fetch_result_type = MANIFEST_FETCH_ERROR_UNSPECIFIED;
|
| + break;
|
| + }
|
| + DCHECK_NE(fetch_result_type, MANIFEST_FETCH_RESULT_TYPE_COUNT);
|
| +
|
| + UMA_HISTOGRAM_ENUMERATION(kUMANameFetchResult,
|
| + fetch_result_type,
|
| + MANIFEST_FETCH_RESULT_TYPE_COUNT);
|
| +}
|
| +
|
| +} // namespace content
|
|
|