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

Side by Side Diff: chrome/browser/sync/profile_sync_service_android.h

Issue 23643002: Enable invalidations for arbitrary objects on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 unified diff | Download patch
OLDNEW
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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 static bool Register(JNIEnv* env); 201 static bool Register(JNIEnv* env);
200 202
201 private: 203 private:
202 typedef std::map<invalidation::ObjectId, 204 typedef std::map<invalidation::ObjectId,
203 int64, 205 int64,
204 syncer::ObjectIdLessThan> ObjectIdVersionMap; 206 syncer::ObjectIdLessThan> ObjectIdVersionMap;
205 207
206 virtual ~ProfileSyncServiceAndroid(); 208 virtual ~ProfileSyncServiceAndroid();
207 // Remove observers to profile sync service. 209 // Remove observers to profile sync service.
208 void RemoveObserver(); 210 void RemoveObserver();
209 // Called from Java when we need to nudge native syncer. The |objectId|, 211 // Called from Java when we need to nudge native syncer. The |object_source|,
210 // |version| and |payload| values should come from an invalidation. 212 // |objectId|, |version| and |payload| values should come from an
211 void SendNudgeNotification(const std::string& str_object_id, 213 // invalidation.
214 void SendNudgeNotification(int object_source,
215 const std::string& str_object_id,
212 int64 version, 216 int64 version,
213 const std::string& payload); 217 const std::string& payload);
214 218
215 Profile* profile_; 219 Profile* profile_;
216 ProfileSyncService* sync_service_; 220 ProfileSyncService* sync_service_;
217 // The class that handles getting, setting, and persisting sync 221 // The class that handles getting, setting, and persisting sync
218 // preferences. 222 // preferences.
219 scoped_ptr<browser_sync::SyncPrefs> sync_prefs_; 223 scoped_ptr<browser_sync::SyncPrefs> sync_prefs_;
220 224
221 // Java-side ProfileSyncService object. 225 // Java-side ProfileSyncService object.
222 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; 226 JavaObjectWeakGlobalRef weak_java_profile_sync_service_;
223 227
224 // The invalidation API spec allows for the possibility of redundant 228 // The invalidation API spec allows for the possibility of redundant
225 // invalidations, so keep track of the max versions and drop 229 // invalidations, so keep track of the max versions and drop
226 // invalidations with old versions. 230 // invalidations with old versions.
227 ObjectIdVersionMap max_invalidation_versions_; 231 ObjectIdVersionMap max_invalidation_versions_;
228 232
229 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); 233 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid);
230 }; 234 };
231 235
232 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ 236 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698