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

Side by Side Diff: components/arc/user_data/arc_user_data_service.h

Issue 2573463002: Remove unused ArcUserDataService. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/user_data/arc_user_data_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_
6 #define COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "chromeos/dbus/session_manager_client.h"
14 #include "components/arc/arc_bridge_service.h"
15 #include "components/arc/arc_service.h"
16 #include "components/prefs/pref_change_registrar.h"
17 #include "components/prefs/pref_member.h"
18 #include "components/signin/core/account_id/account_id.h"
19
20 namespace arc {
21
22 class ArcBridgeService;
23
24 // This class controls the lifecycle of ARC user data, removing it when
25 // necessary.
26 class ArcUserDataService : public ArcService,
27 public ArcBridgeService::Observer {
28 public:
29 explicit ArcUserDataService(
30 ArcBridgeService* arc_bridge_service,
31 std::unique_ptr<BooleanPrefMember> arc_enabled_pref,
32 const AccountId& account_id);
33 ~ArcUserDataService() override;
34
35 using ArcDataCallback = chromeos::SessionManagerClient::ArcCallback;
36
37 // ArcBridgeService::Observer:
38 // Called whenever the arc bridge is stopped to potentially wipe data if
39 // the user has not opted in or it is required.
40 void OnBridgeStopped(ArcBridgeService::StopReason reason) override;
41
42 // Requires to wipe ARC user data after the next ARC bridge shutdown and call
43 // |callback| with an operation result.
44 void RequireUserDataWiped(const ArcDataCallback& callback);
45
46 private:
47 base::ThreadChecker thread_checker_;
48
49 // Checks if ARC is both stopped and disabled (not opt-in) or data wipe is
50 // required and triggers removal of user data.
51 void WipeIfRequired();
52
53 // Callback when the kArcEnabled preference changes. It watches for instances
54 // where the preference is disabled and remembers this so that it can wipe
55 // user data once the bridge has stopped.
56 void OnOptInPreferenceChanged();
57
58 const std::unique_ptr<BooleanPrefMember> arc_enabled_pref_;
59
60 // Account ID for the account for which we currently have opt-in information.
61 AccountId primary_user_account_id_;
62
63 // Registrar used to monitor ARC enabled state.
64 PrefChangeRegistrar pref_change_registrar_;
65
66 // Set to true when kArcEnabled goes from true to false or user data wipe is
67 // required and set to false again after user data has been wiped.
68 // This ensures data is wiped even if the user tries to enable ARC before the
69 // bridge has shut down.
70 bool arc_user_data_wipe_required_ = false;
71
72 // Callback object that is passed to RemoveArcData to be invoked with a
73 // result of ARC user data wipe.
74 // Set when ARC user data wipe is required by RequireUserDataWiped.
75 ArcDataCallback callback_;
76
77 base::WeakPtrFactory<ArcUserDataService> weak_ptr_factory_;
78
79 DISALLOW_COPY_AND_ASSIGN(ArcUserDataService);
80 };
81
82 } // namespace arc
83
84 #endif // COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE_H_
OLDNEW
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/user_data/arc_user_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698