Chromium Code Reviews| Index: components/arc/user_data/arc_user_data_service.h |
| diff --git a/components/arc/user_data/arc_user_data_service.h b/components/arc/user_data/arc_user_data_service.h |
| index 6c005029f76b85b2ac842225478781081bd39c9a..a384888e9423da96e3d30e4d13377db312ef7dac 100644 |
| --- a/components/arc/user_data/arc_user_data_service.h |
| +++ b/components/arc/user_data/arc_user_data_service.h |
| @@ -10,6 +10,7 @@ |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/threading/thread_checker.h" |
| +#include "chromeos/dbus/session_manager_client.h" |
| #include "components/arc/arc_bridge_service.h" |
| #include "components/arc/arc_service.h" |
| #include "components/prefs/pref_change_registrar.h" |
| @@ -31,19 +32,25 @@ class ArcUserDataService : public ArcService, |
| const AccountId& account_id); |
| ~ArcUserDataService() override; |
| + using ArcDataCallback = chromeos::SessionManagerClient::ArcCallback; |
| + |
| // ArcBridgeService::Observer: |
| - // Called whenever the arc bridge is stopped to potentially remove data if |
| - // the user has not opted in. |
| + // Called whenever the arc bridge is stopped to potentially wipe data if |
| + // the user has not opted in or it is required. |
| void OnBridgeStopped(ArcBridgeService::StopReason reason) override; |
| + // Requires to wipe ARC user data after the next ARC bridge shutdown and call |
| + // |callback| with an operation result. |
| + void RequireUserDataWiped(const ArcDataCallback& callback); |
| + |
| private: |
| base::ThreadChecker thread_checker_; |
| - // Checks if ARC is both stopped and disabled (not opt-in) and triggers |
| - // removal of user data if both conditions are true. |
| - void ClearIfDisabled(); |
| + // Checks if ARC is both stopped and disabled (not opt-in) or data wipe is |
| + // required and triggers removal of user data. |
| + void WipeIfRequired(); |
| - // Callback when the kArcEnabled preference changes. It watches for instances |
| + // Callback when the kArcEnabled preference changes. It watches for instances |
| // where the preference is disabled and remembers this so that it can wipe |
| // user data once the bridge has stopped. |
| void OnOptInPreferenceChanged(); |
| @@ -57,9 +64,15 @@ class ArcUserDataService : public ArcService, |
| PrefChangeRegistrar pref_change_registrar_; |
| // Set to true when kArcEnabled goes from true to false and set to false |
| - // again after user data has been wiped. This ensures data is wiped even if |
| - // the user tries to enable ARC before the bridge has shut down. |
| - bool arc_disabled_ = false; |
| + // again after user data has been wiped or user data wipe is required. |
|
Luis Héctor Chávez
2016/07/25 16:47:57
"or user data wipe is required". Is this part corr
Polina Bondarenko
2016/07/25 17:19:44
Fixed, thanks for catch!
|
| + // This ensures data is wiped even if the user tries to enable ARC before the |
| + // bridge has shut down. |
| + bool arc_user_data_wipe_required_ = false; |
| + |
| + // Callback object that is passed to RemoveArcData to be invoked with a |
| + // result of ARC user data wipe. |
| + // Set when ARC user data wipe is required by RequireUserDataWiped. |
| + ArcDataCallback callback_; |
| base::WeakPtrFactory<ArcUserDataService> weak_ptr_factory_; |