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

Unified Diff: components/arc/userdata/arc_user_data_service.h

Issue 1966133002: Run RemoveArcData after a user has opted out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed DEPS Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698