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 <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
14 #include "chrome/browser/chromeos/cros_settings_provider.h" | 15 #include "chrome/browser/chromeos/cros_settings_provider.h" |
15 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | 16 #include "chrome/browser/chromeos/login/ownership_service.h" |
16 #include "chrome/browser/chromeos/signed_settings_migration_helper.h" | 17 #include "chrome/browser/chromeos/signed_settings_migration_helper.h" |
17 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 18 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 19 #include "chrome/browser/prefs/pref_value_map.h" |
18 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
19 | 21 |
20 namespace base { | 22 namespace base { |
21 class Value; | 23 class Value; |
22 } | 24 } |
23 | 25 |
24 namespace chromeos { | 26 namespace chromeos { |
25 | 27 |
26 class OwnershipService; | |
27 | |
28 // CrosSettingsProvider implementation that works with SignedSettings. | 28 // CrosSettingsProvider implementation that works with SignedSettings. |
29 class DeviceSettingsProvider : public CrosSettingsProvider, | 29 class DeviceSettingsProvider : public CrosSettingsProvider, |
30 public content::NotificationObserver { | 30 public content::NotificationObserver { |
31 public: | 31 public: |
32 explicit DeviceSettingsProvider(const NotifyObserversCallback& notify_cb); | 32 explicit DeviceSettingsProvider(const NotifyObserversCallback& notify_cb); |
33 virtual ~DeviceSettingsProvider(); | 33 virtual ~DeviceSettingsProvider(); |
34 | 34 |
35 // CrosSettingsProvider implementation. | 35 // CrosSettingsProvider implementation. |
36 virtual const base::Value* Get(const std::string& path) const OVERRIDE; | 36 virtual const base::Value* Get(const std::string& path) const OVERRIDE; |
37 virtual bool GetTrusted(const std::string& path, | 37 virtual bool GetTrusted(const std::string& path, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Parses the policy cache and fills the cache of base::Value objects. | 69 // Parses the policy cache and fills the cache of base::Value objects. |
70 void UpdateValuesCache(); | 70 void UpdateValuesCache(); |
71 | 71 |
72 // Applies the metrics policy and if not set migrates the legacy file. | 72 // Applies the metrics policy and if not set migrates the legacy file. |
73 void ApplyMetricsSetting(bool use_file, bool new_value) const; | 73 void ApplyMetricsSetting(bool use_file, bool new_value) const; |
74 | 74 |
75 // Applies the data roaming policy. | 75 // Applies the data roaming policy. |
76 void ApplyRoamingSetting(bool new_value) const; | 76 void ApplyRoamingSetting(bool new_value) const; |
77 | 77 |
78 // Applies any changes of the policies that are not handled by the respective | 78 // Applies any changes of the policies that are not handled by the respective |
79 // subsystms. | 79 // subsystems. |
80 void ApplySideEffects() const; | 80 void ApplySideEffects() const; |
81 | 81 |
82 // In case of missing policy blob we should verify if this is upgrade of | 82 // In case of missing policy blob we should verify if this is upgrade of |
83 // machine owned from pre version 12 OS and the user never touched the device | 83 // machine owned from pre version 12 OS and the user never touched the device |
84 // settings. In this case revert to defaults and let people in until the owner | 84 // settings. In this case revert to defaults and let people in until the owner |
85 // comes and changes that. | 85 // comes and changes that. |
86 bool MitigateMissingPolicy(); | 86 bool MitigateMissingPolicy(); |
87 | 87 |
88 // Called right before boolean property is changed. | 88 // Called right before boolean property is changed. |
89 void OnBooleanPropertyChange(const std::string& path, bool new_value); | 89 void OnBooleanPropertyChange(const std::string& path, bool new_value); |
(...skipping 29 matching lines...) Expand all Loading... |
119 | 119 |
120 enterprise_management::PolicyData policy_; | 120 enterprise_management::PolicyData policy_; |
121 bool trusted_; | 121 bool trusted_; |
122 | 122 |
123 PrefValueMap values_cache_; | 123 PrefValueMap values_cache_; |
124 | 124 |
125 // This is a queue for set requests, because those need to be sequential. | 125 // This is a queue for set requests, because those need to be sequential. |
126 typedef std::pair<std::string, base::Value*> PendingQueueElement; | 126 typedef std::pair<std::string, base::Value*> PendingQueueElement; |
127 std::vector<PendingQueueElement> pending_changes_; | 127 std::vector<PendingQueueElement> pending_changes_; |
128 | 128 |
129 friend class SignedSettingsHelper; | |
130 | |
131 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); | 129 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider); |
132 }; | 130 }; |
133 | 131 |
134 } // namespace chromeos | 132 } // namespace chromeos |
135 | 133 |
136 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ | 134 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_SETTINGS_PROVIDER_H_ |
OLD | NEW |