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 13 matching lines...) Expand all Loading... |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 25 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
28 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
29 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 29 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
30 #include "chrome/browser/prefs/pref_service_syncable.h" | 30 #include "chrome/browser/prefs/pref_service_syncable.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 32 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
33 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 33 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 34 #include "chrome/browser/services/gcm/gcm_service.h" |
34 #include "chrome/browser/signin/about_signin_internals_factory.h" | 35 #include "chrome/browser/signin/about_signin_internals_factory.h" |
35 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 36 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
36 #include "chrome/browser/signin/signin_manager_factory.h" | 37 #include "chrome/browser/signin/signin_manager_factory.h" |
37 #include "chrome/browser/sync/backend_migrator.h" | 38 #include "chrome/browser/sync/backend_migrator.h" |
38 #include "chrome/browser/sync/glue/change_processor.h" | 39 #include "chrome/browser/sync/glue/change_processor.h" |
39 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 40 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
40 #include "chrome/browser/sync/glue/device_info.h" | 41 #include "chrome/browser/sync/glue/device_info.h" |
41 #include "chrome/browser/sync/glue/favicon_cache.h" | 42 #include "chrome/browser/sync/glue/favicon_cache.h" |
42 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 43 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
43 #include "chrome/browser/sync/glue/session_model_associator.h" | 44 #include "chrome/browser/sync/glue/session_model_associator.h" |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 if (current_experiments_.Matches(experiments)) | 1004 if (current_experiments_.Matches(experiments)) |
1004 return; | 1005 return; |
1005 | 1006 |
1006 current_experiments_ = experiments; | 1007 current_experiments_ = experiments; |
1007 | 1008 |
1008 // Handle preference-backed experiments first. | 1009 // Handle preference-backed experiments first. |
1009 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { | 1010 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { |
1010 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, | 1011 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, |
1011 experiments.gcm_channel_state == | 1012 experiments.gcm_channel_state == |
1012 syncer::Experiments::ENABLED); | 1013 syncer::Experiments::ENABLED); |
1013 gcm::GCMProfileService* gcm_profile_service = | 1014 gcm::GCMService* gcm_service = |
1014 gcm::GCMProfileServiceFactory::GetForProfile(profile()); | 1015 gcm::GCMProfileServiceFactory::GetForProfile(profile()); |
1015 if (gcm_profile_service) { | 1016 if (gcm_service) { |
1016 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) | 1017 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) |
1017 gcm_profile_service->Stop(); | 1018 gcm_service->Stop(); |
1018 else | 1019 else |
1019 gcm_profile_service->Start(); | 1020 gcm_service->Start(); |
1020 } | 1021 } |
1021 } else { | 1022 } else { |
1022 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); | 1023 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); |
1023 } | 1024 } |
1024 | 1025 |
1025 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1026 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
1026 experiments.gcm_invalidations_enabled); | 1027 experiments.gcm_invalidations_enabled); |
1027 | 1028 |
1028 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( | 1029 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( |
1029 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); | 1030 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 status.last_get_token_error = last_get_token_error_; | 2355 status.last_get_token_error = last_get_token_error_; |
2355 if (request_access_token_retry_timer_.IsRunning()) | 2356 if (request_access_token_retry_timer_.IsRunning()) |
2356 status.next_token_request_time = next_token_request_time_; | 2357 status.next_token_request_time = next_token_request_time_; |
2357 return status; | 2358 return status; |
2358 } | 2359 } |
2359 | 2360 |
2360 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2361 void ProfileSyncService::OverrideNetworkResourcesForTest( |
2361 scoped_ptr<syncer::NetworkResources> network_resources) { | 2362 scoped_ptr<syncer::NetworkResources> network_resources) { |
2362 network_resources_ = network_resources.Pass(); | 2363 network_resources_ = network_resources.Pass(); |
2363 } | 2364 } |
OLD | NEW |