Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: chrome/browser/chromeos/arc/arc_watchdog_service.h

Issue 2165643004: arc: add enterprise_reporting.mojom interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698