Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6875)

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 10235013: [Sync] Add support for automatic enabling of syncing tab favicons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert testserver for now Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | sync/internal_api/sync_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index e7aa25b90496cfe979f821756ed4e296c168713f..4a7f3d6a42f028b22742528273dd16062f0462cf 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -61,6 +61,7 @@
#include "sync/js/js_arg_list.h"
#include "sync/js/js_event_details.h"
#include "sync/util/cryptographer.h"
+#include "sync/util/experiments.h"
#include "ui/base/l10n/l10n_util.h"
using browser_sync::ChangeProcessor;
@@ -707,9 +708,11 @@ void ProfileSyncService::OnSyncCycleCompleted() {
NotifyObservers();
}
-// TODO(sync): eventually support removing datatypes too.
-void ProfileSyncService::OnDataTypesChanged(
- syncable::ModelTypeSet to_add) {
+void ProfileSyncService::OnExperimentsChanged(
+ const browser_sync::Experiments& experiments) {
+ if (current_experiments.Matches(experiments))
+ return;
+
// If this is a first time sync for a client, this will be called before
// OnBackendInitialized() to ensure the new datatypes are available at sync
// setup. As a result, the migrator won't exist yet. This is fine because for
@@ -717,18 +720,18 @@ void ProfileSyncService::OnDataTypesChanged(
// available.
if (migrator_.get() &&
migrator_->state() != browser_sync::BackendMigrator::IDLE) {
- DVLOG(1) << "Dropping OnDataTypesChanged due to migrator busy.";
+ DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy.";
return;
}
- DVLOG(2) << "OnDataTypesChanged called with types: "
- << syncable::ModelTypeSetToString(to_add);
-
const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes();
-
+ syncable::ModelTypeSet to_add;
+ if (experiments.sync_tabs)
+ to_add.Put(syncable::SESSIONS);
const syncable::ModelTypeSet to_register =
Difference(to_add, registered_types);
-
+ DVLOG(2) << "OnExperimentsChanged called with types: "
+ << syncable::ModelTypeSetToString(to_add);
DVLOG(2) << "Enabling types: " << syncable::ModelTypeSetToString(to_register);
for (syncable::ModelTypeSet::Iterator it = to_register.First();
@@ -768,6 +771,16 @@ void ProfileSyncService::OnDataTypesChanged(
OnMigrationNeededForTypes(to_register);
}
}
+
+ // Now enable any non-datatype features.
+ if (experiments.sync_tab_favicons) {
+ DVLOG(1) << "Enabling syncing of tab favicons.";
+ about_flags::SetExperimentEnabled(g_browser_process->local_state(),
+ "sync-tab-favicons",
+ true);
+ }
+
+ current_experiments = experiments;
}
void ProfileSyncService::UpdateAuthErrorState(
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | sync/internal_api/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698