Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/android/contextualsearch/ctr_suppression.h

Issue 2285633004: [TTS] Record CTR by week and 28-day intervals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctr
Patch Set: Reworked the cache to use a stored preference instead of session static data. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CTR_SUPPRESSION_H_
6 #define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CTR_SUPPRESSION_H_
7
8 #include <stddef.h>
9
10 #include "base/android/jni_android.h"
11 #include "components/contextual_search/browser/ctr_aggregator.h"
12 #include "components/contextual_search/browser/weekly_activity_storage.h"
13
14 // Provides access to aggregated click-through-rate recording for tap
15 // suppression. Implements a Java conduit to the CtrAggregator in the
16 // Contextual Search component. This allows Java to access the aggregated CTR
17 // values.
18 // This class also provides device-specific integer storage through its
19 // associated Java class as required to implement the WeeklyActivityStorage.
20 class CtrSuppression : public contextual_search::WeeklyActivityStorage {
21 public:
22 // Constructs a new CtrSuppression linked to the given Java object.
23 CtrSuppression(JNIEnv* env, jobject obj);
24 ~CtrSuppression() override;
25
26 // Calls the destructor. Should be called when this native object is no
27 // longer needed.
28 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
29
30 // These methods all just call through to the |CtrAggregator| method of the
31 // same name.
32 void RecordImpression(JNIEnv* env,
33 const base::android::JavaParamRef<jobject>& obj,
34 jboolean did_click);
35 jint GetCurrentWeekNumber(JNIEnv* env,
36 const base::android::JavaParamRef<jobject>& obj);
37 jboolean HasPreviousWeekData(JNIEnv* env,
38 const base::android::JavaParamRef<jobject>& obj);
39 jint GetPreviousWeekImpressions(
40 JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj);
42 jfloat GetPreviousWeekCtr(JNIEnv* env,
43 const base::android::JavaParamRef<jobject>& obj);
44 jboolean HasPrevious28DayData(
45 JNIEnv* env,
46 const base::android::JavaParamRef<jobject>& obj);
47 jint GetPrevious28DayImpressions(
48 JNIEnv* env,
49 const base::android::JavaParamRef<jobject>& obj);
50 jfloat GetPrevious28DayCtr(JNIEnv* env,
51 const base::android::JavaParamRef<jobject>& obj);
52
53 // WeeklyActivityStorage Overrides.
54 int ReadStorage(std::string storage_bucket) override;
55 void WriteStorage(std::string storage_bucket, int value) override;
56
57 private:
58 // The CtrAggregator that we forward requests to.
59 std::unique_ptr<contextual_search::CtrAggregator> aggregator_;
60
61 // The linked Java object.
62 base::android::ScopedJavaGlobalRef<jobject> java_object_;
63
64 DISALLOW_COPY_AND_ASSIGN(CtrSuppression);
65 };
66
67 bool RegisterCtrSuppression(JNIEnv* env);
68
69 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CTR_SUPPRESSION_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/contextualsearch/ctr_suppression.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698