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

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: Fix/Extend NetworkConfigurationUpdater unit test. 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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
16 13
17 class Profile;
18
19 namespace net {
20 class CertTrustAnchorProvider;
21 }
22
23 namespace chromeos { 14 namespace chromeos {
24 class User; 15 class User;
25 } 16 }
26 17
27 namespace policy { 18 namespace policy {
28 19
29 class CloudPolicyManager; 20 class CloudPolicyManager;
30 class ConfigurationPolicyProvider; 21 class ConfigurationPolicyProvider;
31 class PolicyService; 22 class PolicyService;
32 23
33 // A BrowserContextKeyedService that creates and manages the per-Profile policy 24 // A BrowserContextKeyedService that creates and manages the per-Profile policy
34 // components. 25 // components.
35 class ProfilePolicyConnector : public BrowserContextKeyedService { 26 class ProfilePolicyConnector : public BrowserContextKeyedService {
36 public: 27 public:
37 explicit ProfilePolicyConnector(Profile* profile); 28 ProfilePolicyConnector();
38 virtual ~ProfilePolicyConnector(); 29 virtual ~ProfilePolicyConnector();
39 30
40 // If |force_immediate_load| then disk caches will be loaded synchronously. 31 // If |force_immediate_load| then disk caches will be loaded synchronously.
41 void Init(bool force_immediate_load, 32 void Init(bool force_immediate_load,
42 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
43 const chromeos::User* user, 34 const chromeos::User* user,
44 #endif 35 #endif
45 CloudPolicyManager* user_cloud_policy_manager); 36 CloudPolicyManager* user_cloud_policy_manager);
46 37
47 void InitForTesting(scoped_ptr<PolicyService> service); 38 void InitForTesting(scoped_ptr<PolicyService> service);
48 39
49 // BrowserContextKeyedService: 40 // BrowserContextKeyedService:
50 virtual void Shutdown() OVERRIDE; 41 virtual void Shutdown() OVERRIDE;
51 42
52 // This is never NULL. 43 // This is never NULL.
53 PolicyService* policy_service() const { return policy_service_.get(); } 44 PolicyService* policy_service() const { return policy_service_.get(); }
54 45
55 #if defined(OS_CHROMEOS) 46 private:
56 // Returns a callback that should be called if a policy installed certificate 47 #if defined(ENABLE_CONFIGURATION_POLICY) && defined(OS_CHROMEOS)
57 // was trusted for the associated profile. The closure can be safely used (on 48 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username);
58 // the UI thread) even after this Connector is destructed.
59 base::Closure GetPolicyCertTrustedCallback();
60 #endif
61 49
62 // Returns true if |profile()| has used certificates installed via policy
63 // to establish a secure connection before. This means that it may have
64 // cached content from an untrusted source.
65 bool UsedPolicyCertificates();
66
67 private:
68 #if defined(ENABLE_CONFIGURATION_POLICY)
69
70 #if defined(OS_CHROMEOS)
71 void SetUsedPolicyCertificatesOnce();
72 void InitializeDeviceLocalAccountPolicyProvider(const std::string& username);
73 #endif
74
75 #if defined(OS_CHROMEOS)
76 // Some of the user policy configuration affects browser global state, and 50 // Some of the user policy configuration affects browser global state, and
77 // can only come from one Profile. |is_primary_user_| is true if this 51 // can only come from one Profile. |is_primary_user_| is true if this
78 // connector belongs to the first signed-in Profile, and in that case that 52 // connector belongs to the first signed-in Profile, and in that case that
79 // Profile's policy is the one that affects global policy settings in 53 // Profile's policy is the one that affects global policy settings in
80 // local state. 54 // local state.
81 bool is_primary_user_; 55 bool is_primary_user_;
82 56
83 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_; 57 scoped_ptr<ConfigurationPolicyProvider> special_user_policy_provider_;
84
85 base::WeakPtrFactory<ProfilePolicyConnector> weak_ptr_factory_;
86 #endif 58 #endif
87 59
88 Profile* profile_;
89
90 #endif // ENABLE_CONFIGURATION_POLICY
91
92 scoped_ptr<PolicyService> policy_service_; 60 scoped_ptr<PolicyService> policy_service_;
93 61
94 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector); 62 DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
95 }; 63 };
96 64
97 } // namespace policy 65 } // namespace policy
98 66
99 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_ 67 #endif // CHROME_BROWSER_POLICY_PROFILE_POLICY_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698