Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: chrome/browser/policy/profile_policy_connector.cc

Issue 2694933003: Return management state without retrieving the management domain if the (Closed)
Patch Set: Add special_user_policy_provider case Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698