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

Side by Side Diff: components/payments/content/android/journey_logger_android.cc

Issue 2750103005: [Payments] Move journey logger to native. (Closed)
Patch Set: Created 3 years, 9 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 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 #include "components/payments/content/android/journey_logger_android.h"
6
7 #include "base/android/jni_string.h"
8 #include "base/strings/string16.h"
9 #include "components/payments/core/journey_logger.h"
10 #include "jni/JourneyLogger_jni.h"
11
12 namespace payments {
13 namespace {
14
15 using ::base::android::JavaParamRef;
16 using ::base::android::ConvertJavaStringToUTF8;
17
18 } // namespace
19
20 JourneyLoggerAndroid::JourneyLoggerAndroid(JNIEnv* env, jobject unused_obj) {
21 journey_logger_.reset(new JourneyLogger());
22 }
23
24 JourneyLoggerAndroid::~JourneyLoggerAndroid() {}
25
26 void JourneyLoggerAndroid::Destroy(JNIEnv* env,
27 const JavaParamRef<jobject>& obj) {
28 delete this;
29 }
30
31 void JourneyLoggerAndroid::SetNumberOfSuggestionsShown(
32 JNIEnv* env,
33 const base::android::JavaParamRef<jobject>& obj,
34 jint jsection,
35 jint jnumber) {
36 journey_logger_->SetNumberOfSuggestionsShown(jsection, jnumber);
37 }
38
39 void JourneyLoggerAndroid::IncrementSelectionChanges(
40 JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj,
42 jint jsection) {
43 journey_logger_->IncrementSelectionChanges(jsection);
44 }
45
46 void JourneyLoggerAndroid::IncrementSelectionEdits(
47 JNIEnv* env,
48 const base::android::JavaParamRef<jobject>& obj,
49 jint jsection) {
50 journey_logger_->IncrementSelectionEdits(jsection);
51 }
52
53 void JourneyLoggerAndroid::IncrementSelectionAdds(
54 JNIEnv* env,
55 const base::android::JavaParamRef<jobject>& obj,
56 jint jsection) {
57 journey_logger_->IncrementSelectionAdds(jsection);
58 }
59
60 void JourneyLoggerAndroid::SetCanMakePaymentValue(
61 JNIEnv* env,
62 const base::android::JavaParamRef<jobject>& obj,
63 jboolean jvalue) {
64 journey_logger_->SetCanMakePaymentValue(jvalue);
65 }
66
67 void JourneyLoggerAndroid::SetShowCalled(
68 JNIEnv* env,
69 const base::android::JavaParamRef<jobject>& obj) {
70 journey_logger_->SetShowCalled();
71 }
72
73 void JourneyLoggerAndroid::RecordJourneyStatsHistograms(
74 JNIEnv* env,
75 const base::android::JavaParamRef<jobject>& obj,
76 const base::android::JavaParamRef<jstring>& jcompletion_status) {
77 journey_logger_->RecordJourneyStatsHistograms(
78 ConvertJavaStringToUTF8(env, jcompletion_status));
79 }
80
81 // static
82 bool JourneyLoggerAndroid::Register(JNIEnv* env) {
83 return RegisterNativesImpl(env);
84 }
85
86 static jlong InitJourneyLoggerAndroid(JNIEnv* env,
87 const JavaParamRef<jobject>& obj) {
88 JourneyLoggerAndroid* journey_logger_android =
89 new JourneyLoggerAndroid(env, obj);
90 return reinterpret_cast<intptr_t>(journey_logger_android);
91 }
92
93 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698