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 |
11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/invalidation/public/invalidation_util.h" | 16 #include "components/invalidation/public/invalidation_util.h" |
17 #include "components/sync_driver/sync_prefs.h" | 17 #include "components/sync_driver/sync_prefs.h" |
18 #include "components/sync_driver/sync_service_observer.h" | 18 #include "components/sync_driver/sync_service_observer.h" |
19 #include "google/cacheinvalidation/include/types.h" | 19 #include "google/cacheinvalidation/include/types.h" |
20 #include "google_apis/gaia/google_service_auth_error.h" | 20 #include "google_apis/gaia/google_service_auth_error.h" |
21 | 21 |
| 22 namespace sync_driver { |
| 23 class SyncSetupInProgressHandle; |
| 24 } |
| 25 |
22 class Profile; | 26 class Profile; |
23 class ProfileSyncService; | 27 class ProfileSyncService; |
24 | 28 |
25 // Android wrapper of the ProfileSyncService which provides access from the Java | 29 // Android wrapper of the ProfileSyncService which provides access from the Java |
26 // layer. Note that on Android, there's only a single profile, and therefore | 30 // layer. Note that on Android, there's only a single profile, and therefore |
27 // a single instance of this wrapper. The name of the Java class is | 31 // a single instance of this wrapper. The name of the Java class is |
28 // ProfileSyncService. | 32 // ProfileSyncService. |
29 // This class should only be accessed from the UI thread. | 33 // This class should only be accessed from the UI thread. |
30 class ProfileSyncServiceAndroid : public sync_driver::SyncServiceObserver { | 34 class ProfileSyncServiceAndroid : public sync_driver::SyncServiceObserver { |
31 public: | 35 public: |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 private: | 188 private: |
185 // Returns whether sync is allowed by Android. | 189 // Returns whether sync is allowed by Android. |
186 bool IsSyncAllowedByAndroid() const; | 190 bool IsSyncAllowedByAndroid() const; |
187 | 191 |
188 // A reference to the Chrome profile object. | 192 // A reference to the Chrome profile object. |
189 Profile* profile_; | 193 Profile* profile_; |
190 | 194 |
191 // A reference to the sync service for this profile. | 195 // A reference to the sync service for this profile. |
192 ProfileSyncService* sync_service_; | 196 ProfileSyncService* sync_service_; |
193 | 197 |
| 198 // Handle preventing Sync from running until configuration is complete. |
| 199 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> setup_handle_; |
| 200 |
194 // The class that handles getting, setting, and persisting sync | 201 // The class that handles getting, setting, and persisting sync |
195 // preferences. | 202 // preferences. |
196 std::unique_ptr<sync_driver::SyncPrefs> sync_prefs_; | 203 std::unique_ptr<sync_driver::SyncPrefs> sync_prefs_; |
197 | 204 |
198 // Java-side ProfileSyncService object. | 205 // Java-side ProfileSyncService object. |
199 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; | 206 JavaObjectWeakGlobalRef weak_java_profile_sync_service_; |
200 | 207 |
201 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); | 208 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAndroid); |
202 }; | 209 }; |
203 | 210 |
204 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ | 211 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_ANDROID_H_ |
OLD | NEW |