| 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 <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 27 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
| 28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 29 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 30 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 30 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
| 32 #include "chrome/browser/defaults.h" | 32 #include "chrome/browser/defaults.h" |
| 33 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 33 #include "chrome/browser/invalidation/profile_invalidation_provider.h" |
| 34 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 34 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 35 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 35 #include "chrome/browser/prefs/pref_service_syncable.h" | 36 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 36 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 38 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 38 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 39 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 39 #include "chrome/browser/signin/about_signin_internals_factory.h" | 40 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 40 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 41 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 41 #include "chrome/browser/signin/signin_manager_factory.h" | 42 #include "chrome/browser/signin/signin_manager_factory.h" |
| 42 #include "chrome/browser/sync/backend_migrator.h" | 43 #include "chrome/browser/sync/backend_migrator.h" |
| 43 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 44 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 679 |
| 679 backend_mode_ = mode; | 680 backend_mode_ = mode; |
| 680 | 681 |
| 681 if (backend_mode_ == ROLLBACK) | 682 if (backend_mode_ == ROLLBACK) |
| 682 ClearBrowsingDataSinceFirstSync(); | 683 ClearBrowsingDataSinceFirstSync(); |
| 683 | 684 |
| 684 base::FilePath sync_folder = backend_mode_ == SYNC ? | 685 base::FilePath sync_folder = backend_mode_ == SYNC ? |
| 685 base::FilePath(kSyncDataFolderName) : | 686 base::FilePath(kSyncDataFolderName) : |
| 686 base::FilePath(kSyncBackupDataFolderName); | 687 base::FilePath(kSyncBackupDataFolderName); |
| 687 | 688 |
| 688 invalidation::InvalidationService* invalidator = backend_mode_ == SYNC ? | 689 invalidation::InvalidationService* invalidator = NULL; |
| 689 invalidation::InvalidationServiceFactory::GetForProfile(profile_) : | 690 if (backend_mode_ == SYNC) { |
| 690 NULL; | 691 invalidation::ProfileInvalidationProvider* provider = |
| 692 invalidation::ProfileInvalidationProviderFactory::GetForProfile( |
| 693 profile_); |
| 694 if (provider) |
| 695 invalidator = provider->GetInvalidationService(); |
| 696 } |
| 691 | 697 |
| 692 backend_.reset( | 698 backend_.reset( |
| 693 factory_->CreateSyncBackendHost( | 699 factory_->CreateSyncBackendHost( |
| 694 profile_->GetDebugName(), | 700 profile_->GetDebugName(), |
| 695 profile_, | 701 profile_, |
| 696 invalidator, | 702 invalidator, |
| 697 sync_prefs_.AsWeakPtr(), | 703 sync_prefs_.AsWeakPtr(), |
| 698 sync_folder)); | 704 sync_folder)); |
| 699 | 705 |
| 700 // Initialize the backend. Every time we start up a new SyncBackendHost, | 706 // Initialize the backend. Every time we start up a new SyncBackendHost, |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 if (first_sync_time.is_null()) | 2552 if (first_sync_time.is_null()) |
| 2547 return; | 2553 return; |
| 2548 | 2554 |
| 2549 clear_browsing_data_.Run(profile_, first_sync_time, base::Time::Now()); | 2555 clear_browsing_data_.Run(profile_, first_sync_time, base::Time::Now()); |
| 2550 } | 2556 } |
| 2551 | 2557 |
| 2552 void ProfileSyncService::SetClearingBrowseringDataForTesting( | 2558 void ProfileSyncService::SetClearingBrowseringDataForTesting( |
| 2553 base::Callback<void(Profile*, base::Time, base::Time)> c) { | 2559 base::Callback<void(Profile*, base::Time, base::Time)> c) { |
| 2554 clear_browsing_data_ = c; | 2560 clear_browsing_data_ = c; |
| 2555 } | 2561 } |
| OLD | NEW |