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

Unified Diff: components/dom_distiller/core/dom_distiller_service_android.cc

Issue 340403004: Java wrapper for DistilledPagePrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: namespaces to classes, native init, enum Created 6 years, 5 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/dom_distiller/core/dom_distiller_service_android.cc
diff --git a/components/dom_distiller/core/dom_distiller_service_android.cc b/components/dom_distiller/core/dom_distiller_service_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9cfa3918d5509e5eb92ba216a4580e19e2a13226
--- /dev/null
+++ b/components/dom_distiller/core/dom_distiller_service_android.cc
@@ -0,0 +1,42 @@
+// Copyright 2014 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/dom_distiller/core/dom_distiller_service_android.h"
+
+#include "base/android/jni_android.h"
+
nyquist 2014/07/08 01:02:34 remove empty line
sunangel 2014/07/08 20:41:00 Done.
+#include "components/dom_distiller/core/distilled_page_prefs.h"
+#include "components/dom_distiller/core/distilled_page_prefs_android.h"
+#include "components/dom_distiller/core/dom_distiller_service.h"
+
nyquist 2014/07/08 01:02:34 remove empty line
sunangel 2014/07/08 20:41:00 Done.
+#include "jni/DomDistillerService_jni.h"
+
+namespace dom_distiller{
+namespace android {
+
+DomDistillerServiceAndroid::DomDistillerServiceAndroid(
+ dom_distiller::DomDistillerService* service):service_(service) {
nyquist 2014/07/08 01:02:34 See style guide for how this should be written: ht
sunangel 2014/07/08 20:41:00 Done.
+ JNIEnv* env = base::android::AttachCurrentThread();
+ base::android::ScopedJavaLocalRef<jobject> local_java_ref =
+ Java_DomDistillerService_create(env, reinterpret_cast<intptr_t>(this));
+ java_ref_.Reset(env, local_java_ref.obj());
+}
+
+DomDistillerServiceAndroid::~DomDistillerServiceAndroid() {}
+
+/**
+ * Returns native pointer to native distilled page preferences registered with
+ * dom_distiller_service.
+ */
+jlong DomDistillerServiceAndroid::GetDistilledPagePrefsPointer(JNIEnv* env,
+ jobject obj) {
nyquist 2014/07/08 01:02:34 indent seems to be off?
sunangel 2014/07/08 20:41:00 Done.
+ return reinterpret_cast<intptr_t>(service_->GetDistilledPagePrefs());
+}
+
+bool DomDistillerServiceAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace android
+} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698