Index: components/arc/userdata/arc_user_data_service.h |
diff --git a/components/arc/userdata/arc_user_data_service.h b/components/arc/userdata/arc_user_data_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..52dc58cb618345d22d57e1d974f6f447d78a2637 |
--- /dev/null |
+++ b/components/arc/userdata/arc_user_data_service.h |
@@ -0,0 +1,48 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_ARC_USERDATA_ARC_USER_DATA_SERVICE |
+#define COMPONENTS_ARC_USERDATA_ARC_USER_DATA_SERVICE |
+ |
+#include "base/macros.h" |
+#include "base/threading/thread_checker.h" |
+#include "components/arc/arc_bridge_service.h" |
+#include "components/signin/core/account_id/account_id.h" |
+ |
+class PrefService; |
+ |
+namespace arc { |
+ |
+class ArcBridgeService; |
+ |
+// This class controls the lifecycle of ARC user data, removing it when |
+// necessary. |
+class ArcUserDataService : public ArcBridgeService::Observer { |
+ public: |
+ ArcUserDataService(); |
+ ~ArcUserDataService() override; |
+ |
+ static ArcUserDataService* Get(); |
+ |
+ // Checks if arc is both stopped and disabled (opt-out) and triggers removal |
+ // of user data if both conditions are true. |
+ void ClearIfDisabled(PrefService* user_prefs, const AccountId& account_id); |
+ |
+ // Called whenever arc service state changes to potentially remove data if |
+ // the user has opted out. |
+ // ArcBridgeService::Observer: |
+ void OnStateChanged(ArcBridgeService::State state) override; |
+ |
+ private: |
+ base::ThreadChecker thread_checker_; |
+ |
+ PrefService* user_prefs_; |
+ AccountId user_prefs_account_id_ = EmptyAccountId(); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ArcUserDataService); |
+}; |
+ |
+} // namespace arc |
+ |
+#endif // COMPONENTS_ARC_USERDATA_ARC_USER_DATA_SERVICE |