Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_BACKUP_ROLLBACK_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_BACKUP_ROLLBACK_CONTROLLER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 | |
| 11 class ManagedUserSigninManagerWrapper; | |
| 12 | |
| 13 namespace sync_driver { | |
| 14 class SyncPrefs; | |
| 15 } | |
| 16 | |
| 17 namespace browser_sync { | |
| 18 | |
| 19 // BackupRollbackController takes two closures for starting backup/rollback | |
| 20 // process. It calls the closures according to user's signin status or | |
| 21 // received rollback command. | |
| 22 class BackupRollbackController { | |
| 23 public: | |
| 24 BackupRollbackController(sync_driver::SyncPrefs* sync_prefs, | |
| 25 const ManagedUserSigninManagerWrapper* signin, | |
|
Nicolas Zea
2014/05/06 18:54:09
I'm not sure this is the class you want to use. Do
haitaol1
2014/05/07 21:34:17
By using ManagedUserSigninManagerWrapper, backup/r
Nicolas Zea
2014/05/08 21:43:09
Is this something we want to enforce at the client
haitaol1
2014/05/09 16:55:58
How can server enforce this given that backup back
Nicolas Zea
2014/05/13 17:39:10
The command to roll back in the first place comes
haitaol1
2014/05/13 18:08:22
That's right. But we shouldn't start backup for ma
Nicolas Zea
2014/05/14 23:17:56
Ah, now I understand. Could you add a comment expl
haitaol1
2014/05/14 23:49:27
Commented on |signin_| in .h
On 2014/05/14 23:17:
| |
| 26 base::Closure start_backup, | |
| 27 base::Closure start_rollback); | |
| 28 ~BackupRollbackController(); | |
| 29 | |
| 30 // Check to see whether to start backup/rollback. | |
| 31 void Reset(base::TimeDelta delay); | |
|
Nicolas Zea
2014/05/06 18:54:09
This isn't actually resetting anything right? Perh
haitaol1
2014/05/07 21:34:17
Done.
| |
| 32 | |
| 33 // Update rollback preference to indicate rollback is needed. | |
| 34 void OnRollbackReceived(); | |
| 35 | |
| 36 // Update rollback preference to indicate rollback is finished. | |
| 37 void OnRollbackDone(); | |
| 38 | |
| 39 private: | |
| 40 // Check signin status and rollback preference and start backup/rollback | |
| 41 // accordingly. | |
| 42 void TryStart(); | |
| 43 | |
| 44 sync_driver::SyncPrefs* sync_prefs_; | |
| 45 const ManagedUserSigninManagerWrapper* signin_; | |
| 46 base::Closure start_backup_; | |
| 47 base::Closure start_rollback_; | |
| 48 base::WeakPtrFactory<BackupRollbackController> weak_ptr_factory_; | |
|
Nicolas Zea
2014/05/06 18:54:09
disallow copy and assign
haitaol1
2014/05/07 21:34:17
Done.
| |
| 49 }; | |
| 50 | |
| 51 } // namespace browser_sync | |
| 52 | |
| 53 #endif // CHROME_BROWSER_SYNC_BACKUP_ROLLBACK_CONTROLLER_H_ | |
| OLD | NEW |