Chromium Code Reviews| 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..6690743eb69c15b8bb878dc0d41108b39fd99043 |
| --- /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" |
| +#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" |
| + |
| +namespace dom_distiller { |
| +namespace android { |
| + |
| +DomDistillerServiceAndroid::DomDistillerServiceAndroid( |
| + DomDistillerService* service) |
| + : service_(service) { |
| + 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 DistilledPagePrefs registered with |
|
nyquist
2014/07/14 18:06:25
Move this comment to the header file.
sunangel
2014/07/15 15:39:51
Done.
|
| + * DomDistillerService. |
| + */ |
| +jlong DomDistillerServiceAndroid::GetDistilledPagePrefsPtr(JNIEnv* env, |
| + jobject obj) { |
| + return reinterpret_cast<intptr_t>(service_->GetDistilledPagePrefs()); |
| +} |
| + |
| +bool DomDistillerServiceAndroid::Register(JNIEnv* env) { |
| + return RegisterNativesImpl(env); |
| +} |
| + |
| +} // namespace android |
| +} // namespace dom_distiller |