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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/payments/content/android/journey_logger_android.cc
diff --git a/components/payments/content/android/journey_logger_android.cc b/components/payments/content/android/journey_logger_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ddcc6504c96a27c3f5db3af9362c8c19b909a118
--- /dev/null
+++ b/components/payments/content/android/journey_logger_android.cc
@@ -0,0 +1,86 @@
+// Copyright 2017 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.
+
+#include "components/payments/content/android/journey_logger_android.h"
+
+#include "base/android/jni_string.h"
+#include "base/strings/string16.h"
+#include "jni/JourneyLogger_jni.h"
+
+namespace payments {
+namespace {
+
+using ::base::android::JavaParamRef;
+using ::base::android::ConvertJavaStringToUTF8;
+
+} // namespace
+
+void JourneyLoggerAndroid::Destroy(JNIEnv* env,
+ const JavaParamRef<jobject>& obj) {
+ delete this;
+}
+
+void JourneyLoggerAndroid::SetNumberOfSuggestionsShown(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint jsection,
+ jint jnumber) {
+ journey_logger_.SetNumberOfSuggestionsShown(jsection, jnumber);
+}
+
+void JourneyLoggerAndroid::IncrementSelectionChanges(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint jsection) {
+ journey_logger_.IncrementSelectionChanges(jsection);
+}
+
+void JourneyLoggerAndroid::IncrementSelectionEdits(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint jsection) {
+ journey_logger_.IncrementSelectionEdits(jsection);
+}
+
+void JourneyLoggerAndroid::IncrementSelectionAdds(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint jsection) {
+ journey_logger_.IncrementSelectionAdds(jsection);
+}
+
+void JourneyLoggerAndroid::SetCanMakePaymentValue(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jboolean jvalue) {
+ journey_logger_.SetCanMakePaymentValue(jvalue);
+}
+
+void JourneyLoggerAndroid::SetShowCalled(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ journey_logger_.SetShowCalled();
+}
+
+void JourneyLoggerAndroid::RecordJourneyStatsHistograms(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jstring>& jcompletion_status) {
+ journey_logger_.RecordJourneyStatsHistograms(
+ ConvertJavaStringToUTF8(env, jcompletion_status));
+}
+
+// static
+bool JourneyLoggerAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+static jlong InitJourneyLoggerAndroid(JNIEnv* env,
+ const JavaParamRef<jobject>& obj) {
+ JourneyLoggerAndroid* journey_logger_android =
+ new JourneyLoggerAndroid(env, obj);
+ return reinterpret_cast<intptr_t>(journey_logger_android);
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698