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

Side by Side Diff: chrome/browser/policy/profile_policy_connector.h

Issue 53923004: policy: Make UserNetworkConfigurationUpdater a BCKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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_POLICY_PROFILE_POLICY_CONNECTOR_H_ 5 #ifndef CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_ 6 #define CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
10 9
11 #include "base/basictypes.h" 10 #include "base/basictypes.h"
12 #include "base/callback.h" 11 #include "base/callback.h"
13 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
16 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
17 16
18 class Profile; 17 class Profile;
19 18
20 namespace net { 19 namespace net {
21 class CertTrustAnchorProvider; 20 class CertTrustAnchorProvider;
22 } 21 }
23 22
24 namespace net {
25 class X509Certificate;
26 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
27 }
28
29 namespace chromeos { 23 namespace chromeos {
30 class User; 24 class User;
31 } 25 }
32 26
33 namespace policy { 27 namespace policy {
34 28
35 class CloudPolicyManager; 29 class CloudPolicyManager;
36 class ConfigurationPolicyProvider; 30 class ConfigurationPolicyProvider;
37 class UserNetworkConfigurationUpdater;
38 class PolicyService; 31 class PolicyService;
39 class PolicyCertVerifier; 32 class PolicyCertVerifier;
willchan no longer on Chromium 2013/11/06 18:01:50 Delete?
pneubeck (no reviews) 2013/11/06 20:07:13 Done.
40 33
41 // A BrowserContextKeyedService that creates and manages the per-Profile policy 34 // A BrowserContextKeyedService that creates and manages the per-Profile policy
42 // components. 35 // components.
43 class ProfilePolicyConnector : public BrowserContextKeyedService { 36 class ProfilePolicyConnector : public BrowserContextKeyedService {
44 public: 37 public:
45 explicit ProfilePolicyConnector(Profile* profile); 38 explicit ProfilePolicyConnector(Profile* profile);
46 virtual ~ProfilePolicyConnector(); 39 virtual ~ProfilePolicyConnector();
47 40
48 // If |force_immediate_load| then disk caches will be loaded synchronously. 41 // If |force_immediate_load| then disk caches will be loaded synchronously.
49 void Init(bool force_immediate_load, 42 void Init(bool force_immediate_load,
50 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
51 const chromeos::User* user, 44 const chromeos::User* user,
52 #endif 45 #endif
53 CloudPolicyManager* user_cloud_policy_manager); 46 CloudPolicyManager* user_cloud_policy_manager);
54 47
55 void InitForTesting(scoped_ptr<PolicyService> service); 48 void InitForTesting(scoped_ptr<PolicyService> service);
56 49
57 // BrowserContextKeyedService: 50 // BrowserContextKeyedService:
58 virtual void Shutdown() OVERRIDE; 51 virtual void Shutdown() OVERRIDE;
59 52
60 // This is never NULL. 53 // This is never NULL.
61 PolicyService* policy_service() const { return policy_service_.get(); } 54 PolicyService* policy_service() const { return policy_service_.get(); }
62 55
63 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
64 // Sets the CertVerifier on which the current list of Web trusted server and
65 // CA certificates will be set. Policy updates will trigger further calls to
66 // |cert_verifier| later. |cert_verifier| must be valid until
67 // SetPolicyCertVerifier is called again (with another CertVerifier or NULL)
68 // or until this Connector is destructed. |cert_verifier|'s methods are only
69 // called on the IO thread. This function must be called on the UI thread.
70 void SetPolicyCertVerifier(PolicyCertVerifier* cert_verifier);
71
72 // Returns a callback that should be called if a policy installed certificate 57 // Returns a callback that should be called if a policy installed certificate
73 // was trusted for the associated profile. The closure can be safely used (on 58 // was trusted for the associated profile. The closure can be safely used (on
74 // the UI thread) even after this Connector is destructed. 59 // the UI thread) even after this Connector is destructed.
75 base::Closure GetPolicyCertTrustedCallback(); 60 base::Closure GetPolicyCertTrustedCallback();
76
77 // Sets |certs| to the list of Web trusted server and CA certificates from the
78 // last received ONC user policy.
79 void GetWebTrustedCertificates(net::CertificateList* certs) const;
80 #endif 61 #endif
81 62
82 // Returns true if |profile()| has used certificates installed via policy 63 // Returns true if |profile()| has used certificates installed via policy
83 // to establish a secure connection before. This means that it may have 64 // to establish a secure connection before. This means that it may have
84 // cached content from an untrusted source. 65 // cached content from an untrusted source.
85 bool UsedPolicyCertificates(); 66 bool UsedPolicyCertificates();
86 67
87 private: 68 private:
88 #if defined(ENABLE_CONFIGURATION_POLICY) 69 #if defined(ENABLE_CONFIGURATION_POLICY)
89 70
90 #if defined(OS_CHROMEOS) 71 #if defined(OS_CHROMEOS)
91 void SetUsedPolicyCertificatesOnce(); 72 void SetUsedPolicyCertificatesOnce();
92 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username); 73 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username);
93 #endif 74 #endif
94 75
95 #if defined(OS_CHROMEOS) 76 #if defined(OS_CHROMEOS)
96 // Some of the user policy configuration affects browser global state, and 77 // Some of the user policy configuration affects browser global state, and
97 // can only come from one Profile. |is_primary_user_| is true if this 78 // can only come from one Profile. |is_primary_user_| is true if this
98 // connector belongs to the first signed-in Profile, and in that case that 79 // connector belongs to the first signed-in Profile, and in that case that
99 // Profile's policy is the one that affects global policy settings in 80 // Profile's policy is the one that affects global policy settings in
100 // local state. 81 // local state.
101 bool is_primary_user_; 82 bool is_primary_user_;
102 83
103 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_; 84 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_;
104 scoped_ptr<UserNetworkConfigurationUpdater> network_configuration_updater_;
105 85
106 base::WeakPtrFactory<ProfilePolicyConnector> weak_ptr_factory_; 86 base::WeakPtrFactory<ProfilePolicyConnector> weak_ptr_factory_;
107 #endif 87 #endif
108 88
109 Profile* profile_; 89 Profile* profile_;
110 90
111 #endif // ENABLE_CONFIGURATION_POLICY 91 #endif // ENABLE_CONFIGURATION_POLICY
112 92
113 scoped_ptr<PolicyService> policy_service_; 93 scoped_ptr<PolicyService> policy_service_;
114 94
115 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector); 95 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
116 }; 96 };
117 97
118 } // namespace policy 98 } // namespace policy
119 99
120 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_ 100 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698