Index: chrome/browser/policy/user_policy_connector.h |
diff --git a/chrome/browser/policy/user_policy_connector.h b/chrome/browser/policy/user_policy_connector.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c696e1cbb4da198f4d8359fb6d8bb2f3575d982b |
--- /dev/null |
+++ b/chrome/browser/policy/user_policy_connector.h |
@@ -0,0 +1,67 @@ |
+// Copyright (c) 2011 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_POLICY_USER_POLICY_CONNECTOR_H_ |
+#define CHROME_BROWSER_POLICY_USER_POLICY_CONNECTOR_H_ |
+#pragma once |
+ |
+#include "base/basictypes.h" |
+#include "base/file_util.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/observer_list.h" |
+#include "chrome/browser/policy/configuration_policy_provider.h" |
+#include "content/common/notification_observer.h" |
+#include "content/common/notification_registrar.h" |
+ |
+class TokenService; |
+namespace policy { |
+ |
+class CloudPolicySubsystem; |
+class CloudPolicyProvider; |
+class UserPolicyIdentityStrategy; |
+ |
+// This class is a container for the user-specific policy infrastructure. |
+// There is one instance per BrowserProcess and it is also present when |
+// there is no user logged in. However, in such a case there is no |
+// CloudPolicySubsystem backend present. |
+class UserPolicyConnector : public NotificationObserver { |
+ public: |
+ static UserPolicyConnector* Create(); |
+ ~UserPolicyConnector(); |
+ |
+ // Initializes the CloudPolicySubsystem backend and throws away the old one. |
+ // TODO(sfeuz): Listen to log-out or going-away messages of TokenService and |
+ // reset the backend at that point. |
+ void Initialize(std::string& user_name, |
+ const FilePath& policy_dir, |
+ TokenService* token_service); |
+ |
+ CloudPolicyProvider* GetManagedCloudProvider() const; |
+ CloudPolicyProvider* GetRecommendedCloudProvider() const; |
+ |
+ private: |
+ UserPolicyConnector(); |
+ |
+ // NotificationObserver method overrides: |
+ virtual void Observe(NotificationType type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details); |
+ |
+ // Registers the provider for notification of successful Gaia logins. |
+ NotificationRegistrar registrar_; |
+ |
+ TokenService* token_service_; |
+ |
+ scoped_ptr<UserPolicyIdentityStrategy> identity_strategy_; |
+ scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_; |
+ |
+ scoped_ptr<CloudPolicyProvider> managed_cloud_provider_; |
+ scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(UserPolicyConnector); |
+}; |
+ |
+} // namespace policy |
+ |
+#endif // CHROME_BROWSER_POLICY_USER_POLICY_CONNECTOR_H_ |