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

Side by Side Diff: chrome/browser/chromeos/settings/session_manager_operation.h

Issue 2486813002: Add DeviceADPolicyManager to provide AD policy. (Closed)
Patch Set: Polish 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_SETTINGS_SESSION_MANAGER_OPERATION_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 device_settings() { 57 device_settings() {
58 return device_settings_; 58 return device_settings_;
59 } 59 }
60 60
61 // Public part of the owner key as configured/loaded from disk. 61 // Public part of the owner key as configured/loaded from disk.
62 scoped_refptr<ownership::PublicKey> public_key() { return public_key_; } 62 scoped_refptr<ownership::PublicKey> public_key() { return public_key_; }
63 63
64 // Whether the load operation is underway. 64 // Whether the load operation is underway.
65 bool is_loading() const { return is_loading_; } 65 bool is_loading() const { return is_loading_; }
66 66
67 void set_force_key_load(bool force_key_load) {
68 force_key_load_ = force_key_load;
69 }
70
71 protected: 67 protected:
72 // Runs the operation. The result is reported through |callback_|. 68 // Runs the operation. The result is reported through |callback_|.
73 virtual void Run() = 0; 69 virtual void Run() = 0;
74 70
75 // Ensures the public key is loaded. 71 // Ensures the public key is loaded.
76 void EnsurePublicKey(const base::Closure& callback); 72 void EnsurePublicKey(const base::Closure& callback);
77 73
78 // Starts a load operation. 74 // Starts a load operation.
79 void StartLoading(); 75 void StartLoading();
80 76
81 // Reports the result status of the operation. Once this gets called, the 77 // Reports the result status of the operation. Once this gets called, the
82 // operation should not perform further processing or trigger callbacks. 78 // operation should not perform further processing or trigger callbacks.
83 void ReportResult(DeviceSettingsService::Status status); 79 void ReportResult(DeviceSettingsService::Status status);
84 80
85 SessionManagerClient* session_manager_client() { 81 SessionManagerClient* session_manager_client() {
86 return session_manager_client_; 82 return session_manager_client_;
87 } 83 }
88 84
85 // Whether to verify the loaded policy's signature against |public_key_|.
86 // (Active Directory policy has no signature that could be verified.)
87 bool verify_signature_ = true;
88
89 bool force_key_load_ = false;
90
89 private: 91 private:
90 // Loads the owner key from disk. Must be run on a thread that can do I/O. 92 // Loads the owner key from disk. Must be run on a thread that can do I/O.
91 static scoped_refptr<ownership::PublicKey> LoadPublicKey( 93 static scoped_refptr<ownership::PublicKey> LoadPublicKey(
92 scoped_refptr<ownership::OwnerKeyUtil> util, 94 scoped_refptr<ownership::OwnerKeyUtil> util,
93 scoped_refptr<ownership::PublicKey> current_key); 95 scoped_refptr<ownership::PublicKey> current_key);
94 96
95 // Stores the owner key loaded by LoadOwnerKey and calls |callback|. 97 // Stores the owner key loaded by LoadOwnerKey and calls |callback|.
96 void StorePublicKey(const base::Closure& callback, 98 void StorePublicKey(const base::Closure& callback,
97 scoped_refptr<ownership::PublicKey> new_key); 99 scoped_refptr<ownership::PublicKey> new_key);
98 100
99 // Triggers a device settings load. 101 // Triggers a device settings load.
100 void RetrieveDeviceSettings(); 102 void RetrieveDeviceSettings();
101 103
102 // Validates device settings after retrieval from session_manager. 104 // Validates device settings after retrieval from session_manager.
103 void ValidateDeviceSettings(const std::string& policy_blob); 105 void ValidateDeviceSettings(const std::string& policy_blob);
104 106
105 // Extracts status and device settings from the validator and reports them. 107 // Extracts status and device settings from the validator and reports them.
106 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator); 108 void ReportValidatorStatus(policy::DeviceCloudPolicyValidator* validator);
107 109
108 SessionManagerClient* session_manager_client_; 110 SessionManagerClient* session_manager_client_ = nullptr;
109 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; 111 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_;
110 112
111 Callback callback_; 113 Callback callback_;
112 114
113 scoped_refptr<ownership::PublicKey> public_key_; 115 scoped_refptr<ownership::PublicKey> public_key_;
114 bool force_key_load_;
115 116
116 bool is_loading_; 117 bool is_loading_ = false;
117 std::unique_ptr<enterprise_management::PolicyData> policy_data_; 118 std::unique_ptr<enterprise_management::PolicyData> policy_data_;
118 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto> 119 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto>
119 device_settings_; 120 device_settings_;
120 121
121 base::WeakPtrFactory<SessionManagerOperation> weak_factory_; 122 base::WeakPtrFactory<SessionManagerOperation> weak_factory_;
122 123
123 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation); 124 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation);
124 }; 125 };
125 126
126 // This operation loads the public owner key from disk if appropriate, fetches 127 // This operation loads the public owner key from disk if appropriate, fetches
127 // the policy blob from session manager, and validates the loaded policy blob. 128 // the policy blob from session manager, and validates the loaded policy blob.
128 class LoadSettingsOperation : public SessionManagerOperation { 129 class LoadSettingsOperation : public SessionManagerOperation {
129 public: 130 public:
130 // Creates a new load operation. 131 // Creates a new load operation.
131 explicit LoadSettingsOperation(const Callback& callback); 132 LoadSettingsOperation(bool force_key_load,
133 bool verify_signature,
134 const Callback& callback);
132 ~LoadSettingsOperation() override; 135 ~LoadSettingsOperation() override;
133 136
134 protected: 137 protected:
135 // SessionManagerOperation: 138 // SessionManagerOperation:
136 void Run() override; 139 void Run() override;
137 140
138 private: 141 private:
139 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); 142 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation);
140 }; 143 };
141 144
(...skipping 18 matching lines...) Expand all
160 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_; 163 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_;
161 164
162 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; 165 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_;
163 166
164 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); 167 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation);
165 }; 168 };
166 169
167 } // namespace chromeos 170 } // namespace chromeos
168 171
169 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ 172 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698