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

Side by Side Diff: components/arc/user_data/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: Addressed comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE
6 #define COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE
7
8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h"
10 #include "components/arc/arc_bridge_service.h"
11 #include "components/arc/arc_service.h"
12 #include "components/signin/core/account_id/account_id.h"
13
14 class PrefService;
15
16 namespace arc {
17
18 class ArcServiceManager;
19 class ArcBridgeService;
20
21 // This class controls the lifecycle of ARC user data, removing it when
22 // necessary.
23 class ArcUserDataService : public ArcService,
24 public ArcBridgeService::Observer {
25 public:
26 explicit ArcUserDataService(const ArcServiceManager* arc_service_manager,
27 ArcBridgeService* arc_bridge_service);
28 ~ArcUserDataService() override;
29
30 // ArcBridgeService::Observer:
31 // Called whenever the arc bridge is stopped to potentially remove data if
32 // the user has not opted in.
33 void OnBridgeStopped() override;
34
35 // Updates the internal tracking copy of the primary user account id and
36 // clears the ARC user data if appropriate.
37 void OnPrimaryUserProfilePrepared(const AccountId& account_id);
38
39 private:
40 base::ThreadChecker thread_checker_;
41
42 // Checks if ARC is both stopped and disabled (not opt-in) and triggers
43 // removal of user data if both conditions are true.
44 void ClearIfDisabled();
45
46 // Account ID for the account for which we currently have opt-in information.
47 AccountId primary_user_account_id_ = EmptyAccountId();
48
49 // Instances of this class are always owned by arc_service_manager_, so
50 // arc_service_manager_ will always be available the entire lifetime of the
51 // instance.
52 const ArcServiceManager* const arc_service_manager_;
53
54 DISALLOW_COPY_AND_ASSIGN(ArcUserDataService);
55 };
56
57 } // namespace arc
58
59 #endif // COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698