Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 static UserCloudPolicyManager* GetForBrowserContext( | 47 static UserCloudPolicyManager* GetForBrowserContext( |
| 48 content::BrowserContext* context); | 48 content::BrowserContext* context); |
| 49 | 49 |
| 50 // Creates an instance for |context|. Note that the caller is responsible for | 50 // Creates an instance for |context|. Note that the caller is responsible for |
| 51 // managing the lifetime of the instance. Subsequent calls to | 51 // managing the lifetime of the instance. Subsequent calls to |
| 52 // GetForBrowserContext() will return the created instance as long as it | 52 // GetForBrowserContext() will return the created instance as long as it |
| 53 // lives. | 53 // lives. |
| 54 // | 54 // |
| 55 // If |force_immediate_load| is true, policy is loaded synchronously from | 55 // If |force_immediate_load| is true, policy is loaded synchronously from |
| 56 // UserCloudPolicyStore at startup. | 56 // UserCloudPolicyStore at startup. |
| 57 // | |
| 58 // |background_task_runner| is used for the cloud policy store. | |
| 59 // |file_task_runner| is used for file operations. | |
| 60 // |io_task_runner| is used for network IO. | |
| 61 // Note: currently these must be the FILE and the IO BrowserThreads. | |
|
bartfab (slow)
2013/11/25 15:05:50
Nit: "these" is ambiguous (there are three task ru
Joao da Silva
2013/11/25 16:44:11
Done.
| |
| 57 static scoped_ptr<UserCloudPolicyManager> CreateForOriginalBrowserContext( | 62 static scoped_ptr<UserCloudPolicyManager> CreateForOriginalBrowserContext( |
| 58 content::BrowserContext* context, | 63 content::BrowserContext* context, |
| 59 bool force_immediate_load, | 64 bool force_immediate_load, |
| 60 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 65 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 66 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | |
| 67 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | |
| 61 | 68 |
| 62 static UserCloudPolicyManager* RegisterForOffTheRecordBrowserContext( | 69 static UserCloudPolicyManager* RegisterForOffTheRecordBrowserContext( |
| 63 content::BrowserContext* original_context, | 70 content::BrowserContext* original_context, |
| 64 content::BrowserContext* off_the_record_context); | 71 content::BrowserContext* off_the_record_context); |
| 65 | 72 |
| 66 private: | 73 private: |
| 67 friend class UserCloudPolicyManager; | 74 friend class UserCloudPolicyManager; |
| 68 friend struct DefaultSingletonTraits<UserCloudPolicyManagerFactory>; | 75 friend struct DefaultSingletonTraits<UserCloudPolicyManagerFactory>; |
| 69 | 76 |
| 70 UserCloudPolicyManagerFactory(); | 77 UserCloudPolicyManagerFactory(); |
| 71 virtual ~UserCloudPolicyManagerFactory(); | 78 virtual ~UserCloudPolicyManagerFactory(); |
| 72 | 79 |
| 73 // See comments for the static versions above. | 80 // See comments for the static versions above. |
| 74 UserCloudPolicyManager* GetManagerForBrowserContext( | 81 UserCloudPolicyManager* GetManagerForBrowserContext( |
| 75 content::BrowserContext* context); | 82 content::BrowserContext* context); |
| 76 | 83 |
| 77 scoped_ptr<UserCloudPolicyManager> CreateManagerForOriginalBrowserContext( | 84 scoped_ptr<UserCloudPolicyManager> CreateManagerForOriginalBrowserContext( |
| 78 content::BrowserContext* context, | 85 content::BrowserContext* context, |
| 79 bool force_immediate_load, | 86 bool force_immediate_load, |
| 80 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 87 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 88 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | |
| 89 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | |
| 81 | 90 |
| 82 UserCloudPolicyManager* RegisterManagerForOffTheRecordBrowserContext( | 91 UserCloudPolicyManager* RegisterManagerForOffTheRecordBrowserContext( |
| 83 content::BrowserContext* original_context, | 92 content::BrowserContext* original_context, |
| 84 content::BrowserContext* off_the_record_context); | 93 content::BrowserContext* off_the_record_context); |
| 85 | 94 |
| 86 // BrowserContextKeyedBaseFactory: | 95 // BrowserContextKeyedBaseFactory: |
| 87 virtual void BrowserContextShutdown( | 96 virtual void BrowserContextShutdown( |
| 88 content::BrowserContext* context) OVERRIDE; | 97 content::BrowserContext* context) OVERRIDE; |
| 89 virtual void SetEmptyTestingFactory( | 98 virtual void SetEmptyTestingFactory( |
| 90 content::BrowserContext* context) OVERRIDE; | 99 content::BrowserContext* context) OVERRIDE; |
| 91 virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE; | 100 virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE; |
| 92 | 101 |
| 93 // Invoked by UserCloudPolicyManager to register/unregister instances. | 102 // Invoked by UserCloudPolicyManager to register/unregister instances. |
| 94 void Register(content::BrowserContext* context, | 103 void Register(content::BrowserContext* context, |
| 95 UserCloudPolicyManager* instance); | 104 UserCloudPolicyManager* instance); |
| 96 void Unregister(content::BrowserContext* context, | 105 void Unregister(content::BrowserContext* context, |
| 97 UserCloudPolicyManager* instance); | 106 UserCloudPolicyManager* instance); |
| 98 | 107 |
| 99 typedef std::map<content::BrowserContext*, UserCloudPolicyManager*> | 108 typedef std::map<content::BrowserContext*, UserCloudPolicyManager*> |
| 100 ManagerMap; | 109 ManagerMap; |
| 101 | 110 |
| 102 ManagerMap managers_; | 111 ManagerMap managers_; |
| 103 | 112 |
| 104 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory); | 113 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactory); |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 } // namespace policy | 116 } // namespace policy |
| 108 | 117 |
| 109 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ | 118 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_FACTORY_H_ |
| OLD | NEW |