OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 package org.chromium.components.feature_engagement_tracker; |
| 6 |
| 7 import android.support.annotation.CheckResult; |
| 8 |
| 9 import org.chromium.base.Callback; |
| 10 |
| 11 /** |
| 12 * FeatureEngagementTracker is the Java representation of a native FeatureEngage
mentTracker object. |
| 13 * It is owned by the native BrowserContext. |
| 14 * |
| 15 * FeatureEngagementTracker is the core class for the feature engagement tracker
. |
| 16 */ |
| 17 public interface FeatureEngagementTracker { |
| 18 /** |
| 19 * Must be called whenever an event related to a precondition happens. |
| 20 */ |
| 21 void event(String feature, String precondition); |
| 22 |
| 23 /** |
| 24 * Must be called whenever a feature has been used. |
| 25 */ |
| 26 void used(String feature); |
| 27 |
| 28 /** |
| 29 * This function must be called whenever the triggering condition for a |
| 30 * specific feature happens. Returns true iff the display of feature |
| 31 * enlightenment must happen. |
| 32 * If {@code true} is returned, the caller *must* call {@link #dismissed()}
when display |
| 33 * of feature enlightenment ends. |
| 34 * @return whether feature enlightenment should be displayed. |
| 35 */ |
| 36 @CheckResult |
| 37 boolean trigger(String feature); |
| 38 |
| 39 /** |
| 40 * Must be called after display of feature enlightenment finishes. |
| 41 */ |
| 42 void dismissed(); |
| 43 |
| 44 /** |
| 45 * For features that trigger on startup, they register a callback to ensure
that they are told |
| 46 * when the tracker has been initialized. The callback will be invoked when
the tracker has |
| 47 * been initialized. The boolean parameter indicated whether the initializat
ion was a success |
| 48 * and that the tracker is ready to receive calls. |
| 49 */ |
| 50 void addOnInitializedCallback(Callback<Boolean> callback); |
| 51 } |
OLD | NEW |