OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 // ProfileSyncService. | 26 // ProfileSyncService. |
27 // This class should only be accessed from the UI thread. | 27 // This class should only be accessed from the UI thread. |
28 class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { | 28 class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { |
29 public: | 29 public: |
30 | 30 |
31 ProfileSyncServiceAndroid(JNIEnv* env, jobject obj); | 31 ProfileSyncServiceAndroid(JNIEnv* env, jobject obj); |
32 | 32 |
33 // This method should be called once right after contructing the object. | 33 // This method should be called once right after contructing the object. |
34 void Init(); | 34 void Init(); |
35 | 35 |
36 // Called from Java when we need to nudge native syncer. The |objectId|, | 36 // Called from Java when we need to nudge native syncer. The |objectSource|, |
37 // |version| and |payload| values should come from an invalidation. | 37 // |objectId|, |version| and |payload| values should come from an |
| 38 // invalidation. |
38 void NudgeSyncer(JNIEnv* env, | 39 void NudgeSyncer(JNIEnv* env, |
39 jobject obj, | 40 jobject obj, |
| 41 jint objectSource, |
40 jstring objectId, | 42 jstring objectId, |
41 jlong version, | 43 jlong version, |
42 jstring payload); | 44 jstring payload); |
43 | 45 |
44 // Called from Java when we need to nudge native syncer but have lost state on | 46 // Called from Java when we need to nudge native syncer but have lost state on |
45 // which types have changed. | 47 // which types have changed. |
46 void NudgeSyncerForAllTypes(JNIEnv* env, jobject obj); | 48 void NudgeSyncerForAllTypes(JNIEnv* env, jobject obj); |
47 | 49 |
48 void TokenAvailable(JNIEnv*, jobject, jstring username, jstring auth_token); | 50 void TokenAvailable(JNIEnv*, jobject, jstring username, jstring auth_token); |
49 | 51 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 static bool Register(JNIEnv* env); | 205 static bool Register(JNIEnv* env); |
204 | 206 |
205 private: | 207 private: |
206 typedef std::map<invalidation::ObjectId, | 208 typedef std::map<invalidation::ObjectId, |
207 int64, | 209 int64, |
208 syncer::ObjectIdLessThan> ObjectIdVersionMap; | 210 syncer::ObjectIdLessThan> ObjectIdVersionMap; |
209 | 211 |
210 virtual ~ProfileSyncServiceAndroid(); | 212 virtual ~ProfileSyncServiceAndroid(); |
211 // Remove observers to profile sync service. | 213 // Remove observers to profile sync service. |
212 void RemoveObserver(); | 214 void RemoveObserver(); |
213 // Called from Java when we need to nudge native syncer. The |objectId|, | 215 // Called from Java when we need to nudge native syncer. The |object_source|, |
214 // |version| and |payload| values should come from an invalidation. | 216 // |objectId|, |version| and |payload| values should come from an |
215 void SendNudgeNotification(const std::string& str_object_id, | 217 // invalidation. |
| 218 void SendNudgeNotification(int object_source, |
| 219 const std::string& str_object_id, |
216 int64 version, | 220 int64 version, |
217 const std::string& payload); | 221 const std::string& payload); |
218 | 222 |
219 Profile* profile_; | 223 Profile* profile_; |
220 ProfileSyncService* sync_service_; | 224 ProfileSyncService* sync_service_; |
221 // The class that handles getting, setting, and persisting sync | 225 // The class that handles getting, setting, and persisting sync |
222 // preferences. | 226 // preferences. |
223 scoped_ptr<browser_sync::SyncPrefs> sync_prefs_; | 227 scoped_ptr<browser_sync::SyncPrefs> sync_prefs_; |
224 | 228 |
225 // Java-side ProfileSyncService object. | 229 // Java-side ProfileSyncService object. |
226 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; | 230 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; |
227 | 231 |
228 // The invalidation API spec allows for the possibility of redundant | 232 // The invalidation API spec allows for the possibility of redundant |
229 // invalidations, so keep track of the max versions and drop | 233 // invalidations, so keep track of the max versions and drop |
230 // invalidations with old versions. | 234 // invalidations with old versions. |
231 ObjectIdVersionMap max_invalidation_versions_; | 235 ObjectIdVersionMap max_invalidation_versions_; |
232 | 236 |
233 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); | 237 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); |
234 }; | 238 }; |
235 | 239 |
236 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ | 240 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ |
OLD | NEW |