Chromium Code Reviews| Index: components/feature_engagement_tracker/public/android/java/src/org/chromium/components/feature_engagement_tracker/FeatureEngagementTracker.java |
| diff --git a/components/feature_engagement_tracker/public/android/java/src/org/chromium/components/feature_engagement_tracker/FeatureEngagementTracker.java b/components/feature_engagement_tracker/public/android/java/src/org/chromium/components/feature_engagement_tracker/FeatureEngagementTracker.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2eba449ef7e314ae442f2677accdb671c1019006 |
| --- /dev/null |
| +++ b/components/feature_engagement_tracker/public/android/java/src/org/chromium/components/feature_engagement_tracker/FeatureEngagementTracker.java |
| @@ -0,0 +1,50 @@ |
| +// 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.components.feature_engagement_tracker; |
| + |
| +import android.support.annotation.CheckResult; |
| + |
| +import org.chromium.base.Callback; |
| + |
| +/** |
| + * FeatureEngagementTracker is the Java representation of a native FeatureEngagementTracker object. |
| + * It is owned by the native BrowserContext. |
| + * |
| + * FeatureEngagementTracker is the core class for the feature engagement tracker. |
| + */ |
| +public interface FeatureEngagementTracker { |
| + /** |
| + * Must be called whenever an event related to a precondition happens. |
| + */ |
| + void event(String feature, String precondition); |
| + |
| + /** |
| + * Must be called whenever a feature has been used. |
| + */ |
| + void used(String feature); |
| + |
| + /** |
| + * This function must be called whenever the triggering condition for a |
| + * specific feature happens. Returns true iff the display of feature |
| + * enlightenment must happen. |
| + * If |true| is returned, the caller *must* call dismissed() when display |
|
David Trainor- moved to gerrit
2017/03/29 18:00:06
{@code true}? Also use javadoc style "@return {@c
nyquist
2017/03/30 22:58:54
Done.
|
| + * of feature enlightenment ends. |
| + */ |
| + @CheckResult |
| + boolean trigger(String feature); |
| + |
| + /** |
| + * Must be called after display of feature enlightenment finishes. |
| + */ |
| + void dismissed(); |
| + |
| + /** |
| + * For features that trigger on startup, they register a callback to ensure that they are told |
| + * when the tracker has been initialized. The callback will be invoked when the tracker has |
|
David Trainor- moved to gerrit
2017/03/29 18:00:06
Maybe not required for the comment, but the callba
nyquist
2017/03/30 22:58:54
It will be invoked after the DB has been invoked.
|
| + * been initialized. The boolean parameter indicated whether the initialization was a success |
| + * and that the tracker is ready to receive calls. |
| + */ |
| + void addOnInitializedCallback(Callback<Boolean> callback); |
| +} |