| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 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/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/memory/memory_pressure_listener.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
| 21 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 23 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
| 24 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 25 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 26 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
| 26 #include "chrome/browser/sync/backup_rollback_controller.h" | 27 #include "chrome/browser/sync/backup_rollback_controller.h" |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 // Callback function to call |startup_controller_|.TryStart() after | 885 // Callback function to call |startup_controller_|.TryStart() after |
| 885 // backup/rollback finishes; | 886 // backup/rollback finishes; |
| 886 void TryStartSyncAfterBackup(); | 887 void TryStartSyncAfterBackup(); |
| 887 | 888 |
| 888 // Clean up prefs and backup DB when rollback is not needed. | 889 // Clean up prefs and backup DB when rollback is not needed. |
| 889 void CleanUpBackup(); | 890 void CleanUpBackup(); |
| 890 | 891 |
| 891 // Tell the sync server that this client has disabled sync. | 892 // Tell the sync server that this client has disabled sync. |
| 892 void RemoveClientFromServer() const; | 893 void RemoveClientFromServer() const; |
| 893 | 894 |
| 895 // Called when the system is under memory pressure. |
| 896 void OnMemoryPressure( |
| 897 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 898 |
| 899 // Check if previous shutdown is shutdown cleanly. |
| 900 void RecordPreviousShutdownMemoryWarning(); |
| 901 |
| 894 // Factory used to create various dependent objects. | 902 // Factory used to create various dependent objects. |
| 895 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 903 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
| 896 | 904 |
| 897 // The profile whose data we are synchronizing. | 905 // The profile whose data we are synchronizing. |
| 898 Profile* profile_; | 906 Profile* profile_; |
| 899 | 907 |
| 900 // The class that handles getting, setting, and persisting sync | 908 // The class that handles getting, setting, and persisting sync |
| 901 // preferences. | 909 // preferences. |
| 902 sync_driver::SyncPrefs sync_prefs_; | 910 sync_driver::SyncPrefs sync_prefs_; |
| 903 | 911 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 // state is unknown. If time value is null, backup data doesn't exist. | 1071 // state is unknown. If time value is null, backup data doesn't exist. |
| 1064 scoped_ptr<base::Time> last_backup_time_; | 1072 scoped_ptr<base::Time> last_backup_time_; |
| 1065 | 1073 |
| 1066 BrowsingDataRemover::Observer* browsing_data_remover_observer_; | 1074 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
| 1067 | 1075 |
| 1068 // The full path to the sync data directory. | 1076 // The full path to the sync data directory. |
| 1069 base::FilePath directory_path_; | 1077 base::FilePath directory_path_; |
| 1070 | 1078 |
| 1071 scoped_ptr<browser_sync::SyncStoppedReporter> sync_stopped_reporter_; | 1079 scoped_ptr<browser_sync::SyncStoppedReporter> sync_stopped_reporter_; |
| 1072 | 1080 |
| 1081 // Listens for the system being under memory pressure. |
| 1082 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 1083 |
| 1073 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | 1084 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 1074 | 1085 |
| 1075 // We don't use |weak_factory_| for the StartupController because the weak | 1086 // We don't use |weak_factory_| for the StartupController because the weak |
| 1076 // ptrs should be bound to the lifetime of ProfileSyncService and not to the | 1087 // ptrs should be bound to the lifetime of ProfileSyncService and not to the |
| 1077 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass | 1088 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass |
| 1078 // StartupController an Unretained reference to future-proof against | 1089 // StartupController an Unretained reference to future-proof against |
| 1079 // the controller impl changing to post tasks. Therefore, we have a separate | 1090 // the controller impl changing to post tasks. Therefore, we have a separate |
| 1080 // factory. | 1091 // factory. |
| 1081 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; | 1092 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; |
| 1082 | 1093 |
| 1083 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1094 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1084 }; | 1095 }; |
| 1085 | 1096 |
| 1086 bool ShouldShowActionOnUI( | 1097 bool ShouldShowActionOnUI( |
| 1087 const syncer::SyncProtocolError& error); | 1098 const syncer::SyncProtocolError& error); |
| 1088 | 1099 |
| 1089 | 1100 |
| 1090 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1101 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |