1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_UNENROLLMENT_HANDLER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_UNENROLLMENT_HANDLER_H_
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/keyed_service/core/keyed_service.h"
13 class DeviceSettingsService
;
14 class OwnerSettingsServiceChromeOS
;
19 class ConsumerManagementService
;
20 class DeviceCloudPolicyManagerChromeOS
;
22 // ConsumerUnenrollmentHandler unenrolls the device from the consumer management
23 // service. It sends a request to the server and resets the management settings.
24 class ConsumerUnenrollmentHandler
: public KeyedService
{
26 ConsumerUnenrollmentHandler(
27 chromeos::DeviceSettingsService
* device_settings_service
,
28 ConsumerManagementService
* consumer_management_service
,
29 DeviceCloudPolicyManagerChromeOS
* device_cloud_policy_manager
,
30 chromeos::OwnerSettingsServiceChromeOS
* owner_settings_service
);
31 ~ConsumerUnenrollmentHandler() override
;
33 // Starts the unenrollment process.
37 void OnUnregistered(bool success
);
38 void OnManagementSettingsSet(bool success
);
40 chromeos::DeviceSettingsService
* device_settings_service_
;
41 ConsumerManagementService
* consumer_management_service_
;
42 DeviceCloudPolicyManagerChromeOS
* device_cloud_policy_manager_
;
43 chromeos::OwnerSettingsServiceChromeOS
* owner_settings_service_
;
45 base::WeakPtrFactory
<ConsumerUnenrollmentHandler
> weak_factory_
;
47 DISALLOW_COPY_AND_ASSIGN(ConsumerUnenrollmentHandler
);
52 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_UNENROLLMENT_HANDLER_H_