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

Side by Side Diff: chrome/browser/sync/backup_rollback_controller.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/backup_rollback_controller.h" 5 #include "chrome/browser/sync/backup_rollback_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" 10 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 sync_prefs_->SetRemainingRollbackTries(0); 45 sync_prefs_->SetRemainingRollbackTries(0);
46 base::MessageLoop::current()->PostTask(FROM_HERE, start_backup_); 46 base::MessageLoop::current()->PostTask(FROM_HERE, start_backup_);
47 return true; 47 return true;
48 } 48 }
49 49
50 bool BackupRollbackController::StartRollback() { 50 bool BackupRollbackController::StartRollback() {
51 if (!IsBackupEnabled()) 51 if (!IsBackupEnabled())
52 return false; 52 return false;
53 53
54 // Don't roll back if disabled or user is signed in. 54 // Don't roll back if disabled or user is signed in.
55 if (CommandLine::ForCurrentProcess()->HasSwitch( 55 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
56 switches::kSyncDisableRollback) || 56 switches::kSyncDisableRollback) ||
57 !signin_->GetEffectiveUsername().empty()) { 57 !signin_->GetEffectiveUsername().empty()) {
58 sync_prefs_->SetRemainingRollbackTries(0); 58 sync_prefs_->SetRemainingRollbackTries(0);
59 return false; 59 return false;
60 } 60 }
61 61
62 int rollback_tries = sync_prefs_->GetRemainingRollbackTries(); 62 int rollback_tries = sync_prefs_->GetRemainingRollbackTries();
63 if (rollback_tries <= 0) 63 if (rollback_tries <= 0)
64 return false; // No pending rollback. 64 return false; // No pending rollback.
65 65
(...skipping 13 matching lines...) Expand all
79 sync_prefs_->SetRemainingRollbackTries(0); 79 sync_prefs_->SetRemainingRollbackTries(0);
80 #endif 80 #endif
81 } 81 }
82 82
83 // static 83 // static
84 bool BackupRollbackController::IsBackupEnabled() { 84 bool BackupRollbackController::IsBackupEnabled() {
85 #if defined(ENABLE_PRE_SYNC_BACKUP) 85 #if defined(ENABLE_PRE_SYNC_BACKUP)
86 const std::string group_name = 86 const std::string group_name =
87 base::FieldTrialList::FindFullName(kSyncBackupFinchName); 87 base::FieldTrialList::FindFullName(kSyncBackupFinchName);
88 88
89 if (CommandLine::ForCurrentProcess()->HasSwitch( 89 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
90 switches::kSyncDisableBackup) || 90 switches::kSyncDisableBackup) ||
91 group_name == kSyncBackupFinchDisabled) { 91 group_name == kSyncBackupFinchDisabled) {
92 return false; 92 return false;
93 } 93 }
94 return true; 94 return true;
95 #else 95 #else
96 return false; 96 return false;
97 #endif 97 #endif
98 } 98 }
99 99
100 } // namespace browser_sync 100 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698