| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "components/policy/core/browser/browser_policy_connector.h" | 13 #include "components/policy/core/browser/browser_policy_connector.h" |
| 14 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 14 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 15 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 16 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 17 #include "components/policy/core/common/configuration_policy_provider.h" | 17 #include "components/policy/core/common/configuration_policy_provider.h" |
| 18 #include "components/policy/core/common/forwarding_policy_provider.h" | 18 #include "components/policy/core/common/forwarding_policy_provider.h" |
| 19 #include "components/policy/core/common/policy_service_impl.h" | 19 #include "components/policy/core/common/policy_service_impl.h" |
| 20 #include "google_apis/gaia/gaia_auth_util.h" | 20 #include "google_apis/gaia/gaia_auth_util.h" |
| 21 | 21 |
| 22 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
| 23 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 24 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 25 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 26 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" |
| 27 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" | 26 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" |
| 28 #include "components/user_manager/user.h" | 27 #include "components/user_manager/user.h" |
| 28 #include "components/user_manager/user_manager.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 namespace policy { | 31 namespace policy { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 bool HasChromePolicy(ConfigurationPolicyProvider* provider, | 35 bool HasChromePolicy(ConfigurationPolicyProvider* provider, |
| 36 const char* name) { | 36 const char* name) { |
| 37 if (!provider) | 37 if (!provider) |
| 38 return false; | 38 return false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 providers.push_back(user_cloud_policy_manager); | 99 providers.push_back(user_cloud_policy_manager); |
| 100 | 100 |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 if (!user) { | 102 if (!user) { |
| 103 DCHECK(schema_registry); | 103 DCHECK(schema_registry); |
| 104 // This case occurs for the signin profile. | 104 // This case occurs for the signin profile. |
| 105 special_user_policy_provider_.reset( | 105 special_user_policy_provider_.reset( |
| 106 new LoginProfilePolicyProvider(connector->GetPolicyService())); | 106 new LoginProfilePolicyProvider(connector->GetPolicyService())); |
| 107 } else { | 107 } else { |
| 108 // |user| should never be NULL except for the signin profile. | 108 // |user| should never be NULL except for the signin profile. |
| 109 is_primary_user_ = user == chromeos::UserManager::Get()->GetPrimaryUser(); | 109 is_primary_user_ = |
| 110 user == user_manager::UserManager::Get()->GetPrimaryUser(); |
| 110 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create( | 111 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create( |
| 111 user->email(), | 112 user->email(), |
| 112 connector->GetDeviceLocalAccountPolicyService()); | 113 connector->GetDeviceLocalAccountPolicyService()); |
| 113 } | 114 } |
| 114 if (special_user_policy_provider_) { | 115 if (special_user_policy_provider_) { |
| 115 special_user_policy_provider_->Init(schema_registry); | 116 special_user_policy_provider_->Init(schema_registry); |
| 116 providers.push_back(special_user_policy_provider_.get()); | 117 providers.push_back(special_user_policy_provider_.get()); |
| 117 } | 118 } |
| 118 #endif | 119 #endif |
| 119 | 120 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 BrowserPolicyConnectorChromeOS* connector = | 175 BrowserPolicyConnectorChromeOS* connector = |
| 175 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 176 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 176 if (HasChromePolicy(connector->GetDeviceCloudPolicyManager(), name)) | 177 if (HasChromePolicy(connector->GetDeviceCloudPolicyManager(), name)) |
| 177 return false; | 178 return false; |
| 178 #endif | 179 #endif |
| 179 | 180 |
| 180 return true; | 181 return true; |
| 181 } | 182 } |
| 182 | 183 |
| 183 } // namespace policy | 184 } // namespace policy |
| OLD | NEW |