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/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/browsing_data/browsing_data_remover.h" |
23 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" | 24 #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" |
24 #include "chrome/browser/sync/backup_rollback_controller.h" | 25 #include "chrome/browser/sync/backup_rollback_controller.h" |
25 #include "chrome/browser/sync/glue/local_device_info_provider.h" | 26 #include "chrome/browser/sync/glue/local_device_info_provider.h" |
26 #include "chrome/browser/sync/glue/sync_backend_host.h" | 27 #include "chrome/browser/sync/glue/sync_backend_host.h" |
27 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 28 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
28 #include "chrome/browser/sync/profile_sync_service_base.h" | 29 #include "chrome/browser/sync/profile_sync_service_base.h" |
29 #include "chrome/browser/sync/profile_sync_service_observer.h" | 30 #include "chrome/browser/sync/profile_sync_service_observer.h" |
30 #include "chrome/browser/sync/protocol_event_observer.h" | 31 #include "chrome/browser/sync/protocol_event_observer.h" |
31 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" | 32 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
32 #include "chrome/browser/sync/startup_controller.h" | 33 #include "chrome/browser/sync/startup_controller.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 // This function takes ownership of |network_resources|. | 769 // This function takes ownership of |network_resources|. |
769 void OverrideNetworkResourcesForTest( | 770 void OverrideNetworkResourcesForTest( |
770 scoped_ptr<syncer::NetworkResources> network_resources); | 771 scoped_ptr<syncer::NetworkResources> network_resources); |
771 | 772 |
772 virtual bool IsSessionsDataTypeControllerRunning() const; | 773 virtual bool IsSessionsDataTypeControllerRunning() const; |
773 | 774 |
774 BackendMode backend_mode() const { | 775 BackendMode backend_mode() const { |
775 return backend_mode_; | 776 return backend_mode_; |
776 } | 777 } |
777 | 778 |
778 void SetClearingBrowseringDataForTesting( | 779 // Helpers for testing rollback. |
779 base::Callback<void(Profile*, base::Time, base::Time)> c); | 780 void SetBrowsingDataRemoverObserverForTesting( |
| 781 BrowsingDataRemover::Observer* observer); |
| 782 void SetClearingBrowseringDataForTesting(base::Callback< |
| 783 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> |
| 784 c); |
780 | 785 |
781 // Return the base URL of the Sync Server. | 786 // Return the base URL of the Sync Server. |
782 static GURL GetSyncServiceURL(const base::CommandLine& command_line); | 787 static GURL GetSyncServiceURL(const base::CommandLine& command_line); |
783 | 788 |
784 base::Time GetDeviceBackupTimeForTesting() const; | 789 base::Time GetDeviceBackupTimeForTesting() const; |
785 | 790 |
786 protected: | 791 protected: |
787 // Helper to configure the priority data types. | 792 // Helper to configure the priority data types. |
788 void ConfigurePriorityDataTypes(); | 793 void ConfigurePriorityDataTypes(); |
789 | 794 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 BackendMode backend_mode_; | 1147 BackendMode backend_mode_; |
1143 | 1148 |
1144 // Whether backup is needed before sync starts. | 1149 // Whether backup is needed before sync starts. |
1145 bool need_backup_; | 1150 bool need_backup_; |
1146 | 1151 |
1147 // Whether backup is finished. | 1152 // Whether backup is finished. |
1148 bool backup_finished_; | 1153 bool backup_finished_; |
1149 | 1154 |
1150 base::Time backup_start_time_; | 1155 base::Time backup_start_time_; |
1151 | 1156 |
1152 base::Callback<void(Profile*, base::Time, base::Time)> clear_browsing_data_; | 1157 base::Callback< |
| 1158 void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)> |
| 1159 clear_browsing_data_; |
1153 | 1160 |
1154 // Last time when pre-sync data was saved. NULL pointer means backup data | 1161 // Last time when pre-sync data was saved. NULL pointer means backup data |
1155 // state is unknown. If time value is null, backup data doesn't exist. | 1162 // state is unknown. If time value is null, backup data doesn't exist. |
1156 scoped_ptr<base::Time> last_backup_time_; | 1163 scoped_ptr<base::Time> last_backup_time_; |
1157 | 1164 |
| 1165 BrowsingDataRemover::Observer* browsing_data_remover_observer_; |
| 1166 |
1158 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1167 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
1159 }; | 1168 }; |
1160 | 1169 |
1161 bool ShouldShowActionOnUI( | 1170 bool ShouldShowActionOnUI( |
1162 const syncer::SyncProtocolError& error); | 1171 const syncer::SyncProtocolError& error); |
1163 | 1172 |
1164 | 1173 |
1165 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1174 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |