diff options
author | maxbogue <maxbogue@chromium.org> | 2015-06-19 12:24:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-19 19:25:24 +0000 |
commit | 699262c98da5f1b0075a6a9fc3dff9397128f7b1 (patch) | |
tree | 6bd9468fb72779ec9f3926859bbd39b84d8bc946 /components/sync_driver/sync_service.h | |
parent | 7c2dc58d437b8dfa269227981b0221c196888d41 (diff) | |
download | chromium_src-699262c98da5f1b0075a6a9fc3dff9397128f7b1.zip chromium_src-699262c98da5f1b0075a6a9fc3dff9397128f7b1.tar.gz chromium_src-699262c98da5f1b0075a6a9fc3dff9397128f7b1.tar.bz2 |
[Sync] Refactor the PSS methods that stop syncing.
Previously, there were three methods for stopping sync: RequestStop(),
DisableForUser() and StopSyncingPermanently(). The differences between
these are whether they set IsSyncRequested to false (DisableForUser
did not) and whether they clear the local sync data (RequestStop did
not).
In this CL there two methods for stopping sync, the public RequestStop()
and the private StopImpl(). Both take a parameter of the enum "DataFate",
which has two values: KEEP_DATA and CLEAR_DATA.
The pure logical mapping between the old and new is:
- RequestStop -> RequestStop(KEEP_DATA)
- StopSyncingPermanently -> RequestStop(CLEAR_DATA)
- DisableForUser -> StopImpl(CLEAR_DATA)
Since StopImpl() is private, any external uses of DisableForUser have been
converted to RequestStop(CLEAR_DATA), as well as some internal
uses for which it was deemed correct.
Finally, this CL contains a fix to a bug in Android's SigninManager that
those changes revealed. Previously the short circuit logic in
ProfileSyncServiceAndroid::EnableSync was preventing a crash
caused by it being called before native sign in, but with these changes
IsSyncRequested is correctly set to false and therefore the short
circuit is not hit.
BUG=495192
Review URL: https://codereview.chromium.org/1178923003
Cr-Commit-Position: refs/heads/master@{#335317}
Diffstat (limited to 'components/sync_driver/sync_service.h')
-rw-r--r-- | components/sync_driver/sync_service.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/components/sync_driver/sync_service.h b/components/sync_driver/sync_service.h index 1c869a3..264d024 100644 --- a/components/sync_driver/sync_service.h +++ b/components/sync_driver/sync_service.h @@ -27,6 +27,14 @@ class SyncService : public sync_driver::DataTypeEncryptionHandler { // during sync setup and provided a passphrase. }; + // Passed as an argument to RequestStop to control whether or not the sync + // backend should clear its data directory when it shuts down. See + // RequestStop for more information. + enum SyncStopDataFate { + KEEP_DATA, + CLEAR_DATA, + }; + ~SyncService() override {} // Whether sync is enabled by user or not. This does not necessarily mean @@ -73,11 +81,11 @@ class SyncService : public sync_driver::DataTypeEncryptionHandler { // due to http://crbug.com/121755). virtual bool CanSyncStart() const = 0; - // Disables sync for user. Use ShowLoginDialog to enable. - virtual void DisableForUser() = 0; - - // Stops sync at the user's request. - virtual void RequestStop() = 0; + // Stops sync at the user's request. |data_fate| controls whether the sync + // backend should clear its data directory when it shuts down. Generally + // KEEP_DATA is used when the user just stops sync, and CLEAR_DATA is used + // when they sign out of the profile entirely. + virtual void RequestStop(SyncStopDataFate data_fate) = 0; // The user requests that sync start. This only actually starts sync if // IsSyncAllowed is true and the user is signed in. Once sync starts, |