OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_WATCHDOG_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_WATCHDOG_SERVICE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/arc/arc_bridge_service.h" |
| 11 #include "components/arc/arc_service.h" |
| 12 #include "components/arc/instance_holder.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 |
| 15 namespace arc { |
| 16 |
| 17 // This class performs ARC user data wipe and restarts ARC. |
| 18 class ArcWatchdogService |
| 19 : public ArcService, |
| 20 public mojom::WatchdogHost, |
| 21 public ArcBridgeService::Observer, |
| 22 public InstanceHolder<mojom::WatchdogInstance>::Observer { |
| 23 public: |
| 24 explicit ArcWatchdogService(ArcBridgeService* bridge_service); |
| 25 ~ArcWatchdogService() override; |
| 26 |
| 27 // ArcBridgeService::Observer: |
| 28 void OnBridgeStopped(ArcBridgeService::StopReason reason) override; |
| 29 |
| 30 // InstanceHolder<mojom::WatchdogInstance>::Observer: |
| 31 void OnInstanceReady() override; |
| 32 |
| 33 // mojom::WatchdogHost: |
| 34 void ClearArcData() override; |
| 35 |
| 36 private: |
| 37 void RestartArc(); |
| 38 |
| 39 mojo::Binding<WatchdogHost> binding_; |
| 40 bool restart_required_ = false; |
| 41 |
| 42 base::WeakPtrFactory<ArcWatchdogService> weak_factory_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ArcWatchdogService); |
| 45 }; |
| 46 |
| 47 } // namespace arc |
| 48 |
| 49 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WATCHDOG_SERVICE_H_ |
OLD | NEW |