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

Side by Side Diff: chrome/browser/chromeos/policy/policy_cert_service.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: 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_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_H_
7 7
8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" 16 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h"
16 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
17 18
18 class PrefService; 19 namespace chromeos {
20 class UserManager;
21 }
19 22
20 namespace net { 23 namespace net {
21 class X509Certificate; 24 class X509Certificate;
22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; 25 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
23 } 26 }
24 27
25 namespace policy { 28 namespace policy {
26 29
27 class PolicyCertVerifier; 30 class PolicyCertVerifier;
28 31
29 // This service is the counterpart of PolicyCertVerifier on the UI thread. It's 32 // This service is the counterpart of PolicyCertVerifier on the UI thread. It's
30 // responsible for pushing the current list of trust anchors to the CertVerifier 33 // responsible for pushing the current list of trust anchors to the CertVerifier
31 // and marking the profile's prefs if any of the trust anchors was used. 34 // and marking the profile's prefs if any of the trust anchors was used.
32 // Except for unit tests, PolicyCertVerifier should only be created through this 35 // Except for unit tests, PolicyCertVerifier should only be created through this
33 // class. 36 // class.
34 class PolicyCertService 37 class PolicyCertService
35 : public BrowserContextKeyedService, 38 : public BrowserContextKeyedService,
36 public UserNetworkConfigurationUpdater::WebTrustedCertsObserver { 39 public UserNetworkConfigurationUpdater::WebTrustedCertsObserver {
37 public: 40 public:
38 PolicyCertService(UserNetworkConfigurationUpdater* net_conf_updater, 41 PolicyCertService(UserNetworkConfigurationUpdater* net_conf_updater,
39 PrefService* user_prefs); 42 const std::string& user_id,
pneubeck (no reviews) 2013/12/17 15:25:31 nit: const parameters should be first.
Joao da Silva 2013/12/17 16:36:41 Done.
43 chromeos::UserManager* user_manager);
40 virtual ~PolicyCertService(); 44 virtual ~PolicyCertService();
41 45
42 // Creates an associated PolicyCertVerifier. The returned object must only be 46 // Creates an associated PolicyCertVerifier. The returned object must only be
43 // used on the IO thread and must outlive this object. 47 // used on the IO thread and must outlive this object.
44 scoped_ptr<PolicyCertVerifier> CreatePolicyCertVerifier(); 48 scoped_ptr<PolicyCertVerifier> CreatePolicyCertVerifier();
45 49
46 // Returns true if the profile with |user_prefs| has used certificates 50 // Returns true if the profile with |user_prefs| has used certificates
pneubeck (no reviews) 2013/12/17 15:25:31 not up-to-date.
Joao da Silva 2013/12/17 16:36:41 Done.
47 // installed via policy to establish a secure connection before. This means 51 // installed via policy to establish a secure connection before. This means
48 // that it may have cached content from an untrusted source. 52 // that it may have cached content from an untrusted source.
49 bool UsedPolicyCertificates() const; 53 bool UsedPolicyCertificates() const;
50 54
55 // Returns true if the profile has used certificates installed via policy
56 // before, or if it currently has certificates installed via policy but
57 // hasn't used them yet.
58 bool IsTainted() const;
pneubeck (no reviews) 2013/12/17 15:25:31 the function name doesn't fit / hides details behi
Joao da Silva 2013/12/17 16:36:41 Done.
59
51 // UserNetworkConfigurationUpdater::WebTrustedCertsObserver: 60 // UserNetworkConfigurationUpdater::WebTrustedCertsObserver:
52 virtual void OnTrustAnchorsChanged(const net::CertificateList& trust_anchors) 61 virtual void OnTrustAnchorsChanged(const net::CertificateList& trust_anchors)
53 OVERRIDE; 62 OVERRIDE;
54 63
55 // BrowserContextKeyedService: 64 // BrowserContextKeyedService:
56 virtual void Shutdown() OVERRIDE; 65 virtual void Shutdown() OVERRIDE;
57 66
58 private: 67 private:
59 void SetUsedPolicyCertificatesOnce();
60
61 PolicyCertVerifier* cert_verifier_; 68 PolicyCertVerifier* cert_verifier_;
62 UserNetworkConfigurationUpdater* net_conf_updater_; 69 UserNetworkConfigurationUpdater* net_conf_updater_;
63 PrefService* user_prefs_; 70 std::string user_id_;
71 chromeos::UserManager* user_manager_;
72 bool has_trust_anchors_;
64 73
65 // Weak pointers to handle callbacks from PolicyCertVerifier on the IO thread. 74 // Weak pointers to handle callbacks from PolicyCertVerifier on the IO thread.
66 // The factory and the created WeakPtrs must only be used on the UI thread. 75 // The factory and the created WeakPtrs must only be used on the UI thread.
67 base::WeakPtrFactory<PolicyCertService> weak_ptr_factory_; 76 base::WeakPtrFactory<PolicyCertService> weak_ptr_factory_;
68 77
69 DISALLOW_COPY_AND_ASSIGN(PolicyCertService); 78 DISALLOW_COPY_AND_ASSIGN(PolicyCertService);
70 }; 79 };
71 80
72 } // namespace policy 81 } // namespace policy
73 82
74 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_H_ 83 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698