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

Side by Side Diff: chrome/browser/chromeos/policy/policy_cert_service_factory.h

Issue 117263002: Prevent ONC-pushed certificates from being used with multiprofiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Philipps suggestion, another test Created 7 years 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 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 <string>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 13 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
12 14
13 template <typename T> struct DefaultSingletonTraits; 15 template <typename T> struct DefaultSingletonTraits;
14 16
17 class PrefRegistrySimple;
15 class Profile; 18 class Profile;
16 19
17 namespace policy { 20 namespace policy {
18 21
19 class PolicyCertService; 22 class PolicyCertService;
20 class PolicyCertVerifier; 23 class PolicyCertVerifier;
21 24
22 // Factory to create PolicyCertServices. 25 // Factory to create PolicyCertServices.
23 class PolicyCertServiceFactory : public BrowserContextKeyedServiceFactory { 26 class PolicyCertServiceFactory : public BrowserContextKeyedServiceFactory {
24 public: 27 public:
25 // Returns an existing PolicyCertService for |profile|. See 28 // Returns an existing PolicyCertService for |profile|. See
26 // CreateForProfile. 29 // CreateForProfile.
27 static PolicyCertService* GetForProfile(Profile* profile); 30 static PolicyCertService* GetForProfile(Profile* profile);
28 31
29 // Creates a new PolicyCertService and returns the associated 32 // Creates a new PolicyCertService and returns the associated
30 // PolicyCertVerifier. Returns NULL if this service isn't allowed for 33 // PolicyCertVerifier. Returns NULL if this service isn't allowed for
31 // |profile|, i.e. if NetworkConfigurationUpdater doesn't exist. 34 // |profile|, i.e. if NetworkConfigurationUpdater doesn't exist.
32 // This service is created separately for the original profile and the 35 // This service is created separately for the original profile and the
33 // incognito profile. 36 // incognito profile.
34 // Note: NetworkConfigurationUpdater is currently only created for the primary 37 // Note: NetworkConfigurationUpdater is currently only created for the primary
35 // user's profile. 38 // user's profile.
36 static scoped_ptr<PolicyCertVerifier> CreateForProfile(Profile* profile); 39 static scoped_ptr<PolicyCertVerifier> CreateForProfile(Profile* profile);
37 40
38 static PolicyCertServiceFactory* GetInstance(); 41 static PolicyCertServiceFactory* GetInstance();
39 42
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);
48
49 static void RegisterPrefs(PrefRegistrySimple* local_state);
50
40 private: 51 private:
41 friend struct DefaultSingletonTraits<PolicyCertServiceFactory>; 52 friend struct DefaultSingletonTraits<PolicyCertServiceFactory>;
42 53
43 PolicyCertServiceFactory(); 54 PolicyCertServiceFactory();
44 virtual ~PolicyCertServiceFactory(); 55 virtual ~PolicyCertServiceFactory();
45 56
46 // BrowserContextKeyedServiceFactory: 57 // BrowserContextKeyedServiceFactory:
47 virtual BrowserContextKeyedService* BuildServiceInstanceFor( 58 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
48 content::BrowserContext* context) const OVERRIDE; 59 content::BrowserContext* context) const OVERRIDE;
49 virtual content::BrowserContext* GetBrowserContextToUse( 60 virtual content::BrowserContext* GetBrowserContextToUse(
50 content::BrowserContext* context) const OVERRIDE; 61 content::BrowserContext* context) const OVERRIDE;
51 virtual void RegisterProfilePrefs( 62 virtual void RegisterProfilePrefs(
52 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; 63 user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
53 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 64 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
54 65
55 DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory); 66 DISALLOW_COPY_AND_ASSIGN(PolicyCertServiceFactory);
56 }; 67 };
57 68
58 } // namespace policy 69 } // namespace policy
59 70
60 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_ 71 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698