#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/field_trial.h"
#include "chrome/browser/sync/managed_user_signin_manager_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "components/sync_driver/sync_prefs.h"
#if defined(ENABLE_PRE_SYNC_BACKUP)
// Number of rollback attempts to try before giving up.
static const int kRollbackLimits = 3;
+
+// Finch experiment name and group.
+static char kSyncBackupFinchName[] = "SyncBackup";
+static char kSyncBackupFinchDisabled[] = "disabled";
#endif
BackupRollbackController::BackupRollbackController(
}
void BackupRollbackController::Start(base::TimeDelta delay) {
-#if defined(ENABLE_PRE_SYNC_BACKUP)
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSyncDisableBackup)) {
+ if (!IsBackupEnabled())
return;
- }
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSyncEnableRollback)) {
weak_ptr_factory_.GetWeakPtr()),
delay);
}
-#endif
}
void BackupRollbackController::OnRollbackReceived() {
}
}
+// static
+bool BackupRollbackController::IsBackupEnabled() {
+#if defined(ENABLE_PRE_SYNC_BACKUP)
+ const std::string group_name =
+ base::FieldTrialList::FindFullName(kSyncBackupFinchName);
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSyncDisableBackup) ||
+ group_name == kSyncBackupFinchDisabled) {
+ return false;
+ }
+ return true;
+#else
+ return false;
+#endif
+}
+
} // namespace browser_sync