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

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

Issue 2694933003: Return management state without retrieving the management domain if the (Closed)
Patch Set: Extract redundant logic into GetActualPolicyStore 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 | « chrome/browser/policy/profile_policy_connector.h ('k') | 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..98414a6cd0630dd0dcb7806ecaa3643cfb33470e 100644
--- a/chrome/browser/policy/profile_policy_connector.cc
+++ b/chrome/browser/policy/profile_policy_connector.cc
@@ -154,34 +154,42 @@ void ProfilePolicyConnector::Shutdown() {
bool ProfilePolicyConnector::IsManaged() const {
if (is_managed_override_)
return *is_managed_override_;
- return !GetManagementDomain().empty();
+ const CloudPolicyStore* actual_policy_store = GetActualPolicyStore();
+ if (actual_policy_store)
+ return actual_policy_store->is_managed();
+ return false;
}
std::string ProfilePolicyConnector::GetManagementDomain() const {
+ const CloudPolicyStore* actual_policy_store = GetActualPolicyStore();
+ if (actual_policy_store)
+ return GetStoreManagementDomain(actual_policy_store);
+ return std::string();
+}
+
+bool ProfilePolicyConnector::IsProfilePolicy(const char* policy_key) const {
+ const ConfigurationPolicyProvider* const provider =
+ DeterminePolicyProviderForPolicy(policy_key);
+ return provider == configuration_policy_provider_;
+}
+
+const CloudPolicyStore* ProfilePolicyConnector::GetActualPolicyStore() const {
if (policy_store_)
- return GetStoreManagementDomain(policy_store_);
+ return policy_store_;
#if defined(OS_CHROMEOS)
if (special_user_policy_provider_) {
// |special_user_policy_provider_| is non-null for device-local accounts and
// for the login profile.
- // They receive policy 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 GetStoreManagementDomain(
- device_cloud_policy_manager->core()->store());
+ return device_cloud_policy_manager->core()->store();
}
#endif
- return std::string();
-}
-
-bool ProfilePolicyConnector::IsProfilePolicy(const char* policy_key) const {
- const ConfigurationPolicyProvider* const provider =
- DeterminePolicyProviderForPolicy(policy_key);
- return provider == configuration_policy_provider_;
+ return nullptr;
}
const ConfigurationPolicyProvider*
« no previous file with comments | « chrome/browser/policy/profile_policy_connector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698