OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
23 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 23 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
24 #include "chrome/browser/sync/glue/sync_backend_host.h" | 24 #include "chrome/browser/sync/glue/sync_backend_host.h" |
25 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 25 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
26 #include "chrome/browser/sync/profile_sync_service_base.h" | 26 #include "chrome/browser/sync/profile_sync_service_base.h" |
27 #include "chrome/browser/sync/profile_sync_service_observer.h" | 27 #include "chrome/browser/sync/profile_sync_service_observer.h" |
28 #include "chrome/browser/sync/sessions2/sessions_sync_manager.h" | 28 #include "chrome/browser/sync/sessions2/sessions_sync_manager.h" |
29 #include "chrome/browser/sync/startup_controller.h" | 29 #include "chrome/browser/sync/startup_controller.h" |
30 #include "chrome/browser/sync/sync_prefs.h" | |
31 #include "components/keyed_service/core/keyed_service.h" | 30 #include "components/keyed_service/core/keyed_service.h" |
32 #include "components/sync_driver/data_type_controller.h" | 31 #include "components/sync_driver/data_type_controller.h" |
33 #include "components/sync_driver/data_type_encryption_handler.h" | 32 #include "components/sync_driver/data_type_encryption_handler.h" |
34 #include "components/sync_driver/data_type_manager.h" | 33 #include "components/sync_driver/data_type_manager.h" |
35 #include "components/sync_driver/data_type_manager_observer.h" | 34 #include "components/sync_driver/data_type_manager_observer.h" |
36 #include "components/sync_driver/failed_data_types_handler.h" | 35 #include "components/sync_driver/failed_data_types_handler.h" |
37 #include "components/sync_driver/sync_frontend.h" | 36 #include "components/sync_driver/sync_frontend.h" |
| 37 #include "components/sync_driver/sync_prefs.h" |
38 #include "content/public/browser/notification_observer.h" | 38 #include "content/public/browser/notification_observer.h" |
39 #include "content/public/browser/notification_registrar.h" | 39 #include "content/public/browser/notification_registrar.h" |
40 #include "content/public/browser/notification_types.h" | 40 #include "content/public/browser/notification_types.h" |
41 #include "google_apis/gaia/google_service_auth_error.h" | 41 #include "google_apis/gaia/google_service_auth_error.h" |
42 #include "google_apis/gaia/oauth2_token_service.h" | 42 #include "google_apis/gaia/oauth2_token_service.h" |
43 #include "net/base/backoff_entry.h" | 43 #include "net/base/backoff_entry.h" |
44 #include "sync/internal_api/public/base/model_type.h" | 44 #include "sync/internal_api/public/base/model_type.h" |
45 #include "sync/internal_api/public/engine/model_safe_worker.h" | 45 #include "sync/internal_api/public/engine/model_safe_worker.h" |
46 #include "sync/internal_api/public/sync_manager_factory.h" | 46 #include "sync/internal_api/public/sync_manager_factory.h" |
47 #include "sync/internal_api/public/util/experiments.h" | 47 #include "sync/internal_api/public/util/experiments.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // When SetSyncSetupCompleted() == false, but SetSetupInProgress(true) has | 162 // When SetSyncSetupCompleted() == false, but SetSetupInProgress(true) has |
163 // been called, then the sync engine knows not to download any user data. | 163 // been called, then the sync engine knows not to download any user data. |
164 // | 164 // |
165 // When initial sync is complete, the UI code should call | 165 // When initial sync is complete, the UI code should call |
166 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will | 166 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will |
167 // tell the sync engine that setup is completed and it can begin downloading | 167 // tell the sync engine that setup is completed and it can begin downloading |
168 // data from the sync server. | 168 // data from the sync server. |
169 // | 169 // |
170 class ProfileSyncService : public ProfileSyncServiceBase, | 170 class ProfileSyncService : public ProfileSyncServiceBase, |
171 public browser_sync::SyncFrontend, | 171 public browser_sync::SyncFrontend, |
172 public browser_sync::SyncPrefObserver, | 172 public sync_driver::SyncPrefObserver, |
173 public browser_sync::DataTypeManagerObserver, | 173 public browser_sync::DataTypeManagerObserver, |
174 public syncer::UnrecoverableErrorHandler, | 174 public syncer::UnrecoverableErrorHandler, |
175 public content::NotificationObserver, | 175 public content::NotificationObserver, |
176 public KeyedService, | 176 public KeyedService, |
177 public browser_sync::DataTypeEncryptionHandler, | 177 public browser_sync::DataTypeEncryptionHandler, |
178 public OAuth2TokenService::Consumer, | 178 public OAuth2TokenService::Consumer, |
179 public OAuth2TokenService::Observer, | 179 public OAuth2TokenService::Observer, |
180 public SessionsSyncManager::SyncInternalApiDelegate { | 180 public SessionsSyncManager::SyncInternalApiDelegate { |
181 public: | 181 public: |
182 typedef browser_sync::SyncBackendHost::Status Status; | 182 typedef browser_sync::SyncBackendHost::Status Status; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 UnrecoverableErrorReason reason); | 857 UnrecoverableErrorReason reason); |
858 | 858 |
859 // Factory used to create various dependent objects. | 859 // Factory used to create various dependent objects. |
860 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 860 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
861 | 861 |
862 // The profile whose data we are synchronizing. | 862 // The profile whose data we are synchronizing. |
863 Profile* profile_; | 863 Profile* profile_; |
864 | 864 |
865 // The class that handles getting, setting, and persisting sync | 865 // The class that handles getting, setting, and persisting sync |
866 // preferences. | 866 // preferences. |
867 browser_sync::SyncPrefs sync_prefs_; | 867 sync_driver::SyncPrefs sync_prefs_; |
868 | 868 |
869 // TODO(ncarter): Put this in a profile, once there is UI for it. | 869 // TODO(ncarter): Put this in a profile, once there is UI for it. |
870 // This specifies where to find the sync server. | 870 // This specifies where to find the sync server. |
871 GURL sync_service_url_; | 871 GURL sync_service_url_; |
872 | 872 |
873 // The last time we detected a successful transition from SYNCING state. | 873 // The last time we detected a successful transition from SYNCING state. |
874 // Our backend notifies us whenever we should take a new snapshot. | 874 // Our backend notifies us whenever we should take a new snapshot. |
875 base::Time last_synced_time_; | 875 base::Time last_synced_time_; |
876 | 876 |
877 // The time that OnConfigureStart is called. This member is zero if | 877 // The time that OnConfigureStart is called. This member is zero if |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 browser_sync::StartupController startup_controller_; | 1009 browser_sync::StartupController startup_controller_; |
1010 | 1010 |
1011 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1011 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
1012 }; | 1012 }; |
1013 | 1013 |
1014 bool ShouldShowActionOnUI( | 1014 bool ShouldShowActionOnUI( |
1015 const syncer::SyncProtocolError& error); | 1015 const syncer::SyncProtocolError& error); |
1016 | 1016 |
1017 | 1017 |
1018 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1018 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |