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 #include "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "chrome/browser/sync/glue/sync_start_util.h" | 45 #include "chrome/browser/sync/glue/sync_start_util.h" |
46 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 46 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
47 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" | 47 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" |
48 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 48 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
49 #include "chrome/browser/sync/sync_type_preference_provider.h" | 49 #include "chrome/browser/sync/sync_type_preference_provider.h" |
50 #include "chrome/browser/ui/browser.h" | 50 #include "chrome/browser/ui/browser.h" |
51 #include "chrome/browser/ui/browser_list.h" | 51 #include "chrome/browser/ui/browser_list.h" |
52 #include "chrome/browser/ui/browser_window.h" | 52 #include "chrome/browser/ui/browser_window.h" |
53 #include "chrome/browser/ui/global_error/global_error_service.h" | 53 #include "chrome/browser/ui/global_error/global_error_service.h" |
54 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 54 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 55 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" |
55 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
57 #include "chrome/common/sync_util.h" | 58 #include "chrome/common/sync_util.h" |
58 #include "chrome/common/url_constants.h" | 59 #include "chrome/common/url_constants.h" |
59 #include "chrome/grit/generated_resources.h" | 60 #include "chrome/grit/generated_resources.h" |
60 #include "components/autofill/core/common/autofill_pref_names.h" | 61 #include "components/autofill/core/common/autofill_pref_names.h" |
61 #include "components/invalidation/impl/profile_invalidation_provider.h" | 62 #include "components/invalidation/impl/profile_invalidation_provider.h" |
62 #include "components/invalidation/public/invalidation_service.h" | 63 #include "components/invalidation/public/invalidation_service.h" |
63 #include "components/password_manager/core/browser/password_store.h" | 64 #include "components/password_manager/core/browser/password_store.h" |
64 #include "components/pref_registry/pref_registry_syncable.h" | 65 #include "components/pref_registry/pref_registry_syncable.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "sync/internal_api/public/util/sync_db_util.h" | 97 #include "sync/internal_api/public/util/sync_db_util.h" |
97 #include "sync/internal_api/public/util/sync_string_conversions.h" | 98 #include "sync/internal_api/public/util/sync_string_conversions.h" |
98 #include "sync/js/js_event_details.h" | 99 #include "sync/js/js_event_details.h" |
99 #include "sync/protocol/sync.pb.h" | 100 #include "sync/protocol/sync.pb.h" |
100 #include "sync/syncable/directory.h" | 101 #include "sync/syncable/directory.h" |
101 #include "sync/util/cryptographer.h" | 102 #include "sync/util/cryptographer.h" |
102 #include "ui/base/l10n/l10n_util.h" | 103 #include "ui/base/l10n/l10n_util.h" |
103 #include "ui/base/l10n/time_format.h" | 104 #include "ui/base/l10n/time_format.h" |
104 | 105 |
105 #if defined(OS_ANDROID) | 106 #if defined(OS_ANDROID) |
| 107 #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" |
106 #include "sync/internal_api/public/read_transaction.h" | 108 #include "sync/internal_api/public/read_transaction.h" |
107 #endif | 109 #endif |
108 | 110 |
109 using browser_sync::NotificationServiceSessionsRouter; | 111 using browser_sync::NotificationServiceSessionsRouter; |
110 using browser_sync::ProfileSyncServiceStartBehavior; | 112 using browser_sync::ProfileSyncServiceStartBehavior; |
111 using browser_sync::SessionsSyncManager; | 113 using browser_sync::SessionsSyncManager; |
112 using browser_sync::SyncBackendHost; | 114 using browser_sync::SyncBackendHost; |
113 using sync_driver::ChangeProcessor; | 115 using sync_driver::ChangeProcessor; |
114 using sync_driver::DataTypeController; | 116 using sync_driver::DataTypeController; |
115 using sync_driver::DataTypeManager; | 117 using sync_driver::DataTypeManager; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 scoped_ptr<browser_sync::LocalSessionEventRouter> router( | 269 scoped_ptr<browser_sync::LocalSessionEventRouter> router( |
268 new NotificationServiceSessionsRouter(profile, flare)); | 270 new NotificationServiceSessionsRouter(profile, flare)); |
269 | 271 |
270 DCHECK(factory_.get()); | 272 DCHECK(factory_.get()); |
271 local_device_ = factory_->CreateLocalDeviceInfoProvider(); | 273 local_device_ = factory_->CreateLocalDeviceInfoProvider(); |
272 sync_stopped_reporter_.reset( | 274 sync_stopped_reporter_.reset( |
273 new browser_sync::SyncStoppedReporter( | 275 new browser_sync::SyncStoppedReporter( |
274 sync_service_url_, | 276 sync_service_url_, |
275 local_device_->GetSyncUserAgent(), | 277 local_device_->GetSyncUserAgent(), |
276 profile_->GetRequestContext(), | 278 profile_->GetRequestContext(), |
277 browser_sync::SyncStoppedReporter::ResultCallback())), | 279 browser_sync::SyncStoppedReporter::ResultCallback())); |
| 280 scoped_ptr<browser_sync::SyncedWindowDelegatesGetter> synced_window_getter( |
| 281 #if defined(OS_ANDROID) |
| 282 new browser_sync::SyncedWindowDelegatesGetterAndroid()); |
| 283 #else |
| 284 new browser_sync::BrowserSyncedWindowDelegatesGetter()); |
| 285 #endif |
278 sessions_sync_manager_.reset( | 286 sessions_sync_manager_.reset( |
279 new SessionsSyncManager(profile, local_device_.get(), router.Pass())); | 287 new SessionsSyncManager(profile, local_device_.get(), router.Pass(), |
| 288 synced_window_getter.Pass())); |
280 device_info_sync_service_.reset( | 289 device_info_sync_service_.reset( |
281 new DeviceInfoSyncService(local_device_.get())); | 290 new DeviceInfoSyncService(local_device_.get())); |
282 | 291 |
283 std::string last_version = sync_prefs_.GetLastRunVersion(); | 292 std::string last_version = sync_prefs_.GetLastRunVersion(); |
284 std::string current_version = PRODUCT_VERSION; | 293 std::string current_version = PRODUCT_VERSION; |
285 sync_prefs_.SetLastRunVersion(current_version); | 294 sync_prefs_.SetLastRunVersion(current_version); |
286 | 295 |
287 // Check for a major version change. Note that the versions have format | 296 // Check for a major version change. Note that the versions have format |
288 // MAJOR.MINOR.BUILD.PATCH. | 297 // MAJOR.MINOR.BUILD.PATCH. |
289 if (last_version.substr(0, last_version.find('.')) != | 298 if (last_version.substr(0, last_version.find('.')) != |
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 } else { | 2801 } else { |
2793 UMA_HISTOGRAM_COUNTS("Sync.MemoryPressureWarningBeforeCleanShutdown", | 2802 UMA_HISTOGRAM_COUNTS("Sync.MemoryPressureWarningBeforeCleanShutdown", |
2794 warning_received); | 2803 warning_received); |
2795 } | 2804 } |
2796 } | 2805 } |
2797 sync_prefs_.SetMemoryPressureWarningCount(0); | 2806 sync_prefs_.SetMemoryPressureWarningCount(0); |
2798 // Will set to true during a clean shutdown, so crash or something else will | 2807 // Will set to true during a clean shutdown, so crash or something else will |
2799 // remain this as false. | 2808 // remain this as false. |
2800 sync_prefs_.SetCleanShutdown(false); | 2809 sync_prefs_.SetCleanShutdown(false); |
2801 } | 2810 } |
OLD | NEW |