| 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.h" | 5 #include "chrome/browser/policy/profile_policy_connector.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 11 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 12 #include "components/policy/core/browser/browser_policy_connector.h" | 14 #include "components/policy/core/browser/browser_policy_connector.h" |
| 13 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 14 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 15 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 16 #include "components/policy/core/common/configuration_policy_provider.h" | 18 #include "components/policy/core/common/configuration_policy_provider.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (is_primary_user_) { | 125 if (is_primary_user_) { |
| 124 if (user_cloud_policy_manager) | 126 if (user_cloud_policy_manager) |
| 125 connector->SetUserPolicyDelegate(user_cloud_policy_manager); | 127 connector->SetUserPolicyDelegate(user_cloud_policy_manager); |
| 126 else if (special_user_policy_provider_) | 128 else if (special_user_policy_provider_) |
| 127 connector->SetUserPolicyDelegate(special_user_policy_provider_.get()); | 129 connector->SetUserPolicyDelegate(special_user_policy_provider_.get()); |
| 128 } | 130 } |
| 129 #endif | 131 #endif |
| 130 } | 132 } |
| 131 | 133 |
| 132 void ProfilePolicyConnector::InitForTesting(scoped_ptr<PolicyService> service) { | 134 void ProfilePolicyConnector::InitForTesting(scoped_ptr<PolicyService> service) { |
| 133 policy_service_ = service.Pass(); | 135 policy_service_ = std::move(service); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void ProfilePolicyConnector::OverrideIsManagedForTesting(bool is_managed) { | 138 void ProfilePolicyConnector::OverrideIsManagedForTesting(bool is_managed) { |
| 137 is_managed_override_.reset(new bool(is_managed)); | 139 is_managed_override_.reset(new bool(is_managed)); |
| 138 } | 140 } |
| 139 | 141 |
| 140 void ProfilePolicyConnector::Shutdown() { | 142 void ProfilePolicyConnector::Shutdown() { |
| 141 #if defined(OS_CHROMEOS) | 143 #if defined(OS_CHROMEOS) |
| 142 if (is_primary_user_) { | 144 if (is_primary_user_) { |
| 143 BrowserPolicyConnectorChromeOS* connector = | 145 BrowserPolicyConnectorChromeOS* connector = |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 const char* name) const { | 190 const char* name) const { |
| 189 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); | 191 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); |
| 190 for (const ConfigurationPolicyProvider* provider : policy_providers_) { | 192 for (const ConfigurationPolicyProvider* provider : policy_providers_) { |
| 191 if (provider->policies().Get(chrome_ns).Get(name)) | 193 if (provider->policies().Get(chrome_ns).Get(name)) |
| 192 return provider; | 194 return provider; |
| 193 } | 195 } |
| 194 return nullptr; | 196 return nullptr; |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace policy | 199 } // namespace policy |
| OLD | NEW |