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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h

Issue 2606773002: Setup Chromad user policy plumbing (Closed)
Patch Set: Rebase Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 namespace policy { 24 namespace policy {
25 25
26 class UserCloudPolicyManager; 26 class UserCloudPolicyManager;
27 27
28 // BrowserContextKeyedBaseFactory implementation for UserCloudPolicyManager 28 // BrowserContextKeyedBaseFactory implementation for UserCloudPolicyManager
29 // instances that initialize per-profile cloud policy settings on the desktop 29 // instances that initialize per-profile cloud policy settings on the desktop
30 // platforms. 30 // platforms.
31 // 31 //
32 // UserCloudPolicyManager is handled different than other 32 // UserCloudPolicyManager is handled different than other KeyedServices because
33 // KeyedServices because it is a dependency of PrefService. 33 // it is a dependency of PrefService. Therefore, lifetime of instances is
34 // Therefore, lifetime of instances is managed by Profile, Profile startup code 34 // managed by Profile, Profile startup code invokes CreateForBrowserContext()
35 // invokes CreateForBrowserContext() explicitly, takes ownership, and the 35 // explicitly, takes ownership, and the instance is only deleted after
36 // instance is only deleted after PrefService destruction. 36 // PrefService destruction.
37 // 37 //
38 // TODO(mnissler): Remove the special lifetime management in favor of 38 // TODO(mnissler): Remove the special lifetime management in favor of
39 // PrefService directly depending on UserCloudPolicyManager once the former has 39 // PrefService directly depending on UserCloudPolicyManager once the former has
40 // been converted to a KeyedService. 40 // been converted to a KeyedService. See also https://crbug.com/131843 and
41 // See also http://crbug.com/131843 and http://crbug.com/131844. 41 // https://crbug.com/131844.
42 class UserCloudPolicyManagerFactory : public BrowserContextKeyedBaseFactory { 42 class UserCloudPolicyManagerFactory : public BrowserContextKeyedBaseFactory {
43 public: 43 public:
44 // Returns an instance of the UserCloudPolicyManagerFactory singleton. 44 // Returns an instance of the UserCloudPolicyManagerFactory singleton.
45 static UserCloudPolicyManagerFactory* GetInstance(); 45 static UserCloudPolicyManagerFactory* GetInstance();
46 46
47 // Returns the UserCloudPolicyManager instance associated with |context|. 47 // Returns the UserCloudPolicyManager instance associated with |context|.
48 static UserCloudPolicyManager* GetForBrowserContext( 48 static UserCloudPolicyManager* GetForBrowserContext(
49 content::BrowserContext* context); 49 content::BrowserContext* context);
50 50
51 // Creates an instance for |context|. Note that the caller is responsible for 51 // Creates an instance for |context|. Note that the caller is responsible for
52 // managing the lifetime of the instance. Subsequent calls to 52 // managing the lifetime of the instance. Subsequent calls to
53 // GetForBrowserContext() will return the created instance as long as it 53 // GetForBrowserContext() will return the created instance as long as it
54 // lives. If RegisterTestingFactory() has been called, then calls to 54 // lives. If RegisterTestingFactory() has been called, then calls to this
55 // this method will return null. 55 // method will return null.
56 // 56 //
57 // If |force_immediate_load| is true, policy is loaded synchronously from 57 // If |force_immediate_load| is true, policy is loaded synchronously from
58 // UserCloudPolicyStore at startup. 58 // UserCloudPolicyStore at startup.
59 // 59 //
60 // |background_task_runner| is used for the cloud policy store. 60 // |background_task_runner| is used for the cloud policy store.
61 // |file_task_runner| is used for file operations. Currently this must be the 61 // |file_task_runner| is used for file operations. Currently this must be the
62 // FILE BrowserThread. 62 // FILE BrowserThread.
63 // |io_task_runner| is used for network IO. Currently this must be the IO 63 // |io_task_runner| is used for network IO. Currently this must be the IO
64 // BrowserThread. 64 // BrowserThread.
65 static std::unique_ptr<UserCloudPolicyManager> 65 static std::unique_ptr<UserCloudPolicyManager>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 ManagerWrapperMap manager_wrappers_; 121 ManagerWrapperMap manager_wrappers_;
122 TestingFactoryFunction testing_factory_; 122 TestingFactoryFunction testing_factory_;
123 123
124 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory); 124 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory);
125 }; 125 };
126 126
127 } // namespace policy 127 } // namespace policy
128 128
129 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ 129 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.cc ('k') | chrome/browser/policy/profile_policy_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698