Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsUma.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsUma.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsUma.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7eb2c49ba92cdaa0ea0564c8e09e229c17d92713 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/ContentSuggestionsUma.java |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2017 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. |
| + |
| +package org.chromium.chrome.browser.suggestions; |
| + |
| +import android.annotation.IntDef; |
| + |
| +import org.chromium.base.metrics.RecordHistogram; |
| + |
| +import java.lang.annotation.Retention; |
| +import java.lang.annotation.RetentionPolicy; |
| + |
| +/** |
| + * Centralises the UMA recording related to content suggestions. |
| + * TODO(https://crbug.com/707767): Move relevant methods from SnippetsBridge and NewTabPageUma here. |
| + */ |
| +public final class ContentSuggestionsUma { |
| + private ContentSuggestionsUma() {} |
| + |
| + private static final String REMOTE_SUGGESTIONS_PREF_TOGGLE_HISTOGRAM_NAME = ""; |
|
Michael van Ouwerkerk
2017/04/04 14:09:47
No name?
dgn
2017/04/04 19:02:54
Done.
|
| + |
| + @IntDef({PREFERENCE_TOGGLE_ON_TO_ON, PREFERENCE_TOGGLE_ON_TO_OFF, PREFERENCE_TOGGLE_OFF_TO_ON, |
| + PREFERENCE_TOGGLE_OFF_TO_OFF}) |
| + @Retention(RetentionPolicy.SOURCE) |
| + public @interface PreferenceToggle {} |
| + public static final int PREFERENCE_TOGGLE_ON_TO_ON = 0; |
| + public static final int PREFERENCE_TOGGLE_ON_TO_OFF = 1; |
| + public static final int PREFERENCE_TOGGLE_OFF_TO_ON = 2; |
| + public static final int PREFERENCE_TOGGLE_OFF_TO_OFF = 3; |
| + private static final int PREFERENCE_TOGGLE_INDEX_BOUNDARY = 4; |
| + |
| + public static void remoteSuggestionsPreferencesUIAction(@PreferenceToggle int action) { |
|
Michael van Ouwerkerk
2017/04/04 14:09:47
maybe rename to something like recordPreferencesCh
dgn
2017/04/04 19:02:54
Ack
|
| + RecordHistogram.recordEnumeratedHistogram(REMOTE_SUGGESTIONS_PREF_TOGGLE_HISTOGRAM_NAME, |
| + action, PREFERENCE_TOGGLE_INDEX_BOUNDARY); |
| + } |
| +} |