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

Side by Side Diff: chrome/browser/invalidation/invalidation_service_factory_android.cc

Issue 459513002: Massive refactor of the Android invalidation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A couple GN fixes. Created 6 years, 2 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
(Empty)
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
5 #include "chrome/browser/invalidation/invalidation_service_factory_android.h"
6
7 #include "base/android/jni_android.h"
8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_android.h"
11 #include "components/invalidation/invalidation_service_android.h"
12 #include "components/invalidation/profile_invalidation_provider.h"
13 #include "jni/InvalidationServiceFactory_jni.h"
14
15 using base::android::ScopedJavaLocalRef;
16
17 namespace invalidation {
18
19 jobject InvalidationServiceFactoryAndroid::GetForProfile(JNIEnv* env,
20 jclass clazz,
21 jobject j_profile) {
22 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
23 invalidation::ProfileInvalidationProvider* provider =
24 ProfileInvalidationProviderFactory::GetForProfile(profile);
25 InvalidationServiceAndroid* service_android =
26 static_cast<InvalidationServiceAndroid*>(
27 provider->GetInvalidationService());
28 return service_android->java_ref_.obj();
29 }
30
31 jobject InvalidationServiceFactoryAndroid::GetForTest(JNIEnv* env,
32 jclass clazz,
33 jobject j_context) {
34 InvalidationServiceAndroid* service_android =
35 new InvalidationServiceAndroid(j_context);
36 return service_android->java_ref_.obj();
37 }
38
39 jobject GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile) {
40 return InvalidationServiceFactoryAndroid::GetForProfile(
41 env, clazz, j_profile);
42 }
43
44 jobject GetForTest(JNIEnv* env, jclass clazz, jobject j_context) {
45 return InvalidationServiceFactoryAndroid::GetForTest(
46 env, clazz, j_context);
47 }
48
49 bool InvalidationServiceFactoryAndroid::Register(JNIEnv* env) {
50 return RegisterNativesImpl(env);
51 }
52
53 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698