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_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 class DeviceSettingsProvider | 36 class DeviceSettingsProvider |
37 : public CrosSettingsProvider, | 37 : public CrosSettingsProvider, |
38 public DeviceSettingsService::Observer, | 38 public DeviceSettingsService::Observer, |
39 public ownership::OwnerSettingsService::Observer { | 39 public ownership::OwnerSettingsService::Observer { |
40 public: | 40 public: |
41 // The callback type that is called to get the device mode. | 41 // The callback type that is called to get the device mode. |
42 typedef base::Callback<policy::DeviceMode(void)> GetDeviceModeCallback; | 42 typedef base::Callback<policy::DeviceMode(void)> GetDeviceModeCallback; |
43 | 43 |
44 DeviceSettingsProvider(const NotifyObserversCallback& notify_cb, | 44 DeviceSettingsProvider(const NotifyObserversCallback& notify_cb, |
45 DeviceSettingsService* device_settings_service); | 45 DeviceSettingsService* device_settings_service); |
46 virtual ~DeviceSettingsProvider(); | 46 ~DeviceSettingsProvider() override; |
47 | 47 |
48 // Returns true if |path| is handled by this provider. | 48 // Returns true if |path| is handled by this provider. |
49 static bool IsDeviceSetting(const std::string& name); | 49 static bool IsDeviceSetting(const std::string& name); |
50 | 50 |
51 // CrosSettingsProvider implementation. | 51 // CrosSettingsProvider implementation. |
52 virtual const base::Value* Get(const std::string& path) const override; | 52 const base::Value* Get(const std::string& path) const override; |
53 virtual TrustedStatus PrepareTrustedValues( | 53 TrustedStatus PrepareTrustedValues(const base::Closure& callback) override; |
54 const base::Closure& callback) override; | 54 bool HandlesSetting(const std::string& path) const override; |
55 virtual bool HandlesSetting(const std::string& path) const override; | |
56 | 55 |
57 private: | 56 private: |
58 // CrosSettingsProvider implementation: | 57 // CrosSettingsProvider implementation: |
59 virtual void DoSet(const std::string& path, | 58 void DoSet(const std::string& path, const base::Value& value) override; |
60 const base::Value& value) override; | |
61 | 59 |
62 // DeviceSettingsService::Observer implementation: | 60 // DeviceSettingsService::Observer implementation: |
63 virtual void OwnershipStatusChanged() override; | 61 void OwnershipStatusChanged() override; |
64 virtual void DeviceSettingsUpdated() override; | 62 void DeviceSettingsUpdated() override; |
65 virtual void OnDeviceSettingsServiceShutdown() override; | 63 void OnDeviceSettingsServiceShutdown() override; |
66 | 64 |
67 // ownership::OwnerSettingsService::Observer implementation: | 65 // ownership::OwnerSettingsService::Observer implementation: |
68 virtual void OnTentativeChangesInPolicy( | 66 void OnTentativeChangesInPolicy( |
69 const enterprise_management::PolicyData& policy_data) override; | 67 const enterprise_management::PolicyData& policy_data) override; |
70 | 68 |
71 // Populates in-memory cache from the local_state cache that is used to store | 69 // Populates in-memory cache from the local_state cache that is used to store |
72 // device settings before the device is owned and to speed up policy | 70 // device settings before the device is owned and to speed up policy |
73 // availability before the policy blob is fetched on boot. | 71 // availability before the policy blob is fetched on boot. |
74 void RetrieveCachedData(); | 72 void RetrieveCachedData(); |
75 | 73 |
76 // Parses the policy data and fills in |values_cache_|. | 74 // Parses the policy data and fills in |values_cache_|. |
77 void UpdateValuesCache( | 75 void UpdateValuesCache( |
78 const enterprise_management::PolicyData& policy_data, | 76 const enterprise_management::PolicyData& policy_data, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 InitializationTestUnowned); | 144 InitializationTestUnowned); |
147 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, | 145 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, |
148 PolicyFailedPermanentlyNotification); | 146 PolicyFailedPermanentlyNotification); |
149 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, PolicyLoadNotification); | 147 FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest, PolicyLoadNotification); |
150 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); | 148 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); |
151 }; | 149 }; |
152 | 150 |
153 } // namespace chromeos | 151 } // namespace chromeos |
154 | 152 |
155 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ | 153 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_ |
OLD | NEW |