| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 // Returns sync internals in a JSON-formatted Java string. | 181 // Returns sync internals in a JSON-formatted Java string. |
| 182 base::android::ScopedJavaLocalRef<jstring> GetAboutInfoForTest(JNIEnv* env, | 182 base::android::ScopedJavaLocalRef<jstring> GetAboutInfoForTest(JNIEnv* env, |
| 183 jobject obj); | 183 jobject obj); |
| 184 | 184 |
| 185 // Returns the integer value corresponding to the current auth error state | 185 // Returns the integer value corresponding to the current auth error state |
| 186 // (GoogleServiceAuthError.State). | 186 // (GoogleServiceAuthError.State). |
| 187 jint GetAuthError(JNIEnv* env, jobject obj); | 187 jint GetAuthError(JNIEnv* env, jobject obj); |
| 188 | 188 |
| 189 // ProfileSyncServiceObserver: | 189 // ProfileSyncServiceObserver: |
| 190 virtual void OnStateChanged() override; | 190 void OnStateChanged() override; |
| 191 | 191 |
| 192 // Returns a timestamp for when a sync was last executed. The return value is | 192 // Returns a timestamp for when a sync was last executed. The return value is |
| 193 // the internal value of base::Time. | 193 // the internal value of base::Time. |
| 194 jlong GetLastSyncedTimeForTest(JNIEnv* env, jobject obj); | 194 jlong GetLastSyncedTimeForTest(JNIEnv* env, jobject obj); |
| 195 | 195 |
| 196 // Overrides ProfileSyncService's NetworkResources object. This is used to | 196 // Overrides ProfileSyncService's NetworkResources object. This is used to |
| 197 // set up the Sync FakeServer for testing. | 197 // set up the Sync FakeServer for testing. |
| 198 void OverrideNetworkResourcesForTest(JNIEnv* env, | 198 void OverrideNetworkResourcesForTest(JNIEnv* env, |
| 199 jobject obj, | 199 jobject obj, |
| 200 jlong network_resources); | 200 jlong network_resources); |
| 201 | 201 |
| 202 // Public for tests. | 202 // Public for tests. |
| 203 static jlong ModelTypeSetToSelection(syncer::ModelTypeSet model_types); | 203 static jlong ModelTypeSetToSelection(syncer::ModelTypeSet model_types); |
| 204 | 204 |
| 205 // Converts a bitmap of model types to a set of Java ModelTypes, and returns | 205 // Converts a bitmap of model types to a set of Java ModelTypes, and returns |
| 206 // their string descriptions separated by commas. | 206 // their string descriptions separated by commas. |
| 207 static std::string ModelTypeSelectionToStringForTest( | 207 static std::string ModelTypeSelectionToStringForTest( |
| 208 jlong model_type_selection); | 208 jlong model_type_selection); |
| 209 | 209 |
| 210 static ProfileSyncServiceAndroid* GetProfileSyncServiceAndroid(); | 210 static ProfileSyncServiceAndroid* GetProfileSyncServiceAndroid(); |
| 211 | 211 |
| 212 // Registers the ProfileSyncServiceAndroid's native methods through JNI. | 212 // Registers the ProfileSyncServiceAndroid's native methods through JNI. |
| 213 static bool Register(JNIEnv* env); | 213 static bool Register(JNIEnv* env); |
| 214 | 214 |
| 215 private: | 215 private: |
| 216 typedef std::map<invalidation::ObjectId, | 216 typedef std::map<invalidation::ObjectId, |
| 217 int64, | 217 int64, |
| 218 syncer::ObjectIdLessThan> ObjectIdVersionMap; | 218 syncer::ObjectIdLessThan> ObjectIdVersionMap; |
| 219 | 219 |
| 220 virtual ~ProfileSyncServiceAndroid(); | 220 ~ProfileSyncServiceAndroid() override; |
| 221 // Remove observers to profile sync service. | 221 // Remove observers to profile sync service. |
| 222 void RemoveObserver(); | 222 void RemoveObserver(); |
| 223 | 223 |
| 224 Profile* profile_; | 224 Profile* profile_; |
| 225 ProfileSyncService* sync_service_; | 225 ProfileSyncService* sync_service_; |
| 226 // The class that handles getting, setting, and persisting sync | 226 // The class that handles getting, setting, and persisting sync |
| 227 // preferences. | 227 // preferences. |
| 228 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; | 228 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; |
| 229 | 229 |
| 230 // Java-side ProfileSyncService object. | 230 // Java-side ProfileSyncService object. |
| 231 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; | 231 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; |
| 232 | 232 |
| 233 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); | 233 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ | 236 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ |
| OLD | NEW |