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

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

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

Powered by Google App Engine
This is Rietveld 408576698