| Index: components/arc/user_data/arc_user_data_service.h
|
| diff --git a/components/arc/user_data/arc_user_data_service.h b/components/arc/user_data/arc_user_data_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0b308b9717ee6ef97b75f5014fbb017a5681a436
|
| --- /dev/null
|
| +++ b/components/arc/user_data/arc_user_data_service.h
|
| @@ -0,0 +1,59 @@
|
| +// 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_USER_DATA_ARC_USER_DATA_SERVICE
|
| +#define COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/threading/thread_checker.h"
|
| +#include "components/arc/arc_bridge_service.h"
|
| +#include "components/arc/arc_service.h"
|
| +#include "components/signin/core/account_id/account_id.h"
|
| +
|
| +class PrefService;
|
| +
|
| +namespace arc {
|
| +
|
| +class ArcServiceManager;
|
| +class ArcBridgeService;
|
| +
|
| +// This class controls the lifecycle of ARC user data, removing it when
|
| +// necessary.
|
| +class ArcUserDataService : public ArcService,
|
| + public ArcBridgeService::Observer {
|
| + public:
|
| + explicit ArcUserDataService(const ArcServiceManager* arc_service_manager,
|
| + ArcBridgeService* arc_bridge_service);
|
| + ~ArcUserDataService() override;
|
| +
|
| + // ArcBridgeService::Observer:
|
| + // Called whenever the arc bridge is stopped to potentially remove data if
|
| + // the user has not opted in.
|
| + void OnBridgeStopped() override;
|
| +
|
| + // Updates the internal tracking copy of the primary user account id and
|
| + // clears the ARC user data if appropriate.
|
| + void OnPrimaryUserProfilePrepared(const AccountId& account_id);
|
| +
|
| + private:
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| + // Checks if ARC is both stopped and disabled (not opt-in) and triggers
|
| + // removal of user data if both conditions are true.
|
| + void ClearIfDisabled();
|
| +
|
| + // Account ID for the account for which we currently have opt-in information.
|
| + AccountId primary_user_account_id_ = EmptyAccountId();
|
| +
|
| + // Instances of this class are always owned by arc_service_manager_, so
|
| + // arc_service_manager_ will always be available the entire lifetime of the
|
| + // instance.
|
| + const ArcServiceManager* const arc_service_manager_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ArcUserDataService);
|
| +};
|
| +
|
| +} // namespace arc
|
| +
|
| +#endif // COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE
|
|
|