blob: 1fb51465920793436cf82924caad9eac17d7e545 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2020 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.
#ifndef COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_ANDROID_WRAPPING_TEST_TRACKER_H_
#define COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_ANDROID_WRAPPING_TEST_TRACKER_H_
#include <memory>
#include <string>
#include "base/android/jni_android.h"
#include "base/callback.h"
#include "base/macros.h"
#include "components/feature_engagement/public/tracker.h"
namespace feature_engagement {
// This class wraps a Tracker from Java and forwards to it all calls received.
class WrappingTestTracker : public Tracker {
public:
explicit WrappingTestTracker(const base::android::JavaRef<jobject>& jtracker);
~WrappingTestTracker() override;
// TrackerImpl:
void NotifyEvent(const std::string& event) override;
bool ShouldTriggerHelpUI(const base::Feature& feature) override;
bool WouldTriggerHelpUI(const base::Feature& feature) const override;
bool HasEverTriggered(const base::Feature& feature,
bool from_window) const override;
TriggerState GetTriggerState(const base::Feature& feature) const override;
void Dismissed(const base::Feature& feature) override;
std::unique_ptr<DisplayLockHandle> AcquireDisplayLock() override;
bool IsInitialized() const override;
void AddOnInitializedCallback(OnInitializedCallback callback) override;
private:
base::android::ScopedJavaGlobalRef<jobject> java_tracker_;
DISALLOW_COPY_AND_ASSIGN(WrappingTestTracker);
};
} // namespace feature_engagement
#endif // COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_ANDROID_WRAPPING_TEST_TRACKER_H_
|