Index: chrome/browser/chromeos/arc/arc_user_data_host.h |
diff --git a/chrome/browser/chromeos/arc/arc_user_data_host.h b/chrome/browser/chromeos/arc/arc_user_data_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e949c4503c356bf479c588ab10f682c65df445a9 |
--- /dev/null |
+++ b/chrome/browser/chromeos/arc/arc_user_data_host.h |
@@ -0,0 +1,49 @@ |
+// 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 CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_HOST_H_ |
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_HOST_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/arc/arc_bridge_service.h" |
+#include "components/arc/arc_service.h" |
+#include "components/arc/instance_holder.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+ |
+namespace arc { |
+ |
+// This class performs ARC user data wipe and restarts ARC. |
+class ArcUserDataHost |
+ : public ArcService, |
+ public mojom::UserDataHost, |
+ public ArcBridgeService::Observer, |
+ public InstanceHolder<mojom::UserDataInstance>::Observer { |
+ public: |
+ explicit ArcUserDataHost(ArcBridgeService* bridge_service); |
+ ~ArcUserDataHost() override; |
+ |
+ // ArcBridgeService::Observer: |
+ void OnBridgeStopped(ArcBridgeService::StopReason reason) override; |
+ |
+ // InstanceHolder<mojom::UserDataInstance>::Observer: |
+ void OnInstanceReady() override; |
+ |
+ // mojom::UserDataHost: |
+ void ClearArcData() override; |
+ |
+ private: |
+ void RestartArc(); |
+ |
+ mojo::Binding<UserDataHost> binding_; |
+ bool restart_required_ = false; |
+ |
+ base::WeakPtrFactory<ArcUserDataHost> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ArcUserDataHost); |
+}; |
+ |
+} // namespace arc |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_USER_DATA_HOST_H_ |