Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / consumer_unenrollment_handler_factory.cc
blobb44377e39f8c628c68ba855d4582d3247dc8465a
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"
15 namespace policy {
17 // static
18 ConsumerUnenrollmentHandler*
19 ConsumerUnenrollmentHandlerFactory::GetForBrowserContext(
20 content::BrowserContext* context) {
21 return static_cast<ConsumerUnenrollmentHandler*>(
22 GetInstance()->GetServiceForBrowserContext(context, true));
25 // static
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(
50 context));
53 } // namespace policy