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

Unified Diff: chrome/browser/chromeos/policy/user_active_directory_policy_manager.h

Issue 2606773002: Setup Chromad user policy plumbing (Closed)
Patch Set: Rebase Created 4 years 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
Index: chrome/browser/chromeos/policy/user_active_directory_policy_manager.h
diff --git a/chrome/browser/chromeos/policy/user_active_directory_policy_manager.h b/chrome/browser/chromeos/policy/user_active_directory_policy_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..fcdb485af7361394fd0440f873a5ca706e30bf40
--- /dev/null
+++ b/chrome/browser/chromeos/policy/user_active_directory_policy_manager.h
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
+#define CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "components/policy/core/common/cloud/cloud_policy_store.h"
+#include "components/policy/core/common/configuration_policy_provider.h"
+#include "components/signin/core/account_id/account_id.h"
+
+namespace policy {
+
+// ConfigurationPolicyProvider for policy from Active Directory. The policy is
+// fetched from the Domain Controller by authpolicyd which stores it in session
+// manager and from where it is loaded by UserActiveDirectoryPolicyManager.
+// TODO(tnagel): This is a slightly modified copy of
+// DeviceActiveDirectoryPolicyManager ==> merge the two classes.
+class UserActiveDirectoryPolicyManager : public ConfigurationPolicyProvider,
+ public CloudPolicyStore::Observer {
+ public:
+ UserActiveDirectoryPolicyManager(const AccountId& account_id,
+ std::unique_ptr<CloudPolicyStore> store);
+ ~UserActiveDirectoryPolicyManager() override;
+
+ // ConfigurationPolicyProvider:
+ void Init(SchemaRegistry* registry) override;
+ void Shutdown() override;
+ bool IsInitializationComplete(PolicyDomain domain) const override;
+ void RefreshPolicies() override;
+
+ // CloudPolicyStore::Observer:
+ void OnStoreLoaded(CloudPolicyStore* cloud_policy_store) override;
+ void OnStoreError(CloudPolicyStore* cloud_policy_store) override;
+
+ CloudPolicyStore* store() const { return store_.get(); }
+
+ private:
+ // Publishes the policy that's currently cached in the store.
+ void PublishPolicy();
+
+ // Callback from authpolicyd.
+ void OnPolicyRefreshed(bool success);
+
+ const AccountId account_id_;
+ std::unique_ptr<CloudPolicyStore> store_;
+
+ // Must be last member.
+ base::WeakPtrFactory<UserActiveDirectoryPolicyManager> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(UserActiveDirectoryPolicyManager);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_ACTIVE_DIRECTORY_POLICY_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698