Index: chrome/browser/chromeos/arc/arc_watchdog_service.h |
diff --git a/chrome/browser/chromeos/arc/arc_watchdog_service.h b/chrome/browser/chromeos/arc/arc_watchdog_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94cd7a0bf1fe7b4c9a29c92c7ef3179a024e3ebb |
--- /dev/null |
+++ b/chrome/browser/chromeos/arc/arc_watchdog_service.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_WATCHDOG_SERVICE_H_ |
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_WATCHDOG_SERVICE_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 ArcWatchdogService |
+ : public ArcService, |
+ public mojom::WatchdogHost, |
+ public ArcBridgeService::Observer, |
+ public InstanceHolder<mojom::WatchdogInstance>::Observer { |
+ public: |
+ explicit ArcWatchdogService(ArcBridgeService* bridge_service); |
+ ~ArcWatchdogService() override; |
+ |
+ // ArcBridgeService::Observer: |
+ void OnBridgeStopped(ArcBridgeService::StopReason reason) override; |
+ |
+ // InstanceHolder<mojom::WatchdogInstance>::Observer: |
+ void OnInstanceReady() override; |
+ |
+ // mojom::WatchdogHost: |
+ void ClearArcData() override; |
+ |
+ private: |
+ void RestartArc(); |
+ |
+ mojo::Binding<WatchdogHost> binding_; |
+ bool restart_required_ = false; |
+ |
+ base::WeakPtrFactory<ArcWatchdogService> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ArcWatchdogService); |
+}; |
+ |
+} // namespace arc |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WATCHDOG_SERVICE_H_ |