Chromium Code Reviews| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 if (special_user_policy_provider_) | 147 if (special_user_policy_provider_) |
| 148 special_user_policy_provider_->Shutdown(); | 148 special_user_policy_provider_->Shutdown(); |
| 149 #endif | 149 #endif |
| 150 if (wrapped_platform_policy_provider_) | 150 if (wrapped_platform_policy_provider_) |
| 151 wrapped_platform_policy_provider_->Shutdown(); | 151 wrapped_platform_policy_provider_->Shutdown(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool ProfilePolicyConnector::IsManaged() const { | 154 bool ProfilePolicyConnector::IsManaged() const { |
| 155 if (is_managed_override_) | 155 if (is_managed_override_) |
| 156 return *is_managed_override_; | 156 return *is_managed_override_; |
| 157 if (policy_store_) | |
| 158 return policy_store_->is_managed(); | |
| 157 return !GetManagementDomain().empty(); | 159 return !GetManagementDomain().empty(); |
|
Thiemo Nagel
2017/02/14 17:06:03
I'd suggest to use the store also in the case of s
Marton Hunyady
2017/02/14 19:22:17
Done.
| |
| 158 } | 160 } |
| 159 | 161 |
| 160 std::string ProfilePolicyConnector::GetManagementDomain() const { | 162 std::string ProfilePolicyConnector::GetManagementDomain() const { |
| 161 if (policy_store_) | 163 if (policy_store_) |
| 162 return GetStoreManagementDomain(policy_store_); | 164 return GetStoreManagementDomain(policy_store_); |
| 163 #if defined(OS_CHROMEOS) | 165 #if defined(OS_CHROMEOS) |
| 164 if (special_user_policy_provider_) { | 166 if (special_user_policy_provider_) { |
| 165 // |special_user_policy_provider_| is non-null for device-local accounts and | 167 // |special_user_policy_provider_| is non-null for device-local accounts and |
| 166 // for the login profile. | 168 // for the login profile. |
| 167 // They receive policy iff the device itself is managed. | 169 // They receive policy iff the device itself is managed. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 189 const char* policy_key) const { | 191 const char* policy_key) const { |
| 190 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); | 192 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); |
| 191 for (const ConfigurationPolicyProvider* provider : policy_providers_) { | 193 for (const ConfigurationPolicyProvider* provider : policy_providers_) { |
| 192 if (provider->policies().Get(chrome_ns).Get(policy_key)) | 194 if (provider->policies().Get(chrome_ns).Get(policy_key)) |
| 193 return provider; | 195 return provider; |
| 194 } | 196 } |
| 195 return nullptr; | 197 return nullptr; |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace policy | 200 } // namespace policy |
| OLD | NEW |