Chromium Code Reviews| Index: chrome/browser/policy/profile_policy_connector.cc |
| diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc |
| index 0573a8a35ca32de2542af356a7da44b55ce03405..aec5ce8fd8c79d628974235b4d55049550e642d9 100644 |
| --- a/chrome/browser/policy/profile_policy_connector.cc |
| +++ b/chrome/browser/policy/profile_policy_connector.cc |
| @@ -154,7 +154,22 @@ void ProfilePolicyConnector::Shutdown() { |
| bool ProfilePolicyConnector::IsManaged() const { |
| if (is_managed_override_) |
| return *is_managed_override_; |
| - return !GetManagementDomain().empty(); |
| + if (policy_store_) |
| + return policy_store_->is_managed(); |
| +#if defined(OS_CHROMEOS) |
|
Thiemo Nagel
2017/02/15 16:23:03
Nit: Instead of duplicating that code, I'd suggest
Marton Hunyady
2017/02/15 20:13:54
Done.
|
| + if (special_user_policy_provider_) { |
| + // If |special_user_policy_provider_| is non-null the profile is managed iff |
| + // the device itself is managed. |
| + const DeviceCloudPolicyManagerChromeOS* const device_cloud_policy_manager = |
| + g_browser_process->platform_part() |
| + ->browser_policy_connector_chromeos() |
| + ->GetDeviceCloudPolicyManager(); |
| + // The device_cloud_policy_manager can be a nullptr in unit tests. |
| + if (device_cloud_policy_manager) |
| + return device_cloud_policy_manager->core()->store()->is_managed(); |
| + } |
| +#endif |
| + return false; |
| } |
| std::string ProfilePolicyConnector::GetManagementDomain() const { |