Chromium Code Reviews| 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_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/signin/core/account_id/account_id.h" | |
| 12 | |
| 13 class PrefService; | |
| 14 | |
| 15 namespace arc { | |
| 16 | |
| 17 class ArcServiceManager; | |
| 18 class ArcBridgeService; | |
| 19 | |
| 20 // This class controls the lifecycle of ARC user data, removing it when | |
| 21 // necessary. | |
| 22 class ArcUserDataService : public ArcBridgeService::Observer { | |
|
hidehiko
2016/06/13 09:05:05
Please inherit ArcService, so that the lifetime ma
dspaid
2016/06/14 00:38:17
Done
| |
| 23 public: | |
| 24 explicit ArcUserDataService(const ArcServiceManager* arc_service_manager); | |
| 25 ~ArcUserDataService() override; | |
| 26 | |
| 27 // ArcBridgeService::Observer: | |
| 28 // Called whenever the arc bridge is stopped to potentially remove data if | |
| 29 // the user has not opted in. | |
| 30 void OnBridgeStopped() override; | |
| 31 | |
| 32 // Updates the internal tracking copy of the primary user account id and | |
| 33 // clears the ARC user data if appropriate. | |
| 34 void OnPrimaryUserProfilePrepared(const AccountId& account_id); | |
| 35 | |
| 36 private: | |
| 37 base::ThreadChecker thread_checker_; | |
| 38 | |
| 39 // Checks if ARC is both stopped and disabled (not opt-in) and triggers | |
| 40 // removal of user data if both conditions are true. | |
| 41 void ClearIfDisabled(); | |
| 42 | |
| 43 // Account ID for the account for which we currently have opt-in information. | |
| 44 AccountId primary_user_account_id_ = EmptyAccountId(); | |
| 45 | |
| 46 const ArcServiceManager* const arc_service_manager_; | |
|
hidehiko
2016/06/13 09:05:05
Please note that an instance of this class is mana
dspaid
2016/06/14 00:38:17
Done.
| |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ArcUserDataService); | |
| 49 }; | |
| 50 | |
| 51 } // namespace arc | |
| 52 | |
| 53 #endif // COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE | |
| OLD | NEW |