| 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 25 matching lines...) Expand all Loading... |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 namespace policy { | 38 namespace policy { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 std::string GetCloudPolicyManagementDomain( | 42 std::string GetCloudPolicyManagementDomain( |
| 43 const CloudPolicyManager* cloud_policy_manager) { | 43 const CloudPolicyManager* cloud_policy_manager) { |
| 44 const CloudPolicyStore* const store = cloud_policy_manager->core()->store(); | 44 const CloudPolicyStore* const store = cloud_policy_manager->core()->store(); |
| 45 if (store) { | 45 if (store) { |
| 46 CHECK(store->is_initialized()) | 46 // Cloud policy management domain must be requested only after the policy |
| 47 << "Cloud policy management domain must be " | 47 // system is fully initialized |
| 48 "requested only after the policy system is fully initialized"; | 48 CHECK(store->is_initialized()); |
| 49 if (store->is_managed() && store->policy()->has_username()) | 49 if (store->is_managed() && store->policy()->has_username()) |
| 50 return gaia::ExtractDomainName(store->policy()->username()); | 50 return gaia::ExtractDomainName(store->policy()->username()); |
| 51 } | 51 } |
| 52 return ""; | 52 return ""; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 ProfilePolicyConnector::ProfilePolicyConnector() | 57 ProfilePolicyConnector::ProfilePolicyConnector() |
| 58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const char* name) const { | 197 const char* name) const { |
| 198 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); | 198 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); |
| 199 for (const ConfigurationPolicyProvider* provider : policy_providers_) { | 199 for (const ConfigurationPolicyProvider* provider : policy_providers_) { |
| 200 if (provider->policies().Get(chrome_ns).Get(name)) | 200 if (provider->policies().Get(chrome_ns).Get(name)) |
| 201 return provider; | 201 return provider; |
| 202 } | 202 } |
| 203 return nullptr; | 203 return nullptr; |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace policy | 206 } // namespace policy |
| OLD | NEW |