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

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

Issue 2512733004: Request device policy from authpolicyd (Closed)
Patch Set: Expand AD --> Active Directory 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..57b376d4ca458124f90fcaf03ad362531a0f40a4 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() {}
@@ -24,10 +26,12 @@ void DeviceActiveDirectoryPolicyManager::Init(SchemaRegistry* registry) {
ConfigurationPolicyProvider::Init(registry);
store_->AddObserver(this);
- PublishPolicy();
if (!store_->is_initialized()) {
store_->Load();
}
+
+ // Does nothing if |store_| hasn't yet initialized.
+ PublishPolicy();
}
void DeviceActiveDirectoryPolicyManager::Shutdown() {
@@ -43,7 +47,15 @@ bool DeviceActiveDirectoryPolicyManager::IsInitializationComplete(
}
void DeviceActiveDirectoryPolicyManager::RefreshPolicies() {
- store_->Load();
+ chromeos::DBusThreadManager* thread_manager =
+ chromeos::DBusThreadManager::Get();
+ DCHECK(thread_manager);
+ chromeos::AuthPolicyClient* auth_policy_client =
+ thread_manager->GetAuthPolicyClient();
+ DCHECK(auth_policy_client);
+ auth_policy_client->RefreshDevicePolicy(
+ base::Bind(&DeviceActiveDirectoryPolicyManager::OnPolicyRefreshed,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DeviceActiveDirectoryPolicyManager::OnStoreLoaded(
@@ -77,4 +89,13 @@ void DeviceActiveDirectoryPolicyManager::PublishPolicy() {
UpdatePolicy(std::move(bundle));
}
+void DeviceActiveDirectoryPolicyManager::OnPolicyRefreshed(bool success) {
+ if (!success) {
+ LOG(ERROR) << "Active Directory policy refresh failed.";
+ }
+ // Load independently of success or failure to keep up to date with whatever
+ // has happened on the authpolicyd / session manager side.
+ store_->Load();
+}
+
} // 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