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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_policy_store.h

Issue 2488573003: Expose signing key from cloud policy stores (Closed)
Patch Set: Fix tests Created 4 years, 1 month 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
OLDNEW
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_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" 15 #include "chrome/browser/chromeos/settings/device_settings_service.h"
16 #include "components/policy/core/common/cloud/cloud_policy_validator.h" 16 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
17 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h" 17 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h"
18 18
19 namespace base { 19 namespace base {
20 class SequencedTaskRunner; 20 class SequencedTaskRunner;
21 } 21 }
22 22
23 namespace chromeos { 23 namespace chromeos {
24 class DeviceSettingsService;
25 class SessionManagerClient; 24 class SessionManagerClient;
26 } 25 }
27 26
28 namespace enterprise_management { 27 namespace enterprise_management {
29 class PolicyFetchResponse; 28 class PolicyFetchResponse;
30 } 29 }
31 30
32 namespace policy { 31 namespace policy {
33 32
34 class DeviceLocalAccountPolicyBroker; 33 class DeviceLocalAccountPolicyBroker;
35 34
36 // CloudPolicyStore implementation for device-local account policy. Stores/loads 35 // CloudPolicyStore implementation for device-local account policy. Stores/loads
37 // policy to/from session_manager. 36 // policy to/from session_manager.
38 class DeviceLocalAccountPolicyStore 37 class DeviceLocalAccountPolicyStore
39 : public UserCloudPolicyStoreBase { 38 : public UserCloudPolicyStoreBase,
39 public chromeos::DeviceSettingsService::Observer {
40 public: 40 public:
41 DeviceLocalAccountPolicyStore( 41 DeviceLocalAccountPolicyStore(
42 const std::string& account_id, 42 const std::string& account_id,
43 chromeos::SessionManagerClient* client, 43 chromeos::SessionManagerClient* client,
44 chromeos::DeviceSettingsService* device_settings_service, 44 chromeos::DeviceSettingsService* device_settings_service,
45 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 45 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
46 ~DeviceLocalAccountPolicyStore() override; 46 ~DeviceLocalAccountPolicyStore() override;
47 47
48 const std::string& account_id() const { return account_id_; } 48 const std::string& account_id() const { return account_id_; }
49 49
50 // CloudPolicyStore: 50 // CloudPolicyStore:
51 void Store(const enterprise_management::PolicyFetchResponse& policy) override; 51 void Store(const enterprise_management::PolicyFetchResponse& policy) override;
52 void Load() override; 52 void Load() override;
53 53
54 private: 54 private:
55 // chromeos::DeviceSettingsService::Observer:
56 void DeviceSettingsUpdated() override;
57
58 // Updates state from the device settings service.
59 void UpdateFromDeviceSettingsService();
60
55 // Called back by |session_manager_client_| after policy retrieval. Checks for 61 // Called back by |session_manager_client_| after policy retrieval. Checks for
56 // success and triggers policy validation. 62 // success and triggers policy validation.
57 void ValidateLoadedPolicyBlob(const std::string& policy_blob); 63 void ValidateLoadedPolicyBlob(const std::string& policy_blob);
58 64
59 // Updates state after validation and notifies observers. 65 // Updates state after validation and notifies observers.
60 void UpdatePolicy(UserCloudPolicyValidator* validator); 66 void UpdatePolicy(UserCloudPolicyValidator* validator);
61 67
62 // Sends the policy blob to session_manager for storing after validation. 68 // Sends the policy blob to session_manager for storing after validation.
63 void StoreValidatedPolicy(UserCloudPolicyValidator* validator); 69 void StoreValidatedPolicy(UserCloudPolicyValidator* validator);
64 70
(...skipping 21 matching lines...) Expand all
86 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 92 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
87 93
88 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_; 94 base::WeakPtrFactory<DeviceLocalAccountPolicyStore> weak_factory_;
89 95
90 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore); 96 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyStore);
91 }; 97 };
92 98
93 } // namespace policy 99 } // namespace policy
94 100
95 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_ 101 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698