| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ |
| 6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ | 6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" | 13 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" |
| 14 | 14 |
| 15 namespace base { |
| 15 template <typename T> | 16 template <typename T> |
| 16 struct DefaultSingletonTraits; | 17 struct DefaultSingletonTraits; |
| 17 | 18 |
| 18 namespace base { | |
| 19 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
| 20 } | 20 } // namespace base |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 class BrowserContext; | 23 class BrowserContext; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace policy { | 26 namespace policy { |
| 27 | 27 |
| 28 class ConfigurationPolicyProvider; | 28 class ConfigurationPolicyProvider; |
| 29 class ProfilePolicyConnector; | 29 class ProfilePolicyConnector; |
| 30 | 30 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 // methods of BrowserContextKeyedServiceFactory. | 56 // methods of BrowserContextKeyedServiceFactory. |
| 57 void SetServiceForTesting(content::BrowserContext* context, | 57 void SetServiceForTesting(content::BrowserContext* context, |
| 58 ProfilePolicyConnector* connector); | 58 ProfilePolicyConnector* connector); |
| 59 | 59 |
| 60 // The next Profile to call CreateForBrowserContext() will get a PolicyService | 60 // The next Profile to call CreateForBrowserContext() will get a PolicyService |
| 61 // with |provider| as its sole policy provider. This can be called multiple | 61 // with |provider| as its sole policy provider. This can be called multiple |
| 62 // times to override the policy providers for more than 1 Profile. | 62 // times to override the policy providers for more than 1 Profile. |
| 63 void PushProviderForTesting(ConfigurationPolicyProvider* provider); | 63 void PushProviderForTesting(ConfigurationPolicyProvider* provider); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 friend struct DefaultSingletonTraits<ProfilePolicyConnectorFactory>; | 66 friend struct base::DefaultSingletonTraits<ProfilePolicyConnectorFactory>; |
| 67 | 67 |
| 68 ProfilePolicyConnectorFactory(); | 68 ProfilePolicyConnectorFactory(); |
| 69 ~ProfilePolicyConnectorFactory() override; | 69 ~ProfilePolicyConnectorFactory() override; |
| 70 | 70 |
| 71 ProfilePolicyConnector* GetForBrowserContextInternal( | 71 ProfilePolicyConnector* GetForBrowserContextInternal( |
| 72 content::BrowserContext* context); | 72 content::BrowserContext* context); |
| 73 | 73 |
| 74 scoped_ptr<ProfilePolicyConnector> CreateForBrowserContextInternal( | 74 scoped_ptr<ProfilePolicyConnector> CreateForBrowserContextInternal( |
| 75 content::BrowserContext* context, | 75 content::BrowserContext* context, |
| 76 bool force_immediate_load); | 76 bool force_immediate_load); |
| 77 | 77 |
| 78 // BrowserContextKeyedBaseFactory: | 78 // BrowserContextKeyedBaseFactory: |
| 79 void BrowserContextShutdown(content::BrowserContext* context) override; | 79 void BrowserContextShutdown(content::BrowserContext* context) override; |
| 80 void BrowserContextDestroyed(content::BrowserContext* context) override; | 80 void BrowserContextDestroyed(content::BrowserContext* context) override; |
| 81 void SetEmptyTestingFactory(content::BrowserContext* context) override; | 81 void SetEmptyTestingFactory(content::BrowserContext* context) override; |
| 82 bool HasTestingFactory(content::BrowserContext* context) override; | 82 bool HasTestingFactory(content::BrowserContext* context) override; |
| 83 void CreateServiceNow(content::BrowserContext* context) override; | 83 void CreateServiceNow(content::BrowserContext* context) override; |
| 84 | 84 |
| 85 typedef std::map<content::BrowserContext*, ProfilePolicyConnector*> | 85 typedef std::map<content::BrowserContext*, ProfilePolicyConnector*> |
| 86 ConnectorMap; | 86 ConnectorMap; |
| 87 ConnectorMap connectors_; | 87 ConnectorMap connectors_; |
| 88 std::list<ConfigurationPolicyProvider*> test_providers_; | 88 std::list<ConfigurationPolicyProvider*> test_providers_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnectorFactory); | 90 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnectorFactory); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace policy | 93 } // namespace policy |
| 94 | 94 |
| 95 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ | 95 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ |
| OLD | NEW |