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

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: rebase 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 CloudPolicyIdentityStrategy; 20 class CloudPolicyDataStore;
21 class DeviceManagementService; 21 class DeviceManagementService;
22 class DeviceTokenFetcher; 22 class DeviceTokenFetcher;
23 class PolicyNotifier; 23 class PolicyNotifier;
24 24
25 // This class is a container for the infrastructure required to support cloud 25 // 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 26 // policy. It glues together the backend, the policy controller and manages the
27 // life cycle of the policy providers. 27 // life cycle of the policy providers.
28 class CloudPolicySubsystem 28 class CloudPolicySubsystem
29 : public NotificationObserver, 29 : public NotificationObserver,
30 public net::NetworkChangeNotifier::IPAddressObserver { 30 public net::NetworkChangeNotifier::IPAddressObserver {
(...skipping 29 matching lines...) Expand all
60 ObserverRegistrar(CloudPolicySubsystem* cloud_policy_subsystem, 60 ObserverRegistrar(CloudPolicySubsystem* cloud_policy_subsystem,
61 CloudPolicySubsystem::Observer* observer); 61 CloudPolicySubsystem::Observer* observer);
62 ~ObserverRegistrar(); 62 ~ObserverRegistrar();
63 63
64 private: 64 private:
65 PolicyNotifier* policy_notifier_; 65 PolicyNotifier* policy_notifier_;
66 CloudPolicySubsystem::Observer* observer_; 66 CloudPolicySubsystem::Observer* observer_;
67 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar); 67 DISALLOW_COPY_AND_ASSIGN(ObserverRegistrar);
68 }; 68 };
69 69
70 CloudPolicySubsystem(CloudPolicyIdentityStrategy* identity_strategy, 70 CloudPolicySubsystem(CloudPolicyDataStore* data_store,
71 CloudPolicyCacheBase* policy_cache); 71 CloudPolicyCacheBase* policy_cache);
72 virtual ~CloudPolicySubsystem(); 72 virtual ~CloudPolicySubsystem();
73 73
74 // net::NetworkChangeNotifier::IPAddressObserver: 74 // net::NetworkChangeNotifier::IPAddressObserver:
75 virtual void OnIPAddressChanged() OVERRIDE; 75 virtual void OnIPAddressChanged() OVERRIDE;
76 76
77 // Initializes the subsystem. The first network request will only be made 77 // Initializes the subsystem. The first network request will only be made
78 // after |delay_milliseconds|. It can be scheduled to be happen earlier by 78 // after |delay_milliseconds|. It can be scheduled to be happen earlier by
79 // calling |ScheduleInitialization|. 79 // calling |ScheduleInitialization|.
80 void CompleteInitialization(const char* refresh_pref_name, 80 void CompleteInitialization(const char* refresh_pref_name,
(...skipping 15 matching lines...) Expand all
96 static void RegisterPrefs(PrefService* pref_service); 96 static void RegisterPrefs(PrefService* pref_service);
97 97
98 // Schedule initialization of the policy backend service. 98 // Schedule initialization of the policy backend service.
99 void ScheduleServiceInitialization(int64 delay_milliseconds); 99 void ScheduleServiceInitialization(int64 delay_milliseconds);
100 100
101 private: 101 private:
102 friend class TestingCloudPolicySubsystem; 102 friend class TestingCloudPolicySubsystem;
103 103
104 CloudPolicySubsystem(); 104 CloudPolicySubsystem();
105 105
106 void Initialize(CloudPolicyIdentityStrategy* identity_strategy, 106 void Initialize(CloudPolicyDataStore* data_store,
107 CloudPolicyCacheBase* policy_cache, 107 CloudPolicyCacheBase* policy_cache,
108 const std::string& device_management_url); 108 const std::string& device_management_url);
109 109
110 // Updates the policy controller with a new refresh rate value. 110 // Updates the policy controller with a new refresh rate value.
111 void UpdatePolicyRefreshRate(int64 refresh_rate); 111 void UpdatePolicyRefreshRate(int64 refresh_rate);
112 112
113 // Returns a weak pointer to this subsystem's PolicyNotifier. 113 // Returns a weak pointer to this subsystem's PolicyNotifier.
114 PolicyNotifier* notifier() { 114 PolicyNotifier* notifier() {
115 return notifier_.get(); 115 return notifier_.get();
116 } 116 }
117 117
118 // Factory methods that may be overridden in tests. 118 // Factory methods that may be overridden in tests.
119 virtual void CreateDeviceTokenFetcher(); 119 virtual void CreateDeviceTokenFetcher();
120 virtual void CreateCloudPolicyController(); 120 virtual void CreateCloudPolicyController();
121 121
122 // NotificationObserver overrides. 122 // NotificationObserver overrides.
123 virtual void Observe(NotificationType type, 123 virtual void Observe(NotificationType type,
124 const NotificationSource& source, 124 const NotificationSource& source,
125 const NotificationDetails& details); 125 const NotificationDetails& details);
126 126
127 // Name of the preference to read the refresh rate from. 127 // Name of the preference to read the refresh rate from.
128 const char* refresh_pref_name_; 128 const char* refresh_pref_name_;
129 129
130 PrefChangeRegistrar pref_change_registrar_; 130 PrefChangeRegistrar pref_change_registrar_;
131 131
132 // Weak reference to pass on to |cloud_policy_controller_| on creation. 132 CloudPolicyDataStore* data_store_;
133 CloudPolicyIdentityStrategy* identity_strategy_;
134 133
135 // Cloud policy infrastructure stuff. 134 // Cloud policy infrastructure stuff.
136 scoped_ptr<PolicyNotifier> notifier_; 135 scoped_ptr<PolicyNotifier> notifier_;
137 scoped_ptr<DeviceManagementService> device_management_service_; 136 scoped_ptr<DeviceManagementService> device_management_service_;
138 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; 137 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_;
139 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; 138 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_;
140 scoped_ptr<CloudPolicyController> cloud_policy_controller_; 139 scoped_ptr<CloudPolicyController> cloud_policy_controller_;
141 140
142 std::string device_management_url_; 141 std::string device_management_url_;
143 142
144 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); 143 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem);
145 }; 144 };
146 145
147 } // namespace policy 146 } // namespace policy
148 147
149 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ 148 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_identity_strategy.cc ('k') | chrome/browser/policy/cloud_policy_subsystem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698