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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 ProfilePolicyConnector::ProfilePolicyConnector() {} | 55 ProfilePolicyConnector::ProfilePolicyConnector() {} |
56 | 56 |
57 ProfilePolicyConnector::~ProfilePolicyConnector() {} | 57 ProfilePolicyConnector::~ProfilePolicyConnector() {} |
58 | 58 |
59 void ProfilePolicyConnector::Init( | 59 void ProfilePolicyConnector::Init( |
60 const user_manager::User* user, | 60 const user_manager::User* user, |
61 SchemaRegistry* schema_registry, | 61 SchemaRegistry* schema_registry, |
62 ConfigurationPolicyProvider* configuration_policy_provider, | 62 ConfigurationPolicyProvider* configuration_policy_provider, |
63 const CloudPolicyStore* policy_store) { | 63 const CloudPolicyStore* policy_store, |
| 64 bool force_immediate_load) { |
64 configuration_policy_provider_ = configuration_policy_provider; | 65 configuration_policy_provider_ = configuration_policy_provider; |
65 policy_store_ = policy_store; | 66 policy_store_ = policy_store; |
66 | 67 |
67 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
68 BrowserPolicyConnectorChromeOS* connector = | 69 BrowserPolicyConnectorChromeOS* connector = |
69 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 70 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
70 #else | 71 #else |
71 DCHECK_EQ(nullptr, user); | 72 DCHECK_EQ(nullptr, user); |
72 BrowserPolicyConnector* connector = | 73 BrowserPolicyConnector* connector = |
73 g_browser_process->browser_policy_connector(); | 74 g_browser_process->browser_policy_connector(); |
(...skipping 27 matching lines...) Expand all Loading... |
101 special_user_policy_provider_.reset( | 102 special_user_policy_provider_.reset( |
102 new LoginProfilePolicyProvider(connector->GetPolicyService())); | 103 new LoginProfilePolicyProvider(connector->GetPolicyService())); |
103 } else { | 104 } else { |
104 // |user| should never be nullptr except for the signin profile. | 105 // |user| should never be nullptr except for the signin profile. |
105 is_primary_user_ = | 106 is_primary_user_ = |
106 user == user_manager::UserManager::Get()->GetPrimaryUser(); | 107 user == user_manager::UserManager::Get()->GetPrimaryUser(); |
107 // Note that |DeviceLocalAccountPolicyProvider::Create| returns nullptr when | 108 // Note that |DeviceLocalAccountPolicyProvider::Create| returns nullptr when |
108 // the user supplied is not a device-local account user. | 109 // the user supplied is not a device-local account user. |
109 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create( | 110 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create( |
110 user->GetAccountId().GetUserEmail(), | 111 user->GetAccountId().GetUserEmail(), |
111 connector->GetDeviceLocalAccountPolicyService()); | 112 connector->GetDeviceLocalAccountPolicyService(), force_immediate_load); |
112 } | 113 } |
113 if (special_user_policy_provider_) { | 114 if (special_user_policy_provider_) { |
114 special_user_policy_provider_->Init(schema_registry); | 115 special_user_policy_provider_->Init(schema_registry); |
115 policy_providers_.push_back(special_user_policy_provider_.get()); | 116 policy_providers_.push_back(special_user_policy_provider_.get()); |
116 } | 117 } |
117 #endif | 118 #endif |
118 | 119 |
119 policy_service_.reset(new PolicyServiceImpl(policy_providers_)); | 120 policy_service_.reset(new PolicyServiceImpl(policy_providers_)); |
120 | 121 |
121 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 const char* policy_key) const { | 198 const char* policy_key) const { |
198 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); | 199 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); |
199 for (const ConfigurationPolicyProvider* provider : policy_providers_) { | 200 for (const ConfigurationPolicyProvider* provider : policy_providers_) { |
200 if (provider->policies().Get(chrome_ns).Get(policy_key)) | 201 if (provider->policies().Get(chrome_ns).Get(policy_key)) |
201 return provider; | 202 return provider; |
202 } | 203 } |
203 return nullptr; | 204 return nullptr; |
204 } | 205 } |
205 | 206 |
206 } // namespace policy | 207 } // namespace policy |
OLD | NEW |