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

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

Issue 7298012: Consolidate data storage and notifications in the cloud policy subsystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CLOUD_POLICY_SUBSYSTEM_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/prefs/pref_change_registrar.h" 10 #include "chrome/browser/prefs/pref_change_registrar.h"
11 #include "content/common/notification_observer.h" 11 #include "content/common/notification_observer.h"
12 #include "net/base/network_change_notifier.h" 12 #include "net/base/network_change_notifier.h"
13 13
14 class PrefService; 14 class PrefService;
15 15
16 namespace policy { 16 namespace policy {
17 17
18 class CloudPolicyCacheBase; 18 class CloudPolicyCacheBase;
19 class CloudPolicyController; 19 class CloudPolicyController;
20 class CloudPolicyData;
20 class CloudPolicyIdentityStrategy; 21 class CloudPolicyIdentityStrategy;
Joao da Silva 2011/07/06 16:45:14 Nit: CloudPolicyIdentityStrategy is no more!
gfeher 2011/07/07 13:51:00 Done.
21 class DeviceManagementService; 22 class DeviceManagementService;
22 class DeviceTokenFetcher; 23 class DeviceTokenFetcher;
23 class PolicyNotifier; 24 class PolicyNotifier;
24 25
25 // This class is a container for the infrastructure required to support cloud 26 // This class is a container for the infrastructure required to support cloud
26 // policy. It glues together the backend, the policy controller and manages the 27 // policy. It glues together the backend, the policy controller and manages the
27 // life cycle of the policy providers. 28 // life cycle of the policy providers.
28 class CloudPolicySubsystem 29 class CloudPolicySubsystem
29 : public NotificationObserver, 30 : public NotificationObserver,
30 public net::NetworkChangeNotifier::IPAddressObserver { 31 public net::NetworkChangeNotifier::IPAddressObserver {
(...skipping 29 matching lines...) Expand all
60 ObserverRegistrar(CloudPolicySubsystem* cloud_policy_subsystem, 61 ObserverRegistrar(CloudPolicySubsystem* cloud_policy_subsystem,
61 CloudPolicySubsystem::Observer* observer); 62 CloudPolicySubsystem::Observer* observer);
62 ~ObserverRegistrar(); 63 ~ObserverRegistrar();
63 64
64 private: 65 private:
65 PolicyNotifier* policy_notifier_; 66 PolicyNotifier* policy_notifier_;
66 CloudPolicySubsystem::Observer* observer_; 67 CloudPolicySubsystem::Observer* observer_;
67 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar); 68 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar);
68 }; 69 };
69 70
70 CloudPolicySubsystem(CloudPolicyIdentityStrategy* identity_strategy, 71 CloudPolicySubsystem(CloudPolicyData* data,
71 CloudPolicyCacheBase* policy_cache); 72 CloudPolicyCacheBase* policy_cache);
72 virtual ~CloudPolicySubsystem(); 73 virtual ~CloudPolicySubsystem();
73 74
74 // net::NetworkChangeNotifier::IPAddressObserver: 75 // net::NetworkChangeNotifier::IPAddressObserver:
75 virtual void OnIPAddressChanged() OVERRIDE; 76 virtual void OnIPAddressChanged() OVERRIDE;
76 77
77 // Initializes the subsystem. The first network request will only be made 78 // Initializes the subsystem. The first network request will only be made
78 // after |delay_milliseconds|. It can be scheduled to be happen earlier by 79 // after |delay_milliseconds|. It can be scheduled to be happen earlier by
79 // calling |ScheduleInitialization|. 80 // calling |ScheduleInitialization|.
80 void CompleteInitialization(const char* refresh_pref_name, 81 void CompleteInitialization(const char* refresh_pref_name,
(...skipping 15 matching lines...) Expand all
96 static void RegisterPrefs(PrefService* pref_service); 97 static void RegisterPrefs(PrefService* pref_service);
97 98
98 // Schedule initialization of the policy backend service. 99 // Schedule initialization of the policy backend service.
99 void ScheduleServiceInitialization(int64 delay_milliseconds); 100 void ScheduleServiceInitialization(int64 delay_milliseconds);
100 101
101 private: 102 private:
102 friend class TestingCloudPolicySubsystem; 103 friend class TestingCloudPolicySubsystem;
103 104
104 CloudPolicySubsystem(); 105 CloudPolicySubsystem();
105 106
106 void Initialize(CloudPolicyIdentityStrategy* identity_strategy, 107 void Initialize(CloudPolicyData* data,
107 CloudPolicyCacheBase* policy_cache, 108 CloudPolicyCacheBase* policy_cache,
108 const std::string& device_management_url); 109 const std::string& device_management_url);
109 110
110 // Updates the policy controller with a new refresh rate value. 111 // Updates the policy controller with a new refresh rate value.
111 void UpdatePolicyRefreshRate(int64 refresh_rate); 112 void UpdatePolicyRefreshRate(int64 refresh_rate);
112 113
113 // Returns a weak pointer to this subsystem's PolicyNotifier. 114 // Returns a weak pointer to this subsystem's PolicyNotifier.
114 PolicyNotifier* notifier() { 115 PolicyNotifier* notifier() {
115 return notifier_.get(); 116 return notifier_.get();
116 } 117 }
117 118
118 // Factory methods that may be overridden in tests. 119 // Factory methods that may be overridden in tests.
119 virtual void CreateDeviceTokenFetcher(); 120 virtual void CreateDeviceTokenFetcher();
120 virtual void CreateCloudPolicyController(); 121 virtual void CreateCloudPolicyController();
121 122
122 // NotificationObserver overrides. 123 // NotificationObserver overrides.
123 virtual void Observe(NotificationType type, 124 virtual void Observe(NotificationType type,
124 const NotificationSource& source, 125 const NotificationSource& source,
125 const NotificationDetails& details); 126 const NotificationDetails& details);
126 127
127 // Name of the preference to read the refresh rate from. 128 // Name of the preference to read the refresh rate from.
128 const char* refresh_pref_name_; 129 const char* refresh_pref_name_;
129 130
130 PrefChangeRegistrar pref_change_registrar_; 131 PrefChangeRegistrar pref_change_registrar_;
131 132
132 // Weak reference to pass on to |cloud_policy_controller_| on creation. 133 CloudPolicyData* cloud_policy_data_;
133 CloudPolicyIdentityStrategy* identity_strategy_;
134 134
135 // Cloud policy infrastructure stuff. 135 // Cloud policy infrastructure stuff.
136 scoped_ptr<PolicyNotifier> notifier_; 136 scoped_ptr<PolicyNotifier> notifier_;
137 scoped_ptr<DeviceManagementService> device_management_service_; 137 scoped_ptr<DeviceManagementService> device_management_service_;
138 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; 138 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_;
139 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; 139 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_;
140 scoped_ptr<CloudPolicyController> cloud_policy_controller_; 140 scoped_ptr<CloudPolicyController> cloud_policy_controller_;
141 141
142 std::string device_management_url_; 142 std::string device_management_url_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); 144 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem);
145 }; 145 };
146 146
147 } // namespace policy 147 } // namespace policy
148 148
149 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 149 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698