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

Unified Diff: chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc

Issue 2512733004: Request device policy from authpolicyd (Closed)
Patch Set: Created 4 years, 1 month 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/chromeos/policy/device_active_directory_policy_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc
diff --git a/chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc b/chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc
index 8c349ff1e198c28963752d02a2bd211909c97b45..7b760531644cd0c7772e85f6e83fc57b0b25a80d 100644
--- a/chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc
+++ b/chrome/browser/chromeos/policy/device_active_directory_policy_manager.cc
@@ -9,6 +9,8 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "chromeos/dbus/auth_policy_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_types.h"
@@ -16,7 +18,7 @@ namespace policy {
DeviceActiveDirectoryPolicyManager::DeviceActiveDirectoryPolicyManager(
std::unique_ptr<CloudPolicyStore> store)
- : store_(std::move(store)) {}
+ : store_(std::move(store)), weak_ptr_factory_(this) {}
DeviceActiveDirectoryPolicyManager::~DeviceActiveDirectoryPolicyManager() {}
@@ -43,7 +45,19 @@ bool DeviceActiveDirectoryPolicyManager::IsInitializationComplete(
}
void DeviceActiveDirectoryPolicyManager::RefreshPolicies() {
- store_->Load();
+ chromeos::DBusThreadManager* thread_manager =
+ chromeos::DBusThreadManager::Get();
+ if (!thread_manager) {
+ return;
+ }
+ chromeos::AuthPolicyClient* auth_policy_client =
+ thread_manager->GetAuthPolicyClient();
+ if (!auth_policy_client) {
+ return;
+ }
Roman Sorokin (ftl) 2016/11/18 15:07:48 Don't check for the null or use DCHECK
Thiemo Nagel 2016/11/21 16:40:23 Done.
+ auth_policy_client->RefreshDevicePolicy(
+ base::Bind(&DeviceActiveDirectoryPolicyManager::OnPolicyRefreshed,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DeviceActiveDirectoryPolicyManager::OnStoreLoaded(
@@ -77,4 +91,10 @@ void DeviceActiveDirectoryPolicyManager::PublishPolicy() {
UpdatePolicy(std::move(bundle));
}
+void DeviceActiveDirectoryPolicyManager::OnPolicyRefreshed(bool success) {
+ if (success) {
+ store_->Load();
+ }
Roman Sorokin (ftl) 2016/11/18 15:07:48 Add error log in case of a failure.
+}
+
} // namespace policy
« no previous file with comments | « chrome/browser/chromeos/policy/device_active_directory_policy_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698