| 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 #include "chrome/browser/chromeos/arc/arc_enterprise_reporting_service.h" | |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/bind.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | |
| 12 #include "components/arc/arc_bridge_service.h" | |
| 13 #include "components/arc/arc_service_manager.h" | |
| 14 #include "components/arc/user_data/arc_user_data_service.h" | |
| 15 | |
| 16 namespace arc { | |
| 17 | |
| 18 ArcEnterpriseReportingService::ArcEnterpriseReportingService( | |
| 19 ArcBridgeService* bridge_service) | |
| 20 : ArcService(bridge_service), binding_(this), weak_ptr_factory_(this) { | |
| 21 arc_bridge_service()->enterprise_reporting()->AddObserver(this); | |
| 22 } | |
| 23 | |
| 24 ArcEnterpriseReportingService::~ArcEnterpriseReportingService() { | |
| 25 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 26 arc_bridge_service()->enterprise_reporting()->RemoveObserver(this); | |
| 27 } | |
| 28 | |
| 29 void ArcEnterpriseReportingService::OnInstanceReady() { | |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 31 auto* instance = | |
| 32 arc_bridge_service()->enterprise_reporting()->GetInstanceForMethod( | |
| 33 "Init"); | |
| 34 DCHECK(instance); | |
| 35 instance->Init(binding_.CreateInterfacePtrAndBind()); | |
| 36 } | |
| 37 | |
| 38 void ArcEnterpriseReportingService::ReportManagementState( | |
| 39 mojom::ManagementState state) { | |
| 40 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 41 VLOG(1) << "ReportManagementState state=" << state; | |
| 42 | |
| 43 if (state == mojom::ManagementState::MANAGED_DO_LOST) { | |
| 44 DCHECK(ArcServiceManager::Get()); | |
| 45 ArcAuthService::Get()->RemoveArcData(); | |
| 46 ArcAuthService::Get()->StopAndEnableArc(); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 } // namespace arc | |
| OLD | NEW |