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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/invalidation/invalidation_service_factory_android.cc
diff --git a/chrome/browser/invalidation/invalidation_service_factory_android.cc b/chrome/browser/invalidation/invalidation_service_factory_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4f6b55cd98c7cd7181945c1897b07b5c080be878
--- /dev/null
+++ b/chrome/browser/invalidation/invalidation_service_factory_android.cc
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/invalidation/invalidation_service_factory_android.h"
+
+#include "base/android/jni_android.h"
+#include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_android.h"
+#include "components/invalidation/invalidation_service_android.h"
+#include "components/invalidation/profile_invalidation_provider.h"
+#include "jni/InvalidationServiceFactory_jni.h"
+
+using base::android::ScopedJavaLocalRef;
+
+namespace invalidation {
+
+jobject InvalidationServiceFactoryAndroid::GetForProfile(JNIEnv* env,
+ jclass clazz,
+ jobject j_profile) {
+ Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
+ invalidation::ProfileInvalidationProvider* provider =
+ ProfileInvalidationProviderFactory::GetForProfile(profile);
+ InvalidationServiceAndroid* service_android =
+ static_cast<InvalidationServiceAndroid*>(
+ provider->GetInvalidationService());
+ return service_android->java_ref_.obj();
+}
+
+jobject InvalidationServiceFactoryAndroid::GetForTest(JNIEnv* env,
+ jclass clazz,
+ jobject j_context) {
+ InvalidationServiceAndroid* service_android =
+ new InvalidationServiceAndroid(j_context);
+ return service_android->java_ref_.obj();
+}
+
+jobject GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile) {
+ return InvalidationServiceFactoryAndroid::GetForProfile(
+ env, clazz, j_profile);
+}
+
+jobject GetForTest(JNIEnv* env, jclass clazz, jobject j_context) {
+ return InvalidationServiceFactoryAndroid::GetForTest(
+ env, clazz, j_context);
+}
+
+bool InvalidationServiceFactoryAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace invalidation

Powered by Google App Engine
This is Rietveld 408576698