| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/profile_policy_connector_factory.h" | 5 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 10 #include "chrome/browser/policy/profile_policy_connector.h" | 12 #include "chrome/browser/policy/profile_policy_connector.h" |
| 11 #include "chrome/browser/profiles/incognito_helpers.h" | 13 #include "chrome/browser/profiles/incognito_helpers.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "components/policy/core/common/policy_service.h" | 16 #include "components/policy/core/common/policy_service.h" |
| 15 | 17 |
| 16 #if defined(ENABLE_CONFIGURATION_POLICY) | 18 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 connector->Init( | 132 connector->Init( |
| 131 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
| 132 user, | 134 user, |
| 133 #endif | 135 #endif |
| 134 schema_registry, user_cloud_policy_manager); | 136 schema_registry, user_cloud_policy_manager); |
| 135 } else { | 137 } else { |
| 136 PolicyServiceImpl::Providers providers; | 138 PolicyServiceImpl::Providers providers; |
| 137 providers.push_back(test_providers_.front()); | 139 providers.push_back(test_providers_.front()); |
| 138 test_providers_.pop_front(); | 140 test_providers_.pop_front(); |
| 139 scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers)); | 141 scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers)); |
| 140 connector->InitForTesting(service.Pass()); | 142 connector->InitForTesting(std::move(service)); |
| 141 } | 143 } |
| 142 #else | 144 #else |
| 143 connector->Init(nullptr, nullptr); | 145 connector->Init(nullptr, nullptr); |
| 144 #endif | 146 #endif |
| 145 | 147 |
| 146 connectors_[context] = connector.get(); | 148 connectors_[context] = connector.get(); |
| 147 return connector.Pass(); | 149 return connector; |
| 148 } | 150 } |
| 149 | 151 |
| 150 void ProfilePolicyConnectorFactory::BrowserContextShutdown( | 152 void ProfilePolicyConnectorFactory::BrowserContextShutdown( |
| 151 content::BrowserContext* context) { | 153 content::BrowserContext* context) { |
| 152 if (Profile::FromBrowserContext(context)->IsOffTheRecord()) | 154 if (Profile::FromBrowserContext(context)->IsOffTheRecord()) |
| 153 return; | 155 return; |
| 154 const ConnectorMap::const_iterator it = connectors_.find(context); | 156 const ConnectorMap::const_iterator it = connectors_.find(context); |
| 155 if (it != connectors_.end()) | 157 if (it != connectors_.end()) |
| 156 it->second->Shutdown(); | 158 it->second->Shutdown(); |
| 157 } | 159 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 169 | 171 |
| 170 bool ProfilePolicyConnectorFactory::HasTestingFactory( | 172 bool ProfilePolicyConnectorFactory::HasTestingFactory( |
| 171 content::BrowserContext* context) { | 173 content::BrowserContext* context) { |
| 172 return false; | 174 return false; |
| 173 } | 175 } |
| 174 | 176 |
| 175 void ProfilePolicyConnectorFactory::CreateServiceNow( | 177 void ProfilePolicyConnectorFactory::CreateServiceNow( |
| 176 content::BrowserContext* context) {} | 178 content::BrowserContext* context) {} |
| 177 | 179 |
| 178 } // namespace policy | 180 } // namespace policy |
| OLD | NEW |