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

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: 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 chromeos {
17 class DeviceSettingsService;
Joao da Silva 2012/08/28 19:56:57 .h included
Mattias Nissler (ping if slow) 2012/08/31 14:13:18 Done.
18 }
19
20 namespace enterprise_management {
21 class PolicyFetchResponse;
22 }
23
24 namespace policy {
25
26 class EnterpriseInstallAttributes;
27
28 // CloudPolicyStore implementation for device policy on Chrome OS. Policy is
29 // stored/loaded via DBus to/from session_manager.
30 class DeviceCloudPolicyStoreChromeOS
31 : public CloudPolicyStore,
32 public chromeos::DeviceSettingsService::Observer {
33 public:
34 DeviceCloudPolicyStoreChromeOS(
35 chromeos::DeviceSettingsService* device_settings_service,
36 EnterpriseInstallAttributes* install_attributes);
37 virtual ~DeviceCloudPolicyStoreChromeOS();
38
39 // CloudPolicyStore:
40 virtual void Store(
41 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
42 virtual void Load() OVERRIDE;
43 virtual void RemoveStoredPolicy() OVERRIDE;
44
45 // Installs initial policy. This is different from Store() in that it skips
46 // the signature validation step against already-installed policy. The checks
47 // against installation-time attributes are performed nevertheless. The result
48 // of the operation is reported through the OnStoreLoaded() or OnStoreError()
49 // observer callbacks.
50 void InstallInitialPolicy(
51 const enterprise_management::PolicyFetchResponse& policy);
52
53 // chromeos::DeviceSettingsService::Observer:
54 virtual void OwnershipStatusChanged() OVERRIDE;
55 virtual void DeviceSettingsUpdated() OVERRIDE;
56
57 private:
58 // Create a validator for |policy| with basic device policy configuration and
59 // OnPolicyStored() as the completion callback.
60 scoped_ptr<DeviceCloudPolicyValidator> CreateValidator(
61 const enterprise_management::PolicyFetchResponse& policy);
62
63 // Called on completion on the policy validation prior to storing policy.
64 // Starts the actual store operation.
65 void OnPolicyToStoreValidated(DeviceCloudPolicyValidator* validator);
66
67 // Handles store completion operations updates status.
68 void OnPolicyStored();
69
70 // Re-syncs policy and status from |device_settings_service_|.
71 void UpdateFromService();
72
73 chromeos::DeviceSettingsService* device_settings_service_;
74 EnterpriseInstallAttributes* install_attributes_;
75
76 base::WeakPtrFactory<DeviceCloudPolicyStoreChromeOS> weak_factory_;
77
78 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyStoreChromeOS);
79 };
80
81 } // namespace policy
82
83 #endif // CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_STORE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698