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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" 13 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h"
13 #include "chrome/browser/chromeos/settings/device_settings_service.h" 14 #include "chrome/browser/chromeos/settings/device_settings_service.h"
14 #include "net/cert/x509_util_nss.h" 15 #include "net/cert/x509_util_nss.h"
15 16
16 namespace enterprise_management { 17 namespace enterprise_management {
17 class ChromeDeviceSettingsProto; 18 class ChromeDeviceSettingsProto;
18 class PolicyData; 19 class PolicyData;
19 class PolicyFetchResponse; 20 class PolicyFetchResponse;
20 } 21 }
21 22
(...skipping 20 matching lines...) Expand all
42 43
43 // Starts the operation. 44 // Starts the operation.
44 void Start(SessionManagerClient* session_manager_client, 45 void Start(SessionManagerClient* session_manager_client,
45 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util, 46 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util,
46 scoped_refptr<ownership::PublicKey> public_key); 47 scoped_refptr<ownership::PublicKey> public_key);
47 48
48 // Restarts a load operation (if that part is already in progress). 49 // Restarts a load operation (if that part is already in progress).
49 void RestartLoad(bool key_changed); 50 void RestartLoad(bool key_changed);
50 51
51 // Accessors for recovering the loaded policy data after completion. 52 // Accessors for recovering the loaded policy data after completion.
52 scoped_ptr<enterprise_management::PolicyData>& policy_data() { 53 std::unique_ptr<enterprise_management::PolicyData>& policy_data() {
53 return policy_data_; 54 return policy_data_;
54 } 55 }
55 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto>& 56 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto>&
56 device_settings() { 57 device_settings() {
57 return device_settings_; 58 return device_settings_;
58 } 59 }
59 60
60 // Public part of the owner key as configured/loaded from disk. 61 // Public part of the owner key as configured/loaded from disk.
61 scoped_refptr<ownership::PublicKey> public_key() { return public_key_; } 62 scoped_refptr<ownership::PublicKey> public_key() { return public_key_; }
62 63
63 // Whether the load operation is underway. 64 // Whether the load operation is underway.
64 bool is_loading() const { return is_loading_; } 65 bool is_loading() const { return is_loading_; }
65 66
66 void set_force_key_load(bool force_key_load) { 67 void set_force_key_load(bool force_key_load) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 107
107 SessionManagerClient* session_manager_client_; 108 SessionManagerClient* session_manager_client_;
108 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; 109 scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_;
109 110
110 Callback callback_; 111 Callback callback_;
111 112
112 scoped_refptr<ownership::PublicKey> public_key_; 113 scoped_refptr<ownership::PublicKey> public_key_;
113 bool force_key_load_; 114 bool force_key_load_;
114 115
115 bool is_loading_; 116 bool is_loading_;
116 scoped_ptr<enterprise_management::PolicyData> policy_data_; 117 std::unique_ptr<enterprise_management::PolicyData> policy_data_;
117 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_; 118 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto>
119 device_settings_;
118 120
119 base::WeakPtrFactory<SessionManagerOperation> weak_factory_; 121 base::WeakPtrFactory<SessionManagerOperation> weak_factory_;
120 122
121 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation); 123 DISALLOW_COPY_AND_ASSIGN(SessionManagerOperation);
122 }; 124 };
123 125
124 // This operation loads the public owner key from disk if appropriate, fetches 126 // This operation loads the public owner key from disk if appropriate, fetches
125 // the policy blob from session manager, and validates the loaded policy blob. 127 // the policy blob from session manager, and validates the loaded policy blob.
126 class LoadSettingsOperation : public SessionManagerOperation { 128 class LoadSettingsOperation : public SessionManagerOperation {
127 public: 129 public:
128 // Creates a new load operation. 130 // Creates a new load operation.
129 explicit LoadSettingsOperation(const Callback& callback); 131 explicit LoadSettingsOperation(const Callback& callback);
130 ~LoadSettingsOperation() override; 132 ~LoadSettingsOperation() override;
131 133
132 protected: 134 protected:
133 // SessionManagerOperation: 135 // SessionManagerOperation:
134 void Run() override; 136 void Run() override;
135 137
136 private: 138 private:
137 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation); 139 DISALLOW_COPY_AND_ASSIGN(LoadSettingsOperation);
138 }; 140 };
139 141
140 // Stores a pre-generated policy blob and reloads the device settings from 142 // Stores a pre-generated policy blob and reloads the device settings from
141 // session_manager. 143 // session_manager.
142 class StoreSettingsOperation : public SessionManagerOperation { 144 class StoreSettingsOperation : public SessionManagerOperation {
143 public: 145 public:
144 // Creates a new store operation. 146 // Creates a new store operation.
145 StoreSettingsOperation( 147 StoreSettingsOperation(
146 const Callback& callback, 148 const Callback& callback,
147 scoped_ptr<enterprise_management::PolicyFetchResponse> policy); 149 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy);
148 ~StoreSettingsOperation() override; 150 ~StoreSettingsOperation() override;
149 151
150 protected: 152 protected:
151 // SessionManagerOperation: 153 // SessionManagerOperation:
152 void Run() override; 154 void Run() override;
153 155
154 private: 156 private:
155 // Handles the result of the store operation and triggers the load. 157 // Handles the result of the store operation and triggers the load.
156 void HandleStoreResult(bool success); 158 void HandleStoreResult(bool success);
157 159
158 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; 160 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_;
159 161
160 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_; 162 base::WeakPtrFactory<StoreSettingsOperation> weak_factory_;
161 163
162 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation); 164 DISALLOW_COPY_AND_ASSIGN(StoreSettingsOperation);
163 }; 165 };
164 166
165 } // namespace chromeos 167 } // namespace chromeos
166 168
167 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_ 169 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SESSION_MANAGER_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698