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

Side by Side Diff: chrome/browser/policy/device_cloud_policy_store_chromeos.h

Issue 10885015: Implement new-style CloudPolicyStore for Chrome OS device policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, fix compilation. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/settings/device_settings_service.h"
13 #include "chrome/browser/policy/cloud_policy_store.h"
14 #include "chrome/browser/policy/cloud_policy_validator.h"
15
16 namespace enterprise_management {
17 class PolicyFetchResponse;
18 }
19
20 namespace policy {
21
22 class EnterpriseInstallAttributes;
23
24 // CloudPolicyStore implementation for device policy on Chrome OS. Policy is
25 // stored/loaded via DBus to/from session_manager.
26 class DeviceCloudPolicyStoreChromeOS
27 : public CloudPolicyStore,
28 public chromeos::DeviceSettingsService::Observer {
29 public:
30 DeviceCloudPolicyStoreChromeOS(
31 chromeos::DeviceSettingsService* device_settings_service,
32 EnterpriseInstallAttributes* install_attributes);
33 virtual ~DeviceCloudPolicyStoreChromeOS();
34
35 // CloudPolicyStore:
36 virtual void Store(
37 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
38 virtual void Load() OVERRIDE;
39 virtual void RemoveStoredPolicy() OVERRIDE;
40
41 // Installs initial policy. This is different from Store() in that it skips
42 // the signature validation step against already-installed policy. The checks
43 // against installation-time attributes are performed nevertheless. The result
44 // of the operation is reported through the OnStoreLoaded() or OnStoreError()
45 // observer callbacks.
46 void InstallInitialPolicy(
47 const enterprise_management::PolicyFetchResponse& policy);
48
49 // chromeos::DeviceSettingsService::Observer:
50 virtual void OwnershipStatusChanged() OVERRIDE;
51 virtual void DeviceSettingsUpdated() OVERRIDE;
52
53 private:
54 // Create a validator for |policy| with basic device policy configuration and
55 // OnPolicyStored() as the completion callback.
56 scoped_ptr<DeviceCloudPolicyValidator> CreateValidator(
57 const enterprise_management::PolicyFetchResponse& policy);
58
59 // Called on completion on the policy validation prior to storing policy.
60 // Starts the actual store operation.
61 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator);
62
63 // Handles store completion operations updates status.
64 void OnPolicyStored();
65
66 // Re-syncs policy and status from |device_settings_service_|.
67 void UpdateFromService();
68
69 chromeos::DeviceSettingsService* device_settings_service_;
70 EnterpriseInstallAttributes* install_attributes_;
71
72 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_;
73
74 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS);
75 };
76
77 } // namespace policy
78
79 #endif // CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_store.h ('k') | chrome/browser/policy/device_cloud_policy_store_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698