| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 28 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
| 31 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 31 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 32 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 32 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 33 #include "chrome/browser/password_manager/password_store_factory.h" | 33 #include "chrome/browser/password_manager/password_store_factory.h" |
| 34 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 34 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 35 #include "chrome/browser/prefs/pref_service_syncable.h" | 35 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 36 #include "chrome/browser/profiles/profile.h" | 36 #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_factory.h" | |
| 39 #include "chrome/browser/signin/about_signin_internals_factory.h" | 37 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 40 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 38 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 41 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 39 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 42 #include "chrome/browser/signin/signin_manager_factory.h" | 40 #include "chrome/browser/signin/signin_manager_factory.h" |
| 43 #include "chrome/browser/sync/backend_migrator.h" | 41 #include "chrome/browser/sync/backend_migrator.h" |
| 44 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 42 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
| 45 #include "chrome/browser/sync/glue/favicon_cache.h" | 43 #include "chrome/browser/sync/glue/favicon_cache.h" |
| 46 #include "chrome/browser/sync/glue/sync_backend_host.h" | 44 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 47 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 45 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 48 #include "chrome/browser/sync/glue/sync_start_util.h" | 46 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 49 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 47 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
| 50 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 48 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| 51 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" | 49 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" |
| 52 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 50 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 53 #include "chrome/browser/sync/sync_error_controller.h" | 51 #include "chrome/browser/sync/sync_error_controller.h" |
| 54 #include "chrome/browser/sync/sync_type_preference_provider.h" | 52 #include "chrome/browser/sync/sync_type_preference_provider.h" |
| 55 #include "chrome/browser/ui/browser.h" | 53 #include "chrome/browser/ui/browser.h" |
| 56 #include "chrome/browser/ui/browser_list.h" | 54 #include "chrome/browser/ui/browser_list.h" |
| 57 #include "chrome/browser/ui/browser_window.h" | 55 #include "chrome/browser/ui/browser_window.h" |
| 58 #include "chrome/browser/ui/global_error/global_error_service.h" | 56 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 59 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 57 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 60 #include "chrome/common/chrome_switches.h" | 58 #include "chrome/common/chrome_switches.h" |
| 61 #include "chrome/common/chrome_version_info.h" | 59 #include "chrome/common/chrome_version_info.h" |
| 62 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 63 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
| 64 #include "chrome/grit/generated_resources.h" | 62 #include "chrome/grit/generated_resources.h" |
| 65 #include "components/autofill/core/common/autofill_pref_names.h" | 63 #include "components/autofill/core/common/autofill_pref_names.h" |
| 66 #include "components/gcm_driver/gcm_driver.h" | |
| 67 #include "components/invalidation/invalidation_service.h" | 64 #include "components/invalidation/invalidation_service.h" |
| 68 #include "components/invalidation/profile_invalidation_provider.h" | 65 #include "components/invalidation/profile_invalidation_provider.h" |
| 69 #include "components/password_manager/core/browser/password_store.h" | 66 #include "components/password_manager/core/browser/password_store.h" |
| 70 #include "components/pref_registry/pref_registry_syncable.h" | 67 #include "components/pref_registry/pref_registry_syncable.h" |
| 71 #include "components/signin/core/browser/about_signin_internals.h" | 68 #include "components/signin/core/browser/about_signin_internals.h" |
| 72 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 69 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 73 #include "components/signin/core/browser/signin_manager.h" | 70 #include "components/signin/core/browser/signin_manager.h" |
| 74 #include "components/signin/core/browser/signin_metrics.h" | 71 #include "components/signin/core/browser/signin_metrics.h" |
| 75 #include "components/sync_driver/change_processor.h" | 72 #include "components/sync_driver/change_processor.h" |
| 76 #include "components/sync_driver/data_type_controller.h" | 73 #include "components/sync_driver/data_type_controller.h" |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 NotifySyncCycleCompleted(); | 1131 NotifySyncCycleCompleted(); |
| 1135 } | 1132 } |
| 1136 | 1133 |
| 1137 void ProfileSyncService::OnExperimentsChanged( | 1134 void ProfileSyncService::OnExperimentsChanged( |
| 1138 const syncer::Experiments& experiments) { | 1135 const syncer::Experiments& experiments) { |
| 1139 if (current_experiments_.Matches(experiments)) | 1136 if (current_experiments_.Matches(experiments)) |
| 1140 return; | 1137 return; |
| 1141 | 1138 |
| 1142 current_experiments_ = experiments; | 1139 current_experiments_ = experiments; |
| 1143 | 1140 |
| 1144 // Handle preference-backed experiments first. | |
| 1145 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) { | |
| 1146 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, false); | |
| 1147 gcm::GCMProfileServiceFactory::GetForProfile(profile())->driver() | |
| 1148 ->Disable(); | |
| 1149 } else { | |
| 1150 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); | |
| 1151 gcm::GCMProfileServiceFactory::GetForProfile(profile())->driver() | |
| 1152 ->Enable(); | |
| 1153 } | |
| 1154 | |
| 1155 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1141 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
| 1156 experiments.gcm_invalidations_enabled); | 1142 experiments.gcm_invalidations_enabled); |
| 1157 profile()->GetPrefs()->SetBoolean( | 1143 profile()->GetPrefs()->SetBoolean( |
| 1158 autofill::prefs::kAutofillWalletSyncExperimentEnabled, | 1144 autofill::prefs::kAutofillWalletSyncExperimentEnabled, |
| 1159 experiments.wallet_sync_enabled); | 1145 experiments.wallet_sync_enabled); |
| 1160 | 1146 |
| 1161 if (experiments.enhanced_bookmarks_enabled) { | 1147 if (experiments.enhanced_bookmarks_enabled) { |
| 1162 profile_->GetPrefs()->SetString( | 1148 profile_->GetPrefs()->SetString( |
| 1163 sync_driver::prefs::kEnhancedBookmarksExtensionId, | 1149 sync_driver::prefs::kEnhancedBookmarksExtensionId, |
| 1164 experiments.enhanced_bookmarks_ext_id); | 1150 experiments.enhanced_bookmarks_ext_id); |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 | 2744 |
| 2759 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { | 2745 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { |
| 2760 if (sync_thread_) { | 2746 if (sync_thread_) { |
| 2761 return sync_thread_->message_loop(); | 2747 return sync_thread_->message_loop(); |
| 2762 } else if (backend_) { | 2748 } else if (backend_) { |
| 2763 return backend_->GetSyncLoopForTesting(); | 2749 return backend_->GetSyncLoopForTesting(); |
| 2764 } else { | 2750 } else { |
| 2765 return NULL; | 2751 return NULL; |
| 2766 } | 2752 } |
| 2767 } | 2753 } |
| OLD | NEW |