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

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: Spacing and indentation Created 6 years, 6 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..563a31c51061bd70dbfb875e5ac73cc2c282faf5
--- /dev/null
+++ b/components/dom_distiller/core/dom_distiller_service_android.cc
@@ -0,0 +1,37 @@
+// 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.h"
+#include "components/dom_distiller/core/dom_distiller_service_android.h"
+#include "components/dom_distiller/core/reader_mode_preferences.h"
+
+#include "jni/DomDistillerService_jni.h"
+
+DomDistillerServiceAndroid::DomDistillerServiceAndroid(
nyquist 2014/06/30 20:33:23 This constructor can call a private static create
sunangel 2014/07/07 21:21:29 Done.
+ JNIEnv* env,
+ jobject obj,
+ dom_distiller::DomDistillerService* ptr) {
nyquist 2014/06/30 20:33:23 Nit: service
sunangel 2014/07/07 21:21:29 Done.
+ service_ = ptr;
nyquist 2014/06/30 20:33:23 How about you call a static create method here on
sunangel 2014/07/07 21:21:29 Done.
+}
+
+jlong Init(JNIEnv* env, jobject obj, jlong servicePtr) {
nyquist 2014/06/30 20:33:23 I think we can turn this around and you could inst
sunangel 2014/07/07 21:21:29 Done.
+ dom_distiller::DomDistillerService* s =
nyquist 2014/06/30 20:33:23 |service|
sunangel 2014/07/07 21:21:30 Done.
+ reinterpret_cast<dom_distiller::DomDistillerService*>(servicePtr);
+ DomDistillerServiceAndroid* dom_distiller_service_android =
+ new DomDistillerServiceAndroid(env, obj, s);
+ return reinterpret_cast<intptr_t>(dom_distiller_service_android);
+}
+
+/**
+ * Returns native pointer to native reader mode preferences registered with
+ * dom_distiller_service.
+ */
+jlong DomDistillerServiceAndroid::GetReaderModePrefsPointer(JNIEnv* env,
nyquist 2014/06/30 20:33:23 This can instead return the jobject DistilledPageP
sunangel 2014/07/07 21:21:29 not doing this as per conversation On 2014/06/30 2
+ jobject obj) {
+ return reinterpret_cast<intptr_t>(service_->GetReaderModePrefs());
+}
+
+bool DomDistillerServiceAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}

Powered by Google App Engine
This is Rietveld 408576698