OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_POLICY_CERT_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 13 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 template <typename T> | 16 template <typename T> |
17 struct DefaultSingletonTraits; | 17 struct DefaultSingletonTraits; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 class PrefRegistrySimple; | 20 class PrefRegistrySimple; |
21 class Profile; | 21 class Profile; |
22 | 22 |
23 namespace policy { | 23 namespace policy { |
24 | 24 |
25 class PolicyCertService; | 25 class PolicyCertService; |
26 class PolicyCertVerifier; | 26 class PolicyCertVerifier; |
27 | 27 |
28 // Factory to create PolicyCertServices. | 28 // Factory to create PolicyCertServices. |
29 class PolicyCertServiceFactory : public BrowserContextKeyedServiceFactory { | 29 class PolicyCertServiceFactory : public BrowserContextKeyedServiceFactory { |
30 public: | 30 public: |
31 // Returns an existing PolicyCertService for |profile|. See | 31 // Returns an existing PolicyCertService for |profile|. See |
32 // CreateForProfile. | 32 // CreateForProfile. |
33 static PolicyCertService* GetForProfile(Profile* profile); | 33 static PolicyCertService* GetForProfile(Profile* profile); |
34 | 34 |
35 // Creates a new PolicyCertService and returns the associated | 35 // Creates a new PolicyCertService and returns the associated |
36 // PolicyCertVerifier. Returns NULL if this service isn't allowed for | 36 // PolicyCertVerifier. Returns NULL if this service isn't allowed for |
37 // |profile|, i.e. if NetworkConfigurationUpdater doesn't exist. | 37 // |profile|, i.e. if NetworkConfigurationUpdater doesn't exist. |
38 // This service is created separately for the original profile and the | 38 // This service is created separately for the original profile and the |
39 // incognito profile. | 39 // incognito profile. |
40 // Note: NetworkConfigurationUpdater is currently only created for the primary | 40 // Note: NetworkConfigurationUpdater is currently only created for the primary |
41 // user's profile. | 41 // user's profile. |
42 static scoped_ptr<PolicyCertVerifier> CreateForProfile(Profile* profile); | 42 static std::unique_ptr<PolicyCertVerifier> CreateForProfile(Profile* profile); |
43 | 43 |
44 static PolicyCertServiceFactory* GetInstance(); | 44 static PolicyCertServiceFactory* GetInstance(); |
45 | 45 |
46 // Used to mark or clear |user_id| as having used certificates pushed by | 46 // Used to mark or clear |user_id| as having used certificates pushed by |
47 // policy before. | 47 // policy before. |
48 static void SetUsedPolicyCertificates(const std::string& user_id); | 48 static void SetUsedPolicyCertificates(const std::string& user_id); |
49 static void ClearUsedPolicyCertificates(const std::string& user_id); | 49 static void ClearUsedPolicyCertificates(const std::string& user_id); |
50 static bool UsedPolicyCertificates(const std::string& user_id); | 50 static bool UsedPolicyCertificates(const std::string& user_id); |
51 | 51 |
52 static void RegisterPrefs(PrefRegistrySimple* local_state); | 52 static void RegisterPrefs(PrefRegistrySimple* local_state); |
(...skipping 12 matching lines...) Expand all Loading... |
65 void RegisterProfilePrefs( | 65 void RegisterProfilePrefs( |
66 user_prefs::PrefRegistrySyncable* registry) override; | 66 user_prefs::PrefRegistrySyncable* registry) override; |
67 bool ServiceIsNULLWhileTesting() const override; | 67 bool ServiceIsNULLWhileTesting() const override; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory); | 69 DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace policy | 72 } // namespace policy |
73 | 73 |
74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ |
OLD | NEW |