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

Side by Side Diff: chrome/browser/policy/profile_policy_connector_factory.h

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 namespace policy { 25 namespace policy {
26 26
27 class ProfilePolicyConnector; 27 class ProfilePolicyConnector;
28 28
29 // Creates ProfilePolicyConnectors for Profiles, which manage the common 29 // Creates ProfilePolicyConnectors for Profiles, which manage the common
30 // policy providers and other policy components. 30 // policy providers and other policy components.
31 // TODO(joaodasilva): convert this class to a proper PKS once the PrefService, 31 // TODO(joaodasilva): convert this class to a proper PKS once the PrefService,
32 // which depends on this class, becomes a PKS too. 32 // which depends on this class, becomes a PKS too.
33 class ProfilePolicyConnectorFactory : public ProfileKeyedBaseFactory { 33 class ProfilePolicyConnectorFactory : public BrowserContextKeyedBaseFactory {
34 public: 34 public:
35 // Returns the ProfilePolicyConnectorFactory singleton. 35 // Returns the ProfilePolicyConnectorFactory singleton.
36 static ProfilePolicyConnectorFactory* GetInstance(); 36 static ProfilePolicyConnectorFactory* GetInstance();
37 37
38 // Returns the ProfilePolicyConnector associated with |profile|. This is only 38 // Returns the ProfilePolicyConnector associated with |profile|. This is only
39 // valid before |profile| is shut down. 39 // valid before |profile| is shut down.
40 static ProfilePolicyConnector* GetForProfile(Profile* profile); 40 static ProfilePolicyConnector* GetForProfile(Profile* profile);
41 41
42 // Creates a new ProfilePolicyConnector for |profile|, which must be managed 42 // Creates a new ProfilePolicyConnector for |profile|, which must be managed
43 // by the caller. Subsequent calls to GetForProfile() will return the instance 43 // by the caller. Subsequent calls to GetForProfile() will return the instance
44 // created, as long as it lives. 44 // created, as long as it lives.
45 // If |force_immediate_load| is true then policy is loaded synchronously on 45 // If |force_immediate_load| is true then policy is loaded synchronously on
46 // startup. 46 // startup.
47 static scoped_ptr<ProfilePolicyConnector> CreateForProfile( 47 static scoped_ptr<ProfilePolicyConnector> CreateForProfile(
48 Profile* profile, 48 Profile* profile,
49 bool force_immediate_load, 49 bool force_immediate_load,
50 base::SequencedTaskRunner* sequenced_task_runner); 50 base::SequencedTaskRunner* sequenced_task_runner);
51 51
52 // Overrides the |connector| for the given |profile|; use only in tests. 52 // Overrides the |connector| for the given |profile|; use only in tests.
53 // Once this class becomes a proper PKS then it can reuse the testing 53 // Once this class becomes a proper PKS then it can reuse the testing
54 // methods of ProfileKeyedServiceFactory. 54 // methods of BrowserContextKeyedServiceFactory.
55 void SetServiceForTesting(Profile* profile, 55 void SetServiceForTesting(Profile* profile,
56 ProfilePolicyConnector* connector); 56 ProfilePolicyConnector* connector);
57 57
58 private: 58 private:
59 friend struct DefaultSingletonTraits<ProfilePolicyConnectorFactory>; 59 friend struct DefaultSingletonTraits<ProfilePolicyConnectorFactory>;
60 60
61 ProfilePolicyConnectorFactory(); 61 ProfilePolicyConnectorFactory();
62 virtual ~ProfilePolicyConnectorFactory(); 62 virtual ~ProfilePolicyConnectorFactory();
63 63
64 ProfilePolicyConnector* GetForProfileInternal(Profile* profile); 64 ProfilePolicyConnector* GetForProfileInternal(Profile* profile);
65 65
66 scoped_ptr<ProfilePolicyConnector> CreateForProfileInternal( 66 scoped_ptr<ProfilePolicyConnector> CreateForProfileInternal(
67 Profile* profile, 67 Profile* profile,
68 bool force_immediate_load, 68 bool force_immediate_load,
69 base::SequencedTaskRunner* sequenced_task_runner); 69 base::SequencedTaskRunner* sequenced_task_runner);
70 70
71 // ProfileKeyedBaseFactory: 71 // BrowserContextKeyedBaseFactory:
72 virtual void ProfileShutdown(content::BrowserContext* context) OVERRIDE; 72 virtual void BrowserContextShutdown(
73 virtual void ProfileDestroyed(content::BrowserContext* context) OVERRIDE; 73 content::BrowserContext* context) OVERRIDE;
74 virtual void BrowserContextDestroyed(
75 content::BrowserContext* context) OVERRIDE;
74 virtual void RegisterUserPrefs( 76 virtual void RegisterUserPrefs(
75 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; 77 user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
76 virtual void SetEmptyTestingFactory( 78 virtual void SetEmptyTestingFactory(
77 content::BrowserContext* context) OVERRIDE; 79 content::BrowserContext* context) OVERRIDE;
78 virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE; 80 virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE;
79 81
80 typedef std::map<Profile*, ProfilePolicyConnector*> ConnectorMap; 82 typedef std::map<Profile*, ProfilePolicyConnector*> ConnectorMap;
81 ConnectorMap connectors_; 83 ConnectorMap connectors_;
82 84
83 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnectorFactory); 85 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnectorFactory);
84 }; 86 };
85 87
86 } // namespace policy 88 } // namespace policy
87 89
88 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_ 90 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698