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

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

Issue 459513002: Massive refactor of the Android invalidation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 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 16 matching lines...) Expand all
27 // ProfileSyncService. 27 // ProfileSyncService.
28 // This class should only be accessed from the UI thread. 28 // This class should only be accessed from the UI thread.
29 class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { 29 class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver {
30 public: 30 public:
31 31
32 ProfileSyncServiceAndroid(JNIEnv* env, jobject obj); 32 ProfileSyncServiceAndroid(JNIEnv* env, jobject obj);
33 33
34 // This method should be called once right after contructing the object. 34 // This method should be called once right after contructing the object.
35 void Init(); 35 void Init();
36 36
37 // Called from Java when we need to nudge native syncer. The |objectSource|,
38 // |objectId|, |version| and |payload| values should come from an
39 // invalidation.
40 void NudgeSyncer(JNIEnv* env,
41 jobject obj,
42 jint objectSource,
43 jstring objectId,
44 jlong version,
45 jstring payload);
46
47 // Called from Java when we need to nudge native syncer but have lost state on
48 // which types have changed.
49 void NudgeSyncerForAllTypes(JNIEnv* env, jobject obj);
50
51 // Called from Java when the user manually enables sync 37 // Called from Java when the user manually enables sync
52 void EnableSync(JNIEnv* env, jobject obj); 38 void EnableSync(JNIEnv* env, jobject obj);
53 39
54 // Called from Java when the user manually disables sync 40 // Called from Java when the user manually disables sync
55 void DisableSync(JNIEnv* env, jobject obj); 41 void DisableSync(JNIEnv* env, jobject obj);
56 42
57 // Called from Java when the user signs in to Chrome. Starts up sync. 43 // Called from Java when the user signs in to Chrome. Starts up sync.
58 void SignInSync(JNIEnv* env, jobject obj); 44 void SignInSync(JNIEnv* env, jobject obj);
59 45
60 // Called from Java when the user signs out of Chrome 46 // Called from Java when the user signs out of Chrome
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 static bool Register(JNIEnv* env); 204 static bool Register(JNIEnv* env);
219 205
220 private: 206 private:
221 typedef std::map<invalidation::ObjectId, 207 typedef std::map<invalidation::ObjectId,
222 int64, 208 int64,
223 syncer::ObjectIdLessThan> ObjectIdVersionMap; 209 syncer::ObjectIdLessThan> ObjectIdVersionMap;
224 210
225 virtual ~ProfileSyncServiceAndroid(); 211 virtual ~ProfileSyncServiceAndroid();
226 // Remove observers to profile sync service. 212 // Remove observers to profile sync service.
227 void RemoveObserver(); 213 void RemoveObserver();
228 // Called from Java when we need to nudge native syncer. The |object_source|,
229 // |objectId|, |version| and |payload| values should come from an
230 // invalidation.
231 void SendNudgeNotification(int object_source,
232 const std::string& str_object_id,
233 int64 version,
234 const std::string& payload);
235 214
236 Profile* profile_; 215 Profile* profile_;
237 ProfileSyncService* sync_service_; 216 ProfileSyncService* sync_service_;
238 // The class that handles getting, setting, and persisting sync 217 // The class that handles getting, setting, and persisting sync
239 // preferences. 218 // preferences.
240 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; 219 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_;
241 220
242 // Java-side ProfileSyncService object. 221 // Java-side ProfileSyncService object.
243 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; 222 JavaObjectWeakGlobalRef weak_java_profile_sync_service_;
244 223
245 // The invalidation API spec allows for the possibility of redundant
246 // invalidations, so keep track of the max versions and drop
247 // invalidations with old versions.
248 ObjectIdVersionMap max_invalidation_versions_;
249
250 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); 224 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid);
251 }; 225 };
252 226
253 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ 227 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698