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

Side by Side Diff: chrome/browser/dom_distiller/dom_distiller_service_factory_android.cc

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/dom_distiller/dom_distiller_service_factory_android.h" 5 #include "chrome/browser/dom_distiller/dom_distiller_service_factory_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" 8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_android.h" 10 #include "chrome/browser/profiles/profile_android.h"
11 #include "components/dom_distiller/core/dom_distiller_service_android.h" 11 #include "components/dom_distiller/core/dom_distiller_service_android.h"
12 #include "jni/DomDistillerServiceFactory_jni.h" 12 #include "jni/DomDistillerServiceFactory_jni.h"
13 13
14 using base::android::ScopedJavaLocalRef; 14 using base::android::ScopedJavaLocalRef;
15 15
16 namespace dom_distiller { 16 namespace dom_distiller {
17 namespace android { 17 namespace android {
18 18
19 ScopedJavaLocalRef<jobject> DomDistillerServiceFactoryAndroid::GetForProfile( 19 jobject DomDistillerServiceFactoryAndroid::GetForProfile(JNIEnv* env,
20 JNIEnv* env, 20 jclass clazz,
21 jclass clazz, 21 jobject j_profile) {
22 jobject j_profile) {
23 dom_distiller::DomDistillerService* service = 22 dom_distiller::DomDistillerService* service =
24 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext( 23 dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
25 ProfileAndroid::FromProfileAndroid(j_profile)); 24 ProfileAndroid::FromProfileAndroid(j_profile));
26 DomDistillerServiceAndroid* service_android = 25 DomDistillerServiceAndroid* service_android =
27 new DomDistillerServiceAndroid(service); 26 new DomDistillerServiceAndroid(service);
28 return ScopedJavaLocalRef<jobject>(service_android->java_ref_); 27 return service_android->java_ref_.obj();
29 } 28 }
30 29
31 bool DomDistillerServiceFactoryAndroid::Register(JNIEnv* env) { 30 bool DomDistillerServiceFactoryAndroid::Register(JNIEnv* env) {
32 return RegisterNativesImpl(env); 31 return RegisterNativesImpl(env);
33 } 32 }
34 33
35 ScopedJavaLocalRef<jobject> GetForProfile(JNIEnv* env, 34 jobject GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile) {
36 jclass clazz, 35 return DomDistillerServiceFactoryAndroid::GetForProfile(
37 jobject j_profile) { 36 env, clazz, j_profile);
38 return DomDistillerServiceFactoryAndroid::GetForProfile(env, clazz,
39 j_profile);
40 } 37 }
41 38
42 } // namespace android 39 } // namespace android
43 } // namespace dom_distiller 40 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698