| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/policy/active_directory_policy_manager.h" | 5 #include "chrome/browser/chromeos/policy/active_directory_policy_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "chromeos/dbus/auth_policy_client.h" | 12 #include "chromeos/dbus/auth_policy_client.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 #include "components/policy/core/common/policy_bundle.h" | 14 #include "components/policy/core/common/policy_bundle.h" |
| 15 #include "components/policy/core/common/policy_types.h" | 15 #include "components/policy/core/common/policy_types.h" |
| 16 #include "components/policy/policy_constants.h" |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 | 19 |
| 19 ActiveDirectoryPolicyManager::~ActiveDirectoryPolicyManager() {} | 20 ActiveDirectoryPolicyManager::~ActiveDirectoryPolicyManager() {} |
| 20 | 21 |
| 21 // static | 22 // static |
| 22 std::unique_ptr<ActiveDirectoryPolicyManager> | 23 std::unique_ptr<ActiveDirectoryPolicyManager> |
| 23 ActiveDirectoryPolicyManager::CreateForDevicePolicy( | 24 ActiveDirectoryPolicyManager::CreateForDevicePolicy( |
| 24 std::unique_ptr<CloudPolicyStore> store) { | 25 std::unique_ptr<CloudPolicyStore> store) { |
| 25 return base::WrapUnique( | 26 return base::WrapUnique( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 109 } |
| 109 std::unique_ptr<PolicyBundle> bundle = base::MakeUnique<PolicyBundle>(); | 110 std::unique_ptr<PolicyBundle> bundle = base::MakeUnique<PolicyBundle>(); |
| 110 PolicyMap& policy_map = | 111 PolicyMap& policy_map = |
| 111 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 112 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 112 policy_map.CopyFrom(store_->policy_map()); | 113 policy_map.CopyFrom(store_->policy_map()); |
| 113 | 114 |
| 114 // Overwrite the source which is POLICY_SOURCE_CLOUD by default. | 115 // Overwrite the source which is POLICY_SOURCE_CLOUD by default. |
| 115 // TODO(tnagel): Rename CloudPolicyStore to PolicyStore and make the source | 116 // TODO(tnagel): Rename CloudPolicyStore to PolicyStore and make the source |
| 116 // configurable, then drop PolicyMap::SetSourceForAll(). | 117 // configurable, then drop PolicyMap::SetSourceForAll(). |
| 117 policy_map.SetSourceForAll(POLICY_SOURCE_ACTIVE_DIRECTORY); | 118 policy_map.SetSourceForAll(POLICY_SOURCE_ACTIVE_DIRECTORY); |
| 119 SetEnterpriseUsersDefaults(&policy_map); |
| 118 UpdatePolicy(std::move(bundle)); | 120 UpdatePolicy(std::move(bundle)); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void ActiveDirectoryPolicyManager::OnPolicyRefreshed(bool success) { | 123 void ActiveDirectoryPolicyManager::OnPolicyRefreshed(bool success) { |
| 122 if (!success) { | 124 if (!success) { |
| 123 LOG(ERROR) << "Active Directory policy refresh failed."; | 125 LOG(ERROR) << "Active Directory policy refresh failed."; |
| 124 } | 126 } |
| 125 // Load independently of success or failure to keep up to date with whatever | 127 // Load independently of success or failure to keep up to date with whatever |
| 126 // has happened on the authpolicyd / session manager side. | 128 // has happened on the authpolicyd / session manager side. |
| 127 store_->Load(); | 129 store_->Load(); |
| 128 } | 130 } |
| 129 | 131 |
| 130 } // namespace policy | 132 } // namespace policy |
| OLD | NEW |