Index: chrome/browser/chromeos/arc/arc_user_data_service.h |
diff --git a/components/arc/user_data/arc_user_data_service.h b/chrome/browser/chromeos/arc/arc_user_data_service.h |
similarity index 56% |
rename from components/arc/user_data/arc_user_data_service.h |
rename to chrome/browser/chromeos/arc/arc_user_data_service.h |
index 6c005029f76b85b2ac842225478781081bd39c9a..a79b6bad649fc52667b10cd057d5bf689fb5e713 100644 |
--- a/components/arc/user_data/arc_user_data_service.h |
+++ b/chrome/browser/chromeos/arc/arc_user_data_service.h |
@@ -2,8 +2,8 @@ |
// 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_H_ |
-#define COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE_H_ |
+#ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_SERVICE_H_ |
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_SERVICE_H_ |
#include <memory> |
@@ -12,18 +12,21 @@ |
#include "base/threading/thread_checker.h" |
#include "components/arc/arc_bridge_service.h" |
#include "components/arc/arc_service.h" |
+#include "components/arc/instance_holder.h" |
#include "components/prefs/pref_change_registrar.h" |
#include "components/prefs/pref_member.h" |
#include "components/signin/core/account_id/account_id.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
namespace arc { |
-class ArcBridgeService; |
- |
// This class controls the lifecycle of ARC user data, removing it when |
// necessary. |
-class ArcUserDataService : public ArcService, |
- public ArcBridgeService::Observer { |
+class ArcUserDataService |
+ : public ArcService, |
+ public ArcBridgeService::Observer, |
+ public InstanceHolder<mojom::EnterpriseReportingInstance>::Observer, |
Luis Héctor Chávez
2016/07/22 15:51:42
I am a bit worried about the mismatch between the
Polina Bondarenko
2016/07/22 16:41:19
ArcEnterpriseReportingService?
|
+ public mojom::EnterpriseReportingHost { |
public: |
explicit ArcUserDataService( |
ArcBridgeService* arc_bridge_service, |
@@ -36,18 +39,26 @@ class ArcUserDataService : public ArcService, |
// the user has not opted in. |
void OnBridgeStopped(ArcBridgeService::StopReason reason) override; |
+ // InstanceHolder<mojom::EnterpriseReportingInstance>::Observer overrides: |
+ void OnInstanceReady() override; |
+ |
+ // mojom::EnterpriseReportingHost overrides: |
+ void ReportManagementState(mojom::ManagementState state) override; |
+ |
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(); |
+ // Checks if ARC is both stopped and disabled (not opt-in) or a data clean is |
+ // required and triggers removal of user data if conditions are true. |
+ void ClearIfRequired(); |
// Callback when the kArcEnabled preference changes. It watches for instances |
// where the preference is disabled and remembers this so that it can wipe |
// user data once the bridge has stopped. |
void OnOptInPreferenceChanged(); |
+ void RestartArc(); |
+ |
const std::unique_ptr<BooleanPrefMember> arc_enabled_pref_; |
// Account ID for the account for which we currently have opt-in information. |
@@ -56,10 +67,16 @@ class ArcUserDataService : public ArcService, |
// Registrar used to monitor ARC enabled state. |
PrefChangeRegistrar pref_change_registrar_; |
- // Set to true when kArcEnabled goes from true to false and set to false |
- // again after user data has been wiped. This ensures data is wiped even if |
- // the user tries to enable ARC before the bridge has shut down. |
- bool arc_disabled_ = false; |
+ // Set to true when kArcEnabled goes from true to false or data remove is |
+ // requested by mojom::EnterpriseReportingInstance and set to false again |
+ // after user data has been wiped. This ensures data is wiped even if the |
+ // user tries to enable ARC before the bridge has shut down. |
+ bool clean_required_ = false; |
Luis Héctor Chávez
2016/07/22 15:51:42
We use a lot of names to refer to this operation:
Polina Bondarenko
2016/07/25 16:17:59
Done.
|
+ |
+ // Set to true, when ARC should be restarted. |
+ bool restart_required_ = false; |
+ |
+ mojo::Binding<mojom::EnterpriseReportingHost> binding_; |
base::WeakPtrFactory<ArcUserDataService> weak_ptr_factory_; |
@@ -68,4 +85,4 @@ class ArcUserDataService : public ArcService, |
} // namespace arc |
-#endif // COMPONENTS_ARC_USER_DATA_ARC_USER_DATA_SERVICE_H_ |
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_SERVICE_H_ |