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_DEVICE_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "chrome/browser/chromeos/cros_settings_provider.h" | 15 #include "chrome/browser/chromeos/cros_settings_provider.h" |
16 #include "chrome/browser/chromeos/login/ownership_service.h" | 16 #include "chrome/browser/chromeos/login/ownership_service.h" |
17 #include "chrome/browser/chromeos/signed_settings_migration_helper.h" | 17 #include "chrome/browser/chromeos/signed_settings_migration_helper.h" |
| 18 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
18 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 19 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
19 #include "chrome/browser/prefs/pref_value_map.h" | 20 #include "chrome/browser/prefs/pref_value_map.h" |
20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class Value; | 24 class Value; |
24 } | 25 } |
25 | 26 |
26 namespace chromeos { | 27 namespace chromeos { |
27 | 28 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Stores a value from the |pending_changes_| queue in the signed settings. | 60 // Stores a value from the |pending_changes_| queue in the signed settings. |
60 // If the device is not owned yet the data ends up only in the local_state | 61 // If the device is not owned yet the data ends up only in the local_state |
61 // cache and is serialized once ownership is acquired. | 62 // cache and is serialized once ownership is acquired. |
62 void SetInPolicy(); | 63 void SetInPolicy(); |
63 | 64 |
64 // Finalizes stores to the policy file if the cache is dirty. | 65 // Finalizes stores to the policy file if the cache is dirty. |
65 void FinishSetInPolicy( | 66 void FinishSetInPolicy( |
66 SignedSettings::ReturnCode code, | 67 SignedSettings::ReturnCode code, |
67 const enterprise_management::PolicyFetchResponse& policy); | 68 const enterprise_management::PolicyFetchResponse& policy); |
68 | 69 |
| 70 // Decode the various groups of policies. |
| 71 void DecodeLoginPolicies( |
| 72 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 73 PrefValueMap* new_values_cache) const; |
| 74 void DecodeKioskPolicies( |
| 75 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 76 PrefValueMap* new_values_cache) const; |
| 77 void DecodeNetworkPolicies( |
| 78 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 79 PrefValueMap* new_values_cache) const; |
| 80 void DecodeReportingPolicies( |
| 81 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 82 PrefValueMap* new_values_cache) const; |
| 83 void DecodeGenericPolicies( |
| 84 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 85 PrefValueMap* new_values_cache) const; |
| 86 |
69 // Parses the policy cache and fills the cache of base::Value objects. | 87 // Parses the policy cache and fills the cache of base::Value objects. |
70 void UpdateValuesCache(); | 88 void UpdateValuesCache(); |
71 | 89 |
72 // Applies the metrics policy and if not set migrates the legacy file. | 90 // Applies the metrics policy and if not set migrates the legacy file. |
73 void ApplyMetricsSetting(bool use_file, bool new_value) const; | 91 void ApplyMetricsSetting(bool use_file, bool new_value) const; |
74 | 92 |
75 // Applies the data roaming policy. | 93 // Applies the data roaming policy. |
76 void ApplyRoamingSetting(bool new_value) const; | 94 void ApplyRoamingSetting(bool new_value) const; |
77 | 95 |
78 // Applies any changes of the policies that are not handled by the respective | 96 // Applies any changes of the policies that are not handled by the respective |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // This is a queue for set requests, because those need to be sequential. | 143 // This is a queue for set requests, because those need to be sequential. |
126 typedef std::pair<std::string, base::Value*> PendingQueueElement; | 144 typedef std::pair<std::string, base::Value*> PendingQueueElement; |
127 std::vector<PendingQueueElement> pending_changes_; | 145 std::vector<PendingQueueElement> pending_changes_; |
128 | 146 |
129 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); | 147 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); |
130 }; | 148 }; |
131 | 149 |
132 } // namespace chromeos | 150 } // namespace chromeos |
133 | 151 |
134 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ | 152 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ |
OLD | NEW |