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