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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
22 #include "base/profiler/scoped_tracker.h" | 22 #include "base/profiler/scoped_tracker.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | |
28 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 28 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
30 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
31 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
32 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 31 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
33 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 32 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
34 #include "chrome/browser/password_manager/password_store_factory.h" | 33 #include "chrome/browser/password_manager/password_store_factory.h" |
35 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 34 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
36 #include "chrome/browser/prefs/pref_service_syncable.h" | 35 #include "chrome/browser/prefs/pref_service_syncable.h" |
37 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 return; | 1156 return; |
1158 | 1157 |
1159 current_experiments_ = experiments; | 1158 current_experiments_ = experiments; |
1160 | 1159 |
1161 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1160 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
1162 experiments.gcm_invalidations_enabled); | 1161 experiments.gcm_invalidations_enabled); |
1163 profile()->GetPrefs()->SetBoolean( | 1162 profile()->GetPrefs()->SetBoolean( |
1164 autofill::prefs::kAutofillWalletSyncExperimentEnabled, | 1163 autofill::prefs::kAutofillWalletSyncExperimentEnabled, |
1165 experiments.wallet_sync_enabled); | 1164 experiments.wallet_sync_enabled); |
1166 | 1165 |
1167 if (experiments.enhanced_bookmarks_enabled) { | |
1168 profile_->GetPrefs()->SetString( | |
1169 sync_driver::prefs::kEnhancedBookmarksExtensionId, | |
1170 experiments.enhanced_bookmarks_ext_id); | |
1171 } else { | |
1172 profile_->GetPrefs()->ClearPref( | |
1173 sync_driver::prefs::kEnhancedBookmarksExtensionId); | |
1174 } | |
1175 UpdateBookmarksExperimentState( | |
1176 profile_->GetPrefs(), g_browser_process->local_state(), true, | |
1177 experiments.enhanced_bookmarks_enabled ? BOOKMARKS_EXPERIMENT_ENABLED : | |
1178 BOOKMARKS_EXPERIMENT_NONE); | |
1179 | |
1180 // If this is a first time sync for a client, this will be called before | 1166 // If this is a first time sync for a client, this will be called before |
1181 // OnBackendInitialized() to ensure the new datatypes are available at sync | 1167 // OnBackendInitialized() to ensure the new datatypes are available at sync |
1182 // setup. As a result, the migrator won't exist yet. This is fine because for | 1168 // setup. As a result, the migrator won't exist yet. This is fine because for |
1183 // first time sync cases we're only concerned with making the datatype | 1169 // first time sync cases we're only concerned with making the datatype |
1184 // available. | 1170 // available. |
1185 if (migrator_.get() && | 1171 if (migrator_.get() && |
1186 migrator_->state() != browser_sync::BackendMigrator::IDLE) { | 1172 migrator_->state() != browser_sync::BackendMigrator::IDLE) { |
1187 DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy."; | 1173 DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy."; |
1188 return; | 1174 return; |
1189 } | 1175 } |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2774 std::string birthday; | 2760 std::string birthday; |
2775 syncer::UserShare* user_share = GetUserShare(); | 2761 syncer::UserShare* user_share = GetUserShare(); |
2776 if (user_share && user_share->directory.get()) { | 2762 if (user_share && user_share->directory.get()) { |
2777 birthday = user_share->directory->store_birthday(); | 2763 birthday = user_share->directory->store_birthday(); |
2778 } | 2764 } |
2779 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { | 2765 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { |
2780 sync_stopped_reporter_->ReportSyncStopped( | 2766 sync_stopped_reporter_->ReportSyncStopped( |
2781 access_token_, cache_guid, birthday); | 2767 access_token_, cache_guid, birthday); |
2782 } | 2768 } |
2783 } | 2769 } |
OLD | NEW |