dom_distiller_service_android.cc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/dom_distiller/core/dom_distiller_service_android.h"
  5. #include "base/android/jni_android.h"
  6. #include "base/android/jni_string.h"
  7. #include "base/android/scoped_java_ref.h"
  8. #include "components/dom_distiller/core/distilled_page_prefs.h"
  9. #include "components/dom_distiller/core/distilled_page_prefs_android.h"
  10. #include "components/dom_distiller/core/dom_distiller_service.h"
  11. #include "components/dom_distiller/core/jni_headers/DomDistillerService_jni.h"
  12. using base::android::ConvertUTF8ToJavaString;
  13. using base::android::JavaParamRef;
  14. using base::android::ScopedJavaLocalRef;
  15. namespace dom_distiller {
  16. namespace android {
  17. DomDistillerServiceAndroid::DomDistillerServiceAndroid(
  18. DomDistillerService* service)
  19. : service_(service) {
  20. JNIEnv* env = base::android::AttachCurrentThread();
  21. base::android::ScopedJavaLocalRef<jobject> local_java_ref =
  22. Java_DomDistillerService_create(env, reinterpret_cast<intptr_t>(this));
  23. java_ref_.Reset(env, local_java_ref.obj());
  24. }
  25. DomDistillerServiceAndroid::~DomDistillerServiceAndroid() {}
  26. jlong DomDistillerServiceAndroid::GetDistilledPagePrefsPtr(JNIEnv* env) {
  27. return reinterpret_cast<intptr_t>(service_->GetDistilledPagePrefs());
  28. }
  29. } // namespace android
  30. } // namespace dom_distiller