Chromium Code Reviews| 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 if (current_experiments_.Matches(experiments)) | 1006 if (current_experiments_.Matches(experiments)) |
| 1006 return; | 1007 return; |
| 1007 | 1008 |
| 1008 current_experiments_ = experiments; | 1009 current_experiments_ = experiments; |
| 1009 | 1010 |
| 1010 // Handle preference-backed experiments first. | 1011 // Handle preference-backed experiments first. |
| 1011 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { | 1012 if (experiments.gcm_channel_state != syncer::Experiments::UNSET) { |
| 1012 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, | 1013 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, |
| 1013 experiments.gcm_channel_state == | 1014 experiments.gcm_channel_state == |
| 1014 syncer::Experiments::ENABLED); | 1015 syncer::Experiments::ENABLED); |
| 1015 gcm::GCMProfileService* gcm_profile_service = | 1016 gcm::GCMService* gcm_service = |
|
jianli
2014/04/10 20:39:56
GCMProfileServiceFactory::GetForProfile returns GC
bartfab (slow)
2014/04/11 16:58:52
I wanted to make it explicit that in this case her
| |
| 1016 gcm::GCMProfileServiceFactory::GetForProfile(profile()); | 1017 gcm::GCMProfileServiceFactory::GetForProfile(profile()); |
| 1017 if (gcm_profile_service) { | 1018 if (gcm_service) { |
| 1018 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) | 1019 if (experiments.gcm_channel_state == syncer::Experiments::SUPPRESSED) |
| 1019 gcm_profile_service->Stop(); | 1020 gcm_service->Stop(); |
| 1020 else | 1021 else |
| 1021 gcm_profile_service->Start(); | 1022 gcm_service->Start(); |
| 1022 } | 1023 } |
| 1023 } else { | 1024 } else { |
| 1024 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); | 1025 profile()->GetPrefs()->ClearPref(prefs::kGCMChannelEnabled); |
| 1025 } | 1026 } |
| 1026 | 1027 |
| 1027 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1028 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
| 1028 experiments.gcm_invalidations_enabled); | 1029 experiments.gcm_invalidations_enabled); |
| 1029 | 1030 |
| 1030 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( | 1031 int bookmarks_experiment_state_before = profile_->GetPrefs()->GetInteger( |
| 1031 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); | 1032 sync_driver::prefs::kEnhancedBookmarksExperimentEnabled); |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2356 status.last_get_token_error = last_get_token_error_; | 2357 status.last_get_token_error = last_get_token_error_; |
| 2357 if (request_access_token_retry_timer_.IsRunning()) | 2358 if (request_access_token_retry_timer_.IsRunning()) |
| 2358 status.next_token_request_time = next_token_request_time_; | 2359 status.next_token_request_time = next_token_request_time_; |
| 2359 return status; | 2360 return status; |
| 2360 } | 2361 } |
| 2361 | 2362 |
| 2362 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2363 void ProfileSyncService::OverrideNetworkResourcesForTest( |
| 2363 scoped_ptr<syncer::NetworkResources> network_resources) { | 2364 scoped_ptr<syncer::NetworkResources> network_resources) { |
| 2364 network_resources_ = network_resources.Pass(); | 2365 network_resources_ = network_resources.Pass(); |
| 2365 } | 2366 } |
| OLD | NEW |