| 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_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHROMEO
S_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHROMEO
S_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHROMEO
S_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHROMEO
S_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" | 14 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 // Returns the UserCloudPolicyManagerChromeOS instance associated with | 50 // Returns the UserCloudPolicyManagerChromeOS instance associated with |
| 51 // |profile|. | 51 // |profile|. |
| 52 static UserCloudPolicyManagerChromeOS* GetForProfile(Profile* profile); | 52 static UserCloudPolicyManagerChromeOS* GetForProfile(Profile* profile); |
| 53 | 53 |
| 54 // Creates an instance for |profile|. Note that the caller is responsible for | 54 // Creates an instance for |profile|. Note that the caller is responsible for |
| 55 // managing the lifetime of the instance. Subsequent calls to GetForProfile() | 55 // managing the lifetime of the instance. Subsequent calls to GetForProfile() |
| 56 // will return the created instance as long as it lives. | 56 // will return the created instance as long as it lives. |
| 57 // | 57 // |
| 58 // If |force_immediate_load| is true, policy is loaded synchronously from | 58 // If |force_immediate_load| is true, policy is loaded synchronously from |
| 59 // UserCloudPolicyStore at startup. | 59 // UserCloudPolicyStore at startup. |
| 60 static scoped_ptr<UserCloudPolicyManagerChromeOS> CreateForProfile( | 60 static std::unique_ptr<UserCloudPolicyManagerChromeOS> CreateForProfile( |
| 61 Profile* profile, | 61 Profile* profile, |
| 62 bool force_immediate_load, | 62 bool force_immediate_load, |
| 63 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 63 scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 friend struct base::DefaultSingletonTraits< | 66 friend struct base::DefaultSingletonTraits< |
| 67 UserCloudPolicyManagerFactoryChromeOS>; | 67 UserCloudPolicyManagerFactoryChromeOS>; |
| 68 | 68 |
| 69 UserCloudPolicyManagerFactoryChromeOS(); | 69 UserCloudPolicyManagerFactoryChromeOS(); |
| 70 ~UserCloudPolicyManagerFactoryChromeOS() override; | 70 ~UserCloudPolicyManagerFactoryChromeOS() override; |
| 71 | 71 |
| 72 // See comments for the static versions above. | 72 // See comments for the static versions above. |
| 73 UserCloudPolicyManagerChromeOS* GetManagerForProfile(Profile* profile); | 73 UserCloudPolicyManagerChromeOS* GetManagerForProfile(Profile* profile); |
| 74 scoped_ptr<UserCloudPolicyManagerChromeOS> CreateManagerForProfile( | 74 std::unique_ptr<UserCloudPolicyManagerChromeOS> CreateManagerForProfile( |
| 75 Profile* profile, | 75 Profile* profile, |
| 76 bool force_immediate_load, | 76 bool force_immediate_load, |
| 77 scoped_refptr<base::SequencedTaskRunner> background_task_runner); | 77 scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| 78 | 78 |
| 79 // BrowserContextKeyedBaseFactory: | 79 // BrowserContextKeyedBaseFactory: |
| 80 void BrowserContextShutdown(content::BrowserContext* context) override; | 80 void BrowserContextShutdown(content::BrowserContext* context) override; |
| 81 void BrowserContextDestroyed(content::BrowserContext* context) override; | 81 void BrowserContextDestroyed(content::BrowserContext* context) override; |
| 82 void SetEmptyTestingFactory(content::BrowserContext* context) override; | 82 void SetEmptyTestingFactory(content::BrowserContext* context) override; |
| 83 bool HasTestingFactory(content::BrowserContext* context) override; | 83 bool HasTestingFactory(content::BrowserContext* context) override; |
| 84 void CreateServiceNow(content::BrowserContext* context) override; | 84 void CreateServiceNow(content::BrowserContext* context) override; |
| 85 | 85 |
| 86 typedef std::map<Profile*, UserCloudPolicyManagerChromeOS*> ManagerMap; | 86 typedef std::map<Profile*, UserCloudPolicyManagerChromeOS*> ManagerMap; |
| 87 ManagerMap managers_; | 87 ManagerMap managers_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactoryChromeOS); | 89 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactoryChromeOS); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace policy | 92 } // namespace policy |
| 93 | 93 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHRO
MEOS_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_FACTORY_CHRO
MEOS_H_ |
| OLD | NEW |