summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/device_policy_cache.h
diff options
context:
space:
mode:
authorjkummerow@chromium.org <jkummerow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 14:19:27 +0000
committerjkummerow@chromium.org <jkummerow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 14:19:27 +0000
commit82e4080d97b52798c3605fa73979c0bdf0fdc597 (patch)
tree56f9ce7093b4faea11ae8528842b5b7fa5c5b72a /chrome/browser/policy/device_policy_cache.h
parent34daae316805e93a5d61faa6124e1a2f5172676e (diff)
downloadchromium_src-82e4080d97b52798c3605fa73979c0bdf0fdc597.zip
chromium_src-82e4080d97b52798c3605fa73979c0bdf0fdc597.tar.gz
chromium_src-82e4080d97b52798c3605fa73979c0bdf0fdc597.tar.bz2
Send policy blobs to session_manager
And also read policy back from session_manager into CloudPolicyCache, but there are no consumers of those values yet. BUG=chromium-os:11258 TEST=UserPolicyCacheTest.*; DevicePolicyCacheTest.* Review URL: http://codereview.chromium.org/6705031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy/device_policy_cache.h')
-rw-r--r--chrome/browser/policy/device_policy_cache.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/chrome/browser/policy/device_policy_cache.h b/chrome/browser/policy/device_policy_cache.h
new file mode 100644
index 0000000..f6a9514
--- /dev/null
+++ b/chrome/browser/policy/device_policy_cache.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_
+#define CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/chromeos/login/signed_settings.h"
+#include "chrome/browser/chromeos/login/signed_settings_helper.h"
+#include "chrome/browser/policy/cloud_policy_cache_base.h"
+#include "chrome/browser/policy/proto/chrome_device_policy.pb.h"
+
+namespace policy {
+
+class PolicyMap;
+
+namespace em = enterprise_management;
+
+// CloudPolicyCacheBase implementation that persists policy information
+// to ChromeOS' session manager (via SignedSettingsHelper).
+class DevicePolicyCache : public CloudPolicyCacheBase,
+ public chromeos::SignedSettingsHelper::Callback {
+ public:
+ DevicePolicyCache();
+ virtual ~DevicePolicyCache();
+
+ // CloudPolicyCacheBase implementation:
+ virtual void Load() OVERRIDE;
+ virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE;
+ virtual void SetUnmanaged() OVERRIDE;
+
+ // SignedSettingsHelper::Callback implementation:
+ virtual void OnStorePolicyCompleted(
+ chromeos::SignedSettings::ReturnCode code) OVERRIDE;
+ virtual void OnRetrievePolicyCompleted(
+ chromeos::SignedSettings::ReturnCode code,
+ const em::PolicyFetchResponse& policy) OVERRIDE;
+
+ private:
+ friend class DevicePolicyCacheTest;
+
+ // Alternate c'tor allowing tests to mock out the SignedSettingsHelper
+ // singleton.
+ explicit DevicePolicyCache(
+ chromeos::SignedSettingsHelper* signed_settings_helper);
+
+ // CloudPolicyCacheBase implementation:
+ virtual bool DecodePolicyData(const em::PolicyData& policy_data,
+ PolicyMap* mandatory,
+ PolicyMap* recommended) OVERRIDE;
+
+ static void DecodeDevicePolicy(const em::ChromeDeviceSettingsProto& policy,
+ PolicyMap* mandatory,
+ PolicyMap* recommended);
+
+ chromeos::SignedSettingsHelper* signed_settings_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_