OLD | NEW |
(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_USERDATA_ARC_USER_DATA_SERVICE |
| 6 #define COMPONENTS_ARC_USERDATA_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/signin/core/account_id/account_id.h" |
| 12 |
| 13 class PrefService; |
| 14 |
| 15 namespace arc { |
| 16 |
| 17 class ArcBridgeService; |
| 18 |
| 19 // This class controls the lifecycle of ARC user data, removing it when |
| 20 // necessary. |
| 21 class ArcUserDataService : public ArcBridgeService::Observer { |
| 22 public: |
| 23 ArcUserDataService(); |
| 24 ~ArcUserDataService() override; |
| 25 |
| 26 static ArcUserDataService* Get(); |
| 27 |
| 28 // Checks if arc is both stopped and disabled (opt-out) and triggers removal |
| 29 // of user data if both conditions are true. |
| 30 void ClearIfDisabled(PrefService* user_prefs, const AccountId& account_id); |
| 31 |
| 32 // Called whenever arc service state changes to potentially remove data if |
| 33 // the user has opted out. |
| 34 // ArcBridgeService::Observer: |
| 35 void OnStateChanged(ArcBridgeService::State state) override; |
| 36 |
| 37 private: |
| 38 base::ThreadChecker thread_checker_; |
| 39 |
| 40 PrefService* user_prefs_; |
| 41 AccountId user_prefs_account_id_ = EmptyAccountId(); |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(ArcUserDataService); |
| 44 }; |
| 45 |
| 46 } // namespace arc |
| 47 |
| 48 #endif // COMPONENTS_ARC_USERDATA_ARC_USER_DATA_SERVICE |
OLD | NEW |