OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" | 17 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" |
18 #include "chromeos/dbus/session_manager_client.h" | 18 #include "chromeos/dbus/session_manager_client.h" |
19 | 19 |
20 namespace base { | |
21 template <typename T> struct DefaultLazyInstanceTraits; | |
22 } | |
23 | |
24 namespace crypto { | 20 namespace crypto { |
25 class RSAPrivateKey; | 21 class RSAPrivateKey; |
26 } | 22 } |
27 | 23 |
28 namespace enterprise_management { | 24 namespace enterprise_management { |
29 class ChromeDeviceSettingsProto; | 25 class ChromeDeviceSettingsProto; |
30 class PolicyData; | 26 class PolicyData; |
31 class PolicyFetchResponse; | 27 class PolicyFetchResponse; |
32 } | 28 } |
33 | 29 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 public: | 99 public: |
104 virtual ~Observer(); | 100 virtual ~Observer(); |
105 | 101 |
106 // Indicates device ownership status changes. | 102 // Indicates device ownership status changes. |
107 virtual void OwnershipStatusChanged() = 0; | 103 virtual void OwnershipStatusChanged() = 0; |
108 | 104 |
109 // Gets call after updates to the device settings. | 105 // Gets call after updates to the device settings. |
110 virtual void DeviceSettingsUpdated() = 0; | 106 virtual void DeviceSettingsUpdated() = 0; |
111 }; | 107 }; |
112 | 108 |
113 // Creates a device settings service instance. This is meant for unit tests, | 109 // Manage singleton instance. |
114 // production code uses the singleton returned by Get() below. | 110 static void Initialize(); |
115 DeviceSettingsService(); | 111 static bool IsInitialized(); |
116 ~DeviceSettingsService(); | 112 static void Shutdown(); |
117 | |
118 // Returns the singleton instance. | |
119 static DeviceSettingsService* Get(); | 113 static DeviceSettingsService* Get(); |
120 | 114 |
| 115 // Creates a device settings service instance. This is meant for unit tests, |
| 116 // production code uses the singleton returned by Get() above. |
| 117 DeviceSettingsService(); |
| 118 virtual ~DeviceSettingsService(); |
| 119 |
121 // To be called on startup once threads are initialized and DBus is ready. | 120 // To be called on startup once threads are initialized and DBus is ready. |
122 void Initialize(SessionManagerClient* session_manager_client, | 121 void SetSessionManager(SessionManagerClient* session_manager_client, |
123 scoped_refptr<OwnerKeyUtil> owner_key_util); | 122 scoped_refptr<OwnerKeyUtil> owner_key_util); |
124 | 123 |
125 // Prevents the service from making further calls to session_manager_client | 124 // Prevents the service from making further calls to session_manager_client |
126 // and stops any pending operations. | 125 // and stops any pending operations. |
127 void Shutdown(); | 126 void UnsetSessionManager(); |
128 | 127 |
129 // Returns the currently active device settings. Returns NULL if the device | 128 // Returns the currently active device settings. Returns NULL if the device |
130 // settings have not been retrieved from session_manager yet. | 129 // settings have not been retrieved from session_manager yet. |
131 const enterprise_management::PolicyData* policy_data() { | 130 const enterprise_management::PolicyData* policy_data() { |
132 return policy_data_.get(); | 131 return policy_data_.get(); |
133 } | 132 } |
134 const enterprise_management::ChromeDeviceSettingsProto* | 133 const enterprise_management::ChromeDeviceSettingsProto* |
135 device_settings() const { | 134 device_settings() const { |
136 return device_settings_.get(); | 135 return device_settings_.get(); |
137 } | 136 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 231 |
233 // For recoverable load errors how many retries are left before we give up. | 232 // For recoverable load errors how many retries are left before we give up. |
234 int load_retries_left_; | 233 int load_retries_left_; |
235 | 234 |
236 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); | 235 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); |
237 }; | 236 }; |
238 | 237 |
239 } // namespace chromeos | 238 } // namespace chromeos |
240 | 239 |
241 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 240 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |