OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_USER_POLICY_CONNECTOR_H_ |
| 6 #define CHROME_BROWSER_POLICY_USER_POLICY_CONNECTOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/file_util.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 14 #include "content/common/notification_observer.h" |
| 15 #include "content/common/notification_registrar.h" |
| 16 |
| 17 class TokenService; |
| 18 namespace policy { |
| 19 |
| 20 class CloudPolicySubsystem; |
| 21 class CloudPolicyProvider; |
| 22 class UserPolicyIdentityStrategy; |
| 23 |
| 24 // This class is a container for the user-specific policy infrastructure. |
| 25 // There is one instance per BrowserProcess and it is also present when |
| 26 // there is no user logged in. However, in such a case there is no |
| 27 // CloudPolicySubsystem backend present. |
| 28 class UserPolicyConnector : public NotificationObserver { |
| 29 public: |
| 30 static UserPolicyConnector* Create(); |
| 31 ~UserPolicyConnector(); |
| 32 |
| 33 // Initializes the CloudPolicySubsystem backend and throws away the old one. |
| 34 // TODO(sfeuz): Listen to log-out or going-away messages of TokenService and |
| 35 // reset the backend at that point. |
| 36 void Initialize(std::string& user_name, |
| 37 const FilePath& policy_dir, |
| 38 TokenService* token_service); |
| 39 |
| 40 CloudPolicyProvider* GetManagedCloudProvider() const; |
| 41 CloudPolicyProvider* GetRecommendedCloudProvider() const; |
| 42 |
| 43 private: |
| 44 UserPolicyConnector(); |
| 45 |
| 46 // NotificationObserver method overrides: |
| 47 virtual void Observe(NotificationType type, |
| 48 const NotificationSource& source, |
| 49 const NotificationDetails& details); |
| 50 |
| 51 // Registers the provider for notification of successful Gaia logins. |
| 52 NotificationRegistrar registrar_; |
| 53 |
| 54 TokenService* token_service_; |
| 55 |
| 56 scoped_ptr<UserPolicyIdentityStrategy> identity_strategy_; |
| 57 scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_; |
| 58 |
| 59 scoped_ptr<CloudPolicyProvider> managed_cloud_provider_; |
| 60 scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(UserPolicyConnector); |
| 63 }; |
| 64 |
| 65 } // namespace policy |
| 66 |
| 67 #endif // CHROME_BROWSER_POLICY_USER_POLICY_CONNECTOR_H_ |
OLD | NEW |