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.
5 #include "chrome/browser/dom_distiller/dom_distiller_service_factory_android.h"
7 #include "base/android/jni_android.h"
8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_android.h"
11 #include "components/dom_distiller/core/dom_distiller_service_android.h"
12 #include "jni/DomDistillerServiceFactory_jni.h"
14 using base::android::ScopedJavaLocalRef
;
16 namespace dom_distiller
{
19 ScopedJavaLocalRef
<jobject
> DomDistillerServiceFactoryAndroid::GetForProfile(
23 dom_distiller::DomDistillerService
* service
=
24 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
25 ProfileAndroid::FromProfileAndroid(j_profile
));
26 DomDistillerServiceAndroid
* service_android
=
27 new DomDistillerServiceAndroid(service
);
28 return ScopedJavaLocalRef
<jobject
>(service_android
->java_ref_
);
31 bool DomDistillerServiceFactoryAndroid::Register(JNIEnv
* env
) {
32 return RegisterNativesImpl(env
);
35 ScopedJavaLocalRef
<jobject
> GetForProfile(
37 const JavaParamRef
<jclass
>& clazz
,
38 const JavaParamRef
<jobject
>& j_profile
) {
39 return DomDistillerServiceFactoryAndroid::GetForProfile(env
, clazz
,
43 } // namespace android
44 } // namespace dom_distiller