| Index: chrome/browser/policy/profile_policy_connector.h
|
| diff --git a/chrome/browser/policy/profile_policy_connector.h b/chrome/browser/policy/profile_policy_connector.h
|
| index 5268c8f8aada7505941b78d8782fa76f11d365f1..f73daf421cd351432f5161087057b90e352e30aa 100644
|
| --- a/chrome/browser/policy/profile_policy_connector.h
|
| +++ b/chrome/browser/policy/profile_policy_connector.h
|
| @@ -7,92 +7,61 @@
|
| #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 "chrome/browser/profiles/profile_keyed_service.h"
|
| -
|
| -class Profile;
|
| +#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 profile-specific policy bits located in the
|
| // profile. Since the subsystem owns the policy provider, it's vital that it
|
| // gets initialized before the profile's prefs and destroyed after the prefs
|
| // are gone.
|
| -class ProfilePolicyConnector : public ProfileKeyedService {
|
| +class ProfilePolicyConnector : public NotificationObserver {
|
| public:
|
| - explicit ProfilePolicyConnector(Profile* profile);
|
| + static ProfilePolicyConnector* Create();
|
| ~ProfilePolicyConnector();
|
|
|
| - // Initializes the context. Should be called only after the profile's request
|
| - // context is up.
|
| - void Initialize();
|
| -
|
| - // Shuts the context down. This must be called before the networking
|
| - // infrastructure in the profile goes away.
|
| - //
|
| - // TODO(jknotten): this will be called by ProfileDependencyManager --
|
| - // ensure that it is dependent on the right services. See comment
|
| - // in ProfilePolicyConnectorFactory::ProfilePolicyConnectorFactory.
|
| - virtual void Shutdown() OVERRIDE;
|
| + // 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);
|
|
|
| - ConfigurationPolicyProvider* GetManagedCloudProvider();
|
| - ConfigurationPolicyProvider* GetRecommendedCloudProvider();
|
| + CloudPolicyProvider* GetManagedCloudProvider() const;
|
| + CloudPolicyProvider* GetRecommendedCloudProvider() const;
|
|
|
| private:
|
| - Profile* profile_;
|
| + ProfilePolicyConnector();
|
|
|
| - scoped_ptr<UserPolicyIdentityStrategy> identity_strategy_;
|
| - scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_;
|
| -
|
| - scoped_ptr<ConfigurationPolicyProvider> managed_cloud_provider_;
|
| - scoped_ptr<ConfigurationPolicyProvider> recommended_cloud_provider_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
|
| -};
|
| + // NotificationObserver method overrides:
|
| + virtual void Observe(NotificationType type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details);
|
|
|
| -// A wrapper for the ProfilePolicyConnector's cloud providers.
|
| -//
|
| -// Some well-known policies that are not provided by the
|
| -// |profile_policy_provider_| are instead provided by the
|
| -// |browser_policy_provider_|, thus merging device policies into
|
| -// profile policies.
|
| -//
|
| -// Currently used to pass the device proxy settings into the profile
|
| -// preferences.
|
| -class MergingPolicyProvider: public ConfigurationPolicyProvider,
|
| - public ConfigurationPolicyProvider::Observer {
|
| - public:
|
| - MergingPolicyProvider(ConfigurationPolicyProvider* browser_policy_provider,
|
| - ConfigurationPolicyProvider* profile_policy_provider);
|
| - virtual ~MergingPolicyProvider();
|
| + // Registers the provider for notification of successful Gaia logins.
|
| + NotificationRegistrar registrar_;
|
|
|
| - // ConfigurationPolicyProvider methods:
|
| - virtual bool Provide(ConfigurationPolicyStoreInterface* store) OVERRIDE;
|
| - virtual void AddObserver(
|
| - ConfigurationPolicyProvider::Observer* observer) OVERRIDE;
|
| - virtual void RemoveObserver(
|
| - ConfigurationPolicyProvider::Observer* observer) OVERRIDE;
|
| + TokenService* token_service_;
|
|
|
| - // ConfigurationPolicyProvider::Observer methods:
|
| - virtual void OnUpdatePolicy() OVERRIDE;
|
| - virtual void OnProviderGoingAway() OVERRIDE;
|
| + scoped_ptr<UserPolicyIdentityStrategy> identity_strategy_;
|
| + scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_;
|
|
|
| - private:
|
| - ConfigurationPolicyProvider* browser_policy_provider_;
|
| - ConfigurationPolicyProvider* profile_policy_provider_;
|
| - scoped_ptr<ConfigurationPolicyObserverRegistrar> browser_registrar_;
|
| - scoped_ptr<ConfigurationPolicyObserverRegistrar> profile_registrar_;
|
| - ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_;
|
| + scoped_ptr<CloudPolicyProvider> managed_cloud_provider_;
|
| + scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(MergingPolicyProvider);
|
| + DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
|
| };
|
|
|
| -
|
| } // namespace policy
|
|
|
| #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
|
|
|