| 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/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 26 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/defaults.h" | 29 #include "chrome/browser/defaults.h" |
| 30 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 30 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 31 #include "chrome/browser/prefs/pref_service_syncable.h" | 31 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/services/gcm/gcm_driver.h" |
| 33 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 34 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 34 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 35 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 35 #include "chrome/browser/signin/about_signin_internals_factory.h" | 36 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 36 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 37 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 37 #include "chrome/browser/signin/signin_manager_factory.h" | 38 #include "chrome/browser/signin/signin_manager_factory.h" |
| 38 #include "chrome/browser/sync/backend_migrator.h" | 39 #include "chrome/browser/sync/backend_migrator.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/sync_backend_host.h" | 43 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1019 |
| 1019 // Handle preference-backed experiments first. | 1020 // Handle preference-backed experiments first. |
| 1020 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { | 1021 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { |
| 1021 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, | 1022 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, |
| 1022 experiments.gcm_channel_state == | 1023 experiments.gcm_channel_state == |
| 1023 syncer::Experiments::ENABLED); | 1024 syncer::Experiments::ENABLED); |
| 1024 gcm::GCMProfileService* gcm_profile_service = | 1025 gcm::GCMProfileService* gcm_profile_service = |
| 1025 gcm::GCMProfileServiceFactory::GetForProfile(profile()); | 1026 gcm::GCMProfileServiceFactory::GetForProfile(profile()); |
| 1026 if (gcm_profile_service) { | 1027 if (gcm_profile_service) { |
| 1027 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) | 1028 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) |
| 1028 gcm_profile_service->Stop(); | 1029 gcm_profile_service->driver()->Disable(); |
| 1029 else | 1030 else |
| 1030 gcm_profile_service->Start(); | 1031 gcm_profile_service->driver()->Enable(); |
| 1031 } | 1032 } |
| 1032 } else { | 1033 } else { |
| 1033 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); | 1034 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); |
| 1034 } | 1035 } |
| 1035 | 1036 |
| 1036 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1037 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
| 1037 experiments.gcm_invalidations_enabled); | 1038 experiments.gcm_invalidations_enabled); |
| 1038 | 1039 |
| 1039 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( | 1040 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( |
| 1040 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); | 1041 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 status.last_get_token_error = last_get_token_error_; | 2372 status.last_get_token_error = last_get_token_error_; |
| 2372 if (request_access_token_retry_timer_.IsRunning()) | 2373 if (request_access_token_retry_timer_.IsRunning()) |
| 2373 status.next_token_request_time = next_token_request_time_; | 2374 status.next_token_request_time = next_token_request_time_; |
| 2374 return status; | 2375 return status; |
| 2375 } | 2376 } |
| 2376 | 2377 |
| 2377 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2378 void ProfileSyncService::OverrideNetworkResourcesForTest( |
| 2378 scoped_ptr<syncer::NetworkResources> network_resources) { | 2379 scoped_ptr<syncer::NetworkResources> network_resources) { |
| 2379 network_resources_ = network_resources.Pass(); | 2380 network_resources_ = network_resources.Pass(); |
| 2380 } | 2381 } |
| OLD | NEW |