| OLD | NEW |
| 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/invalidation/invalidation_service_factory_android.h" | 5 #include "chrome/browser/invalidation/invalidation_service_factory_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 8 #include "chrome/browser/invalidation/profile_invalidation_provider_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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const JavaRef<jobject>& j_profile) { | 22 const JavaRef<jobject>& j_profile) { |
| 23 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj()); | 23 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile.obj()); |
| 24 invalidation::ProfileInvalidationProvider* provider = | 24 invalidation::ProfileInvalidationProvider* provider = |
| 25 ProfileInvalidationProviderFactory::GetForProfile(profile); | 25 ProfileInvalidationProviderFactory::GetForProfile(profile); |
| 26 InvalidationServiceAndroid* service_android = | 26 InvalidationServiceAndroid* service_android = |
| 27 static_cast<InvalidationServiceAndroid*>( | 27 static_cast<InvalidationServiceAndroid*>( |
| 28 provider->GetInvalidationService()); | 28 provider->GetInvalidationService()); |
| 29 return ScopedJavaLocalRef<jobject>(service_android->java_ref_); | 29 return ScopedJavaLocalRef<jobject>(service_android->java_ref_); |
| 30 } | 30 } |
| 31 | 31 |
| 32 ScopedJavaLocalRef<jobject> InvalidationServiceFactoryAndroid::GetForTest( | 32 ScopedJavaLocalRef<jobject> InvalidationServiceFactoryAndroid::GetForTest() { |
| 33 const JavaRef<jobject>& j_context) { | |
| 34 InvalidationServiceAndroid* service_android = | 33 InvalidationServiceAndroid* service_android = |
| 35 new InvalidationServiceAndroid(j_context); | 34 new InvalidationServiceAndroid(); |
| 36 return ScopedJavaLocalRef<jobject>(service_android->java_ref_); | 35 return ScopedJavaLocalRef<jobject>(service_android->java_ref_); |
| 37 } | 36 } |
| 38 | 37 |
| 39 ScopedJavaLocalRef<jobject> GetForProfile( | 38 ScopedJavaLocalRef<jobject> GetForProfile( |
| 40 JNIEnv* env, | 39 JNIEnv* env, |
| 41 const JavaParamRef<jclass>& clazz, | 40 const JavaParamRef<jclass>& clazz, |
| 42 const JavaParamRef<jobject>& j_profile) { | 41 const JavaParamRef<jobject>& j_profile) { |
| 43 return InvalidationServiceFactoryAndroid::GetForProfile(j_profile); | 42 return InvalidationServiceFactoryAndroid::GetForProfile(j_profile); |
| 44 } | 43 } |
| 45 | 44 |
| 46 ScopedJavaLocalRef<jobject> GetForTest(JNIEnv* env, | 45 ScopedJavaLocalRef<jobject> GetForTest(JNIEnv* env, |
| 47 const JavaParamRef<jclass>& clazz, | 46 const JavaParamRef<jclass>& clazz) { |
| 48 const JavaParamRef<jobject>& j_context) { | 47 return InvalidationServiceFactoryAndroid::GetForTest(); |
| 49 return InvalidationServiceFactoryAndroid::GetForTest(j_context); | |
| 50 } | 48 } |
| 51 | 49 |
| 52 bool InvalidationServiceFactoryAndroid::Register(JNIEnv* env) { | 50 bool InvalidationServiceFactoryAndroid::Register(JNIEnv* env) { |
| 53 return RegisterNativesImpl(env); | 51 return RegisterNativesImpl(env); |
| 54 } | 52 } |
| 55 | 53 |
| 56 } // namespace invalidation | 54 } // namespace invalidation |
| OLD | NEW |