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

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

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use callback_list in PolicyCertVerifier. Created 7 years, 2 months 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"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
17 13
18 #if defined(OS_CHROMEOS)
19 #include "chromeos/dbus/dbus_method_call_status.h"
20 #endif
21
22 class Profile; 14 class Profile;
Joao da Silva 2013/10/16 12:44:58 not used
pneubeck (no reviews) 2013/10/22 18:47:41 Done.
23 15
24 namespace base { 16 namespace base {
25 class SequencedTaskRunner; 17 class SequencedTaskRunner;
26 } 18 }
27 19
28 namespace net { 20 namespace chromeos {
29 class CertTrustAnchorProvider; 21 class User;
30 }
31
32 namespace net {
33 class X509Certificate;
34 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
35 } 22 }
36 23
37 namespace policy { 24 namespace policy {
38 25
26 class CloudPolicyManager;
39 class ConfigurationPolicyProvider; 27 class ConfigurationPolicyProvider;
40 class UserNetworkConfigurationUpdater;
41 class PolicyService; 28 class PolicyService;
42 class PolicyCertVerifier; 29 class PolicyCertVerifier;
43 30
44 // A BrowserContextKeyedService that creates and manages the per-Profile policy 31 // A BrowserContextKeyedService that creates and manages the per-Profile policy
45 // components. 32 // components.
46 class ProfilePolicyConnector : public BrowserContextKeyedService { 33 class ProfilePolicyConnector : public BrowserContextKeyedService {
47 public: 34 public:
48 explicit ProfilePolicyConnector(Profile* profile); 35 ProfilePolicyConnector();
49 virtual ~ProfilePolicyConnector(); 36 virtual ~ProfilePolicyConnector();
50 37
51 // If |force_immediate_load| then disk caches will be loaded synchronously. 38 // If |force_immediate_load| then disk caches will be loaded synchronously.
52 void Init(bool force_immediate_load, 39 void Init(bool force_immediate_load,
40 #if defined(OS_CHROMEOS)
41 const chromeos::User* user,
42 #endif
43 CloudPolicyManager* user_cloud_policy_manager,
53 base::SequencedTaskRunner* sequenced_task_runner); 44 base::SequencedTaskRunner* sequenced_task_runner);
54 45
55 void InitForTesting(scoped_ptr<PolicyService> service); 46 void InitForTesting(scoped_ptr<PolicyService> service);
56 47
57 // BrowserContextKeyedService: 48 // BrowserContextKeyedService:
58 virtual void Shutdown() OVERRIDE; 49 virtual void Shutdown() OVERRIDE;
59 50
60 // This is never NULL. 51 // This is never NULL.
61 PolicyService* policy_service() const { return policy_service_.get(); } 52 PolicyService* policy_service() const { return policy_service_.get(); }
62 53
63 #if defined(OS_CHROMEOS) 54 private:
64 // Sets the CertVerifier on which the current list of Web trusted server and 55 #if defined(ENABLE_CONFIGURATION_POLICY) && defined(OS_CHROMEOS)
65 // CA certificates will be set. Policy updates will trigger further calls to 56 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username);
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 57
72 // 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
74 // the UI thread) even after this Connector is destructed.
75 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
81
82 // Returns true if |profile()| has used certificates installed via policy
83 // to establish a secure connection before. This means that it may have
84 // cached content from an untrusted source.
85 bool UsedPolicyCertificates();
86
87 private:
88 #if defined(ENABLE_CONFIGURATION_POLICY)
89
90 #if defined(OS_CHROMEOS)
91 void SetUsedPolicyCertificatesOnce();
92 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username);
93 #endif
94
95 #if defined(OS_CHROMEOS)
96 // Some of the user policy configuration affects browser global state, and 58 // 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 59 // 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 60 // 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 61 // Profile's policy is the one that affects global policy settings in
100 // local state. 62 // local state.
101 bool is_primary_user_; 63 bool is_primary_user_;
102 64
103 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_; 65 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_;
104 scoped_ptr<UserNetworkConfigurationUpdater> network_configuration_updater_;
105
106 base::WeakPtrFactory<ProfilePolicyConnector> weak_ptr_factory_;
107 #endif 66 #endif
108 67
109 Profile* profile_;
110
111 #endif // ENABLE_CONFIGURATION_POLICY
112
113 scoped_ptr<PolicyService> policy_service_; 68 scoped_ptr<PolicyService> policy_service_;
114 69
115 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector); 70 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
116 }; 71 };
117 72
118 } // namespace policy 73 } // namespace policy
119 74
120 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_ 75 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698