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

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

Issue 442503002: Retrieve article original URL from entryID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
index 5f6559404525456a64a3b73bc65ac0cce82e07d0..30d90001fbff16708eec63acad300120ca6c5a57 100644
--- a/components/dom_distiller/core/dom_distiller_service_android.cc
+++ b/components/dom_distiller/core/dom_distiller_service_android.cc
@@ -5,11 +5,16 @@
#include "components/dom_distiller/core/dom_distiller_service_android.h"
#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/android/scoped_java_ref.h"
#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"
#include "jni/DomDistillerService_jni.h"
+using base::android::ConvertUTF8ToJavaString;
+using base::android::ScopedJavaLocalRef;
+
namespace dom_distiller {
namespace android {
@@ -25,6 +30,23 @@ DomDistillerServiceAndroid::DomDistillerServiceAndroid(
DomDistillerServiceAndroid::~DomDistillerServiceAndroid() {
}
+bool DomDistillerServiceAndroid::HasEntry(JNIEnv* env,
+ jobject obj,
+ jstring j_entry_id) {
+ std::string entry_id =
+ base::android::ConvertJavaStringToUTF8(env, j_entry_id);
+ return service_->HasEntry(entry_id);
+}
+
+ScopedJavaLocalRef<jstring> DomDistillerServiceAndroid::GetUrlForEntry(
+ JNIEnv* env,
+ jobject obj,
+ jstring j_entry_id) {
+ const std::string entry_id =
+ base::android::ConvertJavaStringToUTF8(env, j_entry_id);
+ return ConvertUTF8ToJavaString(env, service_->GetUrlForEntry(entry_id));
+}
+
jlong DomDistillerServiceAndroid::GetDistilledPagePrefsPtr(JNIEnv* env,
jobject obj) {
return reinterpret_cast<intptr_t>(service_->GetDistilledPagePrefs());

Powered by Google App Engine
This is Rietveld 408576698