| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" | 5 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 Profile::FromBrowserContext(context)); | 98 Profile::FromBrowserContext(context)); |
| 99 #else | 99 #else |
| 100 CloudPolicyManager* manager = | 100 CloudPolicyManager* manager = |
| 101 UserCloudPolicyManagerFactory::GetForBrowserContext(context); | 101 UserCloudPolicyManagerFactory::GetForBrowserContext(context); |
| 102 #endif | 102 #endif |
| 103 if (!manager) | 103 if (!manager) |
| 104 return NULL; | 104 return NULL; |
| 105 CloudPolicyStore* user_store = manager->core()->store(); | 105 CloudPolicyStore* user_store = manager->core()->store(); |
| 106 CloudPolicyStore* device_store = NULL; | 106 CloudPolicyStore* device_store = NULL; |
| 107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
| 108 // TODO(tnagel): Add support for Active Directory management. |
| 109 if (!connector->GetDeviceCloudPolicyManager()) |
| 110 return NULL; |
| 108 device_store = connector->GetDeviceCloudPolicyManager()->core()->store(); | 111 device_store = connector->GetDeviceCloudPolicyManager()->core()->store(); |
| 109 #endif | 112 #endif |
| 110 | 113 |
| 111 std::unique_ptr<PolicyHeaderService> service = | 114 std::unique_ptr<PolicyHeaderService> service = |
| 112 base::MakeUnique<PolicyHeaderService>( | 115 base::MakeUnique<PolicyHeaderService>( |
| 113 device_management_service->GetServerUrl(), kPolicyVerificationKeyHash, | 116 device_management_service->GetServerUrl(), kPolicyVerificationKeyHash, |
| 114 user_store, device_store); | 117 user_store, device_store); |
| 115 return new PolicyHeaderServiceWrapper(std::move(service)); | 118 return new PolicyHeaderServiceWrapper(std::move(service)); |
| 116 } | 119 } |
| 117 | 120 |
| 118 // static | 121 // static |
| 119 PolicyHeaderServiceFactory* PolicyHeaderServiceFactory::GetInstance() { | 122 PolicyHeaderServiceFactory* PolicyHeaderServiceFactory::GetInstance() { |
| 120 return base::Singleton<PolicyHeaderServiceFactory>::get(); | 123 return base::Singleton<PolicyHeaderServiceFactory>::get(); |
| 121 } | 124 } |
| 122 | 125 |
| 123 } // namespace policy | 126 } // namespace policy |
| OLD | NEW |