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

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider.h

Issue 654263003: Implemented OwnerSettingsService::Set() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed crashes under asan. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/device_settings_provider.h
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.h b/chrome/browser/chromeos/settings/device_settings_provider.h
index c8b952e401211d14fc452bba65a7d5aa3337ff2b..83578ed5cb21d380025eb24549804b4accd9d1e8 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.h
+++ b/chrome/browser/chromeos/settings/device_settings_provider.h
@@ -5,9 +5,7 @@
#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_
#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_
-#include <deque>
#include <string>
-#include <utility>
#include <vector>
#include "base/basictypes.h"
@@ -18,6 +16,7 @@
#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chromeos/settings/cros_settings_provider.h"
+#include "components/ownership/owner_settings_service.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
namespace base {
@@ -31,8 +30,13 @@ class ChromeDeviceSettingsProto;
namespace chromeos {
// CrosSettingsProvider implementation that works with device settings.
-class DeviceSettingsProvider : public CrosSettingsProvider,
- public DeviceSettingsService::Observer {
+//
+// Note that the write path is in the process of being migrated to
+// OwnerSettingsServiceChromeOS (crbug.com/230018).
+class DeviceSettingsProvider
+ : public CrosSettingsProvider,
+ public DeviceSettingsService::Observer,
+ public ownership::OwnerSettingsService::Observer {
public:
// The callback type that is called to get the device mode.
typedef base::Callback<policy::DeviceMode(void)> GetDeviceModeCallback;
@@ -58,17 +62,17 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
// DeviceSettingsService::Observer implementation:
virtual void OwnershipStatusChanged() override;
virtual void DeviceSettingsUpdated() override;
+ virtual void OnDeviceSettingsServiceShutdown() override;
+
+ // ownership::OwnerSettingsService::Observer implementation:
+ virtual void OnTentativeChangesInPolicy(
+ const enterprise_management::PolicyData& policy_data) override;
// Populates in-memory cache from the local_state cache that is used to store
// device settings before the device is owned and to speed up policy
// availability before the policy blob is fetched on boot.
void RetrieveCachedData();
- // Stores a value from the |pending_changes_| queue in the device settings.
- // If the device is not owned yet the data ends up only in the local_state
- // cache and is serialized once ownership is acquired.
- void SetInPolicy();
-
// Parses the policy data and fills in |values_cache_|.
void UpdateValuesCache(
const enterprise_management::PolicyData& policy_data,
@@ -107,10 +111,6 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
// if new settings have been loaded.
bool UpdateFromService();
- // Sends |device_settings_| to |device_settings_service_| for signing and
- // storage in session_manager.
- void StoreDeviceSettings();
-
// Checks the current ownership status to see whether the device owner is
// logged in and writes the data accumulated in |migration_values_| to proper
// device settings.
@@ -125,22 +125,19 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
TrustedStatus trusted_status_;
DeviceSettingsService::OwnershipStatus ownership_status_;
- // The device settings as currently reported through the CrosSettingsProvider
- // interface. This may be different from the actual current device settings
- // (which can be obtained from |device_settings_service_|) in case the device
- // does not have an owner yet or there are pending changes that have not yet
- // been written to session_manager.
+ // The device settings as currently reported through the
+ // CrosSettingsProvider interface. This may be different from the
+ // actual current device settings (which can be obtained from
+ // |device_settings_service_|) in case the device does not have an
+ // owner yet. As soon as ownership of the device will be taken,
+ // |device_settings_| will stored on disk and won't be used.
enterprise_management::ChromeDeviceSettingsProto device_settings_;
// A cache of values, indexed by the settings keys served through the
- // CrosSettingsProvider interface. This is always kept in sync with the raw
- // data found in |device_settings_|.
+ // CrosSettingsProvider interface. This is always kept in sync with the
+ // current device settings.
PrefValueMap values_cache_;
- // This is a queue for set requests, because those need to be sequential.
- typedef std::pair<std::string, base::Value*> PendingQueueElement;
- std::deque<PendingQueueElement> pending_changes_;
-
// Weak pointer factory for creating store operation callbacks.
base::WeakPtrFactory<DeviceSettingsProvider> store_callback_factory_;

Powered by Google App Engine
This is Rietveld 408576698