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 #include "chrome/browser/chromeos/policy/consumer_unenrollment_handler_factory.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/browser_process_platform_part.h"
9 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
11 #include "chrome/browser/chromeos/policy/consumer_unenrollment_handler.h"
12 #include "chrome/browser/chromeos/settings/device_settings_service.h"
13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 ConsumerUnenrollmentHandler
*
19 ConsumerUnenrollmentHandlerFactory::GetForBrowserContext(
20 content::BrowserContext
* context
) {
21 return static_cast<ConsumerUnenrollmentHandler
*>(
22 GetInstance()->GetServiceForBrowserContext(context
, true));
26 ConsumerUnenrollmentHandlerFactory
*
27 ConsumerUnenrollmentHandlerFactory::GetInstance() {
28 return Singleton
<ConsumerUnenrollmentHandlerFactory
>::get();
31 ConsumerUnenrollmentHandlerFactory::ConsumerUnenrollmentHandlerFactory()
32 : BrowserContextKeyedServiceFactory(
33 "ConsumerUnenrollmentHandler",
34 BrowserContextDependencyManager::GetInstance()) {
35 DependsOn(chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance());
38 ConsumerUnenrollmentHandlerFactory::~ConsumerUnenrollmentHandlerFactory() {
41 KeyedService
* ConsumerUnenrollmentHandlerFactory::BuildServiceInstanceFor(
42 content::BrowserContext
* context
) const {
43 BrowserPolicyConnectorChromeOS
* connector
=
44 g_browser_process
->platform_part()->browser_policy_connector_chromeos();
45 return new ConsumerUnenrollmentHandler(
46 chromeos::DeviceSettingsService::Get(),
47 connector
->GetConsumerManagementService(),
48 connector
->GetDeviceCloudPolicyManager(),
49 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(