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/strings/string16.h" | 22 #include "base/strings/string16.h" |
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" | |
27 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 27 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/defaults.h" | 29 #include "chrome/browser/defaults.h" |
31 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 30 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
32 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 31 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
33 #include "chrome/browser/password_manager/password_store_factory.h" | 32 #include "chrome/browser/password_manager/password_store_factory.h" |
34 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 33 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
35 #include "chrome/browser/prefs/pref_service_syncable.h" | 34 #include "chrome/browser/prefs/pref_service_syncable.h" |
36 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 return; | 1149 return; |
1151 | 1150 |
1152 current_experiments_ = experiments; | 1151 current_experiments_ = experiments; |
1153 | 1152 |
1154 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, | 1153 profile()->GetPrefs()->SetBoolean(prefs::kInvalidationServiceUseGCMChannel, |
1155 experiments.gcm_invalidations_enabled); | 1154 experiments.gcm_invalidations_enabled); |
1156 profile()->GetPrefs()->SetBoolean( | 1155 profile()->GetPrefs()->SetBoolean( |
1157 autofill::prefs::kAutofillWalletSyncExperimentEnabled, | 1156 autofill::prefs::kAutofillWalletSyncExperimentEnabled, |
1158 experiments.wallet_sync_enabled); | 1157 experiments.wallet_sync_enabled); |
1159 | 1158 |
1160 if (experiments.enhanced_bookmarks_enabled) { | |
1161 profile_->GetPrefs()->SetString( | |
1162 sync_driver::prefs::kEnhancedBookmarksExtensionId, | |
1163 experiments.enhanced_bookmarks_ext_id); | |
1164 } else { | |
1165 profile_->GetPrefs()->ClearPref( | |
1166 sync_driver::prefs::kEnhancedBookmarksExtensionId); | |
1167 } | |
1168 UpdateBookmarksExperimentState( | |
1169 profile_->GetPrefs(), g_browser_process->local_state(), true, | |
1170 experiments.enhanced_bookmarks_enabled ? BOOKMARKS_EXPERIMENT_ENABLED : | |
1171 BOOKMARKS_EXPERIMENT_NONE); | |
1172 | |
1173 // If this is a first time sync for a client, this will be called before | 1159 // If this is a first time sync for a client, this will be called before |
1174 // OnBackendInitialized() to ensure the new datatypes are available at sync | 1160 // OnBackendInitialized() to ensure the new datatypes are available at sync |
1175 // setup. As a result, the migrator won't exist yet. This is fine because for | 1161 // setup. As a result, the migrator won't exist yet. This is fine because for |
1176 // first time sync cases we're only concerned with making the datatype | 1162 // first time sync cases we're only concerned with making the datatype |
1177 // available. | 1163 // available. |
1178 if (migrator_.get() && | 1164 if (migrator_.get() && |
1179 migrator_->state() != browser_sync::BackendMigrator::IDLE) { | 1165 migrator_->state() != browser_sync::BackendMigrator::IDLE) { |
1180 DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy."; | 1166 DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy."; |
1181 return; | 1167 return; |
1182 } | 1168 } |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2767 std::string birthday; | 2753 std::string birthday; |
2768 syncer::UserShare* user_share = GetUserShare(); | 2754 syncer::UserShare* user_share = GetUserShare(); |
2769 if (user_share && user_share->directory.get()) { | 2755 if (user_share && user_share->directory.get()) { |
2770 birthday = user_share->directory->store_birthday(); | 2756 birthday = user_share->directory->store_birthday(); |
2771 } | 2757 } |
2772 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { | 2758 if (!access_token_.empty() && !cache_guid.empty() && !birthday.empty()) { |
2773 sync_stopped_reporter_->ReportSyncStopped( | 2759 sync_stopped_reporter_->ReportSyncStopped( |
2774 access_token_, cache_guid, birthday); | 2760 access_token_, cache_guid, birthday); |
2775 } | 2761 } |
2776 } | 2762 } |
OLD | NEW |