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 11 matching lines...) Expand all Loading... | |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
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" |
Andrew T Wilson (Slow)
2014/04/24 08:35:10
Do we still need this include (gcm_profile_service
bartfab (slow)
2014/04/24 08:41:02
Yes, because GCMProfileServiceFactory::GetForProfi
| |
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/chrome_report_unrecoverable_error.h" | 39 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
39 #include "chrome/browser/sync/glue/device_info.h" | 40 #include "chrome/browser/sync/glue/device_info.h" |
40 #include "chrome/browser/sync/glue/favicon_cache.h" | 41 #include "chrome/browser/sync/glue/favicon_cache.h" |
41 #include "chrome/browser/sync/glue/sync_backend_host.h" | 42 #include "chrome/browser/sync/glue/sync_backend_host.h" |
42 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 43 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
43 #include "chrome/browser/sync/glue/sync_start_util.h" | 44 #include "chrome/browser/sync/glue/sync_start_util.h" |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
962 if (current_experiments_.Matches(experiments)) | 963 if (current_experiments_.Matches(experiments)) |
963 return; | 964 return; |
964 | 965 |
965 current_experiments_ = experiments; | 966 current_experiments_ = experiments; |
966 | 967 |
967 // Handle preference-backed experiments first. | 968 // Handle preference-backed experiments first. |
968 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { | 969 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { |
969 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, | 970 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, |
970 experiments.gcm_channel_state == | 971 experiments.gcm_channel_state == |
971 syncer::Experiments::ENABLED); | 972 syncer::Experiments::ENABLED); |
972 gcm::GCMProfileService* gcm_profile_service = | 973 gcm::GCMService* gcm_service = |
973 gcm::GCMProfileServiceFactory::GetForProfile(profile()); | 974 gcm::GCMProfileServiceFactory::GetForProfile(profile()); |
974 if (gcm_profile_service) { | 975 if (gcm_service) { |
975 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) | 976 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) |
976 gcm_profile_service->Stop(); | 977 gcm_service->Stop(); |
977 else | 978 else |
978 gcm_profile_service->Start(); | 979 gcm_service->Start(); |
979 } | 980 } |
980 } else { | 981 } else { |
981 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); | 982 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); |
982 } | 983 } |
983 | 984 |
984 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 985 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
985 experiments.gcm_invalidations_enabled); | 986 experiments.gcm_invalidations_enabled); |
986 | 987 |
987 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( | 988 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( |
988 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); | 989 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2313 status.last_get_token_error = last_get_token_error_; | 2314 status.last_get_token_error = last_get_token_error_; |
2314 if (request_access_token_retry_timer_.IsRunning()) | 2315 if (request_access_token_retry_timer_.IsRunning()) |
2315 status.next_token_request_time = next_token_request_time_; | 2316 status.next_token_request_time = next_token_request_time_; |
2316 return status; | 2317 return status; |
2317 } | 2318 } |
2318 | 2319 |
2319 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2320 void ProfileSyncService::OverrideNetworkResourcesForTest( |
2320 scoped_ptr<syncer::NetworkResources> network_resources) { | 2321 scoped_ptr<syncer::NetworkResources> network_resources) { |
2321 network_resources_ = network_resources.Pass(); | 2322 network_resources_ = network_resources.Pass(); |
2322 } | 2323 } |
OLD | NEW |