Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / policy_cert_service_factory.h
blobb2851ba25b04071277765d05c09c61161aa32a06
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
15 template <typename T> struct DefaultSingletonTraits;
17 class PrefRegistrySimple;
18 class Profile;
20 namespace policy {
22 class PolicyCertService;
23 class PolicyCertVerifier;
25 // Factory to create PolicyCertServices.
26 class PolicyCertServiceFactory : public BrowserContextKeyedServiceFactory {
27 public:
28 // Returns an existing PolicyCertService for |profile|. See
29 // CreateForProfile.
30 static PolicyCertService* GetForProfile(Profile* profile);
32 // Creates a new PolicyCertService and returns the associated
33 // PolicyCertVerifier. Returns NULL if this service isn't allowed for
34 // |profile|, i.e. if NetworkConfigurationUpdater doesn't exist.
35 // This service is created separately for the original profile and the
36 // incognito profile.
37 // Note: NetworkConfigurationUpdater is currently only created for the primary
38 // user's profile.
39 static scoped_ptr<PolicyCertVerifier> CreateForProfile(Profile* profile);
41 static PolicyCertServiceFactory* GetInstance();
43 // Used to mark or clear |user_id| as having used certificates pushed by
44 // policy before.
45 static void SetUsedPolicyCertificates(const std::string& user_id);
46 static void ClearUsedPolicyCertificates(const std::string& user_id);
47 static bool UsedPolicyCertificates(const std::string& user_id);
49 static void RegisterPrefs(PrefRegistrySimple* local_state);
51 private:
52 friend struct DefaultSingletonTraits<PolicyCertServiceFactory>;
54 PolicyCertServiceFactory();
55 ~PolicyCertServiceFactory() override;
57 // BrowserContextKeyedServiceFactory:
58 KeyedService* BuildServiceInstanceFor(
59 content::BrowserContext* context) const override;
60 content::BrowserContext* GetBrowserContextToUse(
61 content::BrowserContext* context) const override;
62 void RegisterProfilePrefs(
63 user_prefs::PrefRegistrySyncable* registry) override;
64 bool ServiceIsNULLWhileTesting() const override;
66 DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory);
69 } // namespace policy
71 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_