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

Side by Side Diff: chrome/browser/chromeos/arc/arc_watchdog_service.cc

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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/arc/arc_watchdog_service.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "chrome/browser/chromeos/arc/arc_watchdog_service.h"
6
7 #include "base/bind.h"
8 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
9 #include "content/public/browser/browser_thread.h"
10
11 namespace arc {
12
13 ArcWatchdogService::ArcWatchdogService(ArcBridgeService* bridge_service)
14 : ArcService(bridge_service), binding_(this), weak_factory_(this) {
15 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
16 arc_bridge_service()->AddObserver(this);
17 arc_bridge_service()->watchdog()->AddObserver(this);
18 }
19
20 ArcWatchdogService::~ArcWatchdogService() {
21 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
22
23 arc_bridge_service()->watchdog()->RemoveObserver(this);
24 arc_bridge_service()->RemoveObserver(this);
25 }
26
27 void ArcWatchdogService::OnInstanceReady() {
28 arc_bridge_service()->watchdog()->instance()->Init(
29 binding_.CreateInterfacePtrAndBind());
30 }
31
32 void ArcWatchdogService::OnBridgeStopped(ArcBridgeService::StopReason reason) {
33 if (restart_required_) {
34 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
35 base::Bind(&ArcWatchdogService::RestartArc,
36 weak_factory_.GetWeakPtr()));
uekawa- 2016/07/21 11:55:38 is it safe to immediately restart ? I recall there
Polina Bondarenko 2016/07/22 08:16:54 Fixed a CL, but the call, that you're talking abou
37 }
38 }
39
40 void ArcWatchdogService::ClearArcData() {
41 restart_required_ = true;
42 ArcAuthService::Get()->StopArc();
43 }
44
45 void ArcWatchdogService::RestartArc() {
46 restart_required_ = false;
47 ArcAuthService::Get()->RestartArc();
48 }
49
50 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_watchdog_service.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698