| Index: chrome/browser/invalidation/invalidation_service_android.h
|
| diff --git a/chrome/browser/invalidation/invalidation_service_android.h b/chrome/browser/invalidation/invalidation_service_android.h
|
| index 244b1e76004cb5cfad0d7551f3a4efd5cf479303..277bea65f0a6b557cc969ce30a30b58b905f71b6 100644
|
| --- a/chrome/browser/invalidation/invalidation_service_android.h
|
| +++ b/chrome/browser/invalidation/invalidation_service_android.h
|
| @@ -5,7 +5,10 @@
|
| #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
|
| #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
|
|
|
| +#include <vector>
|
| +
|
| #include "base/basictypes.h"
|
| +#include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/threading/non_thread_safe.h"
|
| #include "chrome/browser/invalidation/invalidation_service.h"
|
| @@ -14,6 +17,11 @@
|
| #include "content/public/browser/notification_registrar.h"
|
| #include "sync/notifier/invalidator_registrar.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "base/android/jni_android.h"
|
| +#include "base/android/jni_helper.h"
|
| +#endif // defined(OS_ANDROID)
|
| +
|
| class Profile;
|
|
|
| namespace invalidation {
|
| @@ -57,14 +65,48 @@ class InvalidationServiceAndroid
|
| // This is used only by unit tests.
|
| void TriggerStateChangeForTest(syncer::InvalidatorState state);
|
|
|
| + // Replace the callback invoked when the Android invalidation controller
|
| + // registration is updated.
|
| + // The first parameter of the callback is the list of object sources, and the
|
| + // second parameter is the parallel list of object names.
|
| + // Used only for unit tests.
|
| + typedef base::Callback<
|
| + void(const std::vector<int>&, const std::vector<std::string>&)>
|
| + UpdateRegistrationCallback;
|
| + void SetUpdateRegistrationCallbackForTest(
|
| + const UpdateRegistrationCallback& callback);
|
| +
|
| private:
|
| + // Update object registration with the Android invalidation controller.
|
| + void UpdateRegistration();
|
| +
|
| + // Determine if any object in a set needs to be registered with the Android
|
| + // invalidation controller.
|
| + bool IsRegistrationRequired(const syncer::ObjectIdSet& ids);
|
| +
|
| + // Determine if an object with the given id needs to be registered with the
|
| + // Android invalidation controller.
|
| + bool IsRegistrationRequired(const invalidation::ObjectId& id);
|
| +
|
| syncer::InvalidatorRegistrar invalidator_registrar_;
|
| content::NotificationRegistrar registrar_;
|
| syncer::InvalidatorState invalidator_state_;
|
|
|
| +#if defined(OS_ANDROID)
|
| + // The Android invalidation controller.
|
| + base::android::ScopedJavaGlobalRef<jobject> invalidation_controller_;
|
| +#endif // defined(OS_ANDROID)
|
| +
|
| + // The callback to invoke in unit tests when updating the object registration.
|
| + UpdateRegistrationCallback update_registration_callback_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(InvalidationServiceAndroid);
|
| };
|
|
|
| +#if defined(OS_ANDROID)
|
| +bool RegisterInvalidationController(JNIEnv* env);
|
| +#endif // defined(OS_ANDROID)
|
| +
|
| } // namespace invalidation
|
|
|
| #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_ANDROID_H_
|
|
|