OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_UTIL_CRYPTOGRAPHER_H_ | 5 #ifndef SYNC_UTIL_CRYPTOGRAPHER_H_ |
6 #define SYNC_UTIL_CRYPTOGRAPHER_H_ | 6 #define SYNC_UTIL_CRYPTOGRAPHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
15 #include "sync/protocol/encryption.pb.h" | 15 #include "sync/protocol/encryption.pb.h" |
16 #include "sync/util/nigori.h" | 16 #include "sync/util/nigori.h" |
17 | 17 |
18 namespace sync_pb { | 18 namespace sync_pb { |
19 class NigoriKeyBag; | 19 class NigoriKeyBag; |
20 class NigoriSpecifics; | 20 class NigoriSpecifics; |
21 } | 21 } |
22 | 22 |
23 namespace syncer { | 23 namespace syncer { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 private: | 191 private: |
192 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; | 192 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; |
193 | 193 |
194 // Helper method to instantiate Nigori instances for each set of key | 194 // Helper method to instantiate Nigori instances for each set of key |
195 // parameters in |bag|. | 195 // parameters in |bag|. |
196 // Does not update the default nigori. | 196 // Does not update the default nigori. |
197 void InstallKeyBag(const sync_pb::NigoriKeyBag& bag); | 197 void InstallKeyBag(const sync_pb::NigoriKeyBag& bag); |
198 | 198 |
199 // Helper method to add a nigori to the keybag, optionally making it the | 199 // Helper method to add a nigori to the keybag, optionally making it the |
200 // default as well. | 200 // default as well. |
201 bool AddKeyImpl(scoped_ptr<Nigori> nigori, bool set_as_default); | 201 bool AddKeyImpl(std::unique_ptr<Nigori> nigori, bool set_as_default); |
202 | 202 |
203 // Helper to unencrypt a bootstrap token into a serialized sync_pb::NigoriKey. | 203 // Helper to unencrypt a bootstrap token into a serialized sync_pb::NigoriKey. |
204 std::string UnpackBootstrapToken(const std::string& token) const; | 204 std::string UnpackBootstrapToken(const std::string& token) const; |
205 | 205 |
206 Encryptor* const encryptor_; | 206 Encryptor* const encryptor_; |
207 | 207 |
208 // The Nigoris we know about, mapped by key name. | 208 // The Nigoris we know about, mapped by key name. |
209 NigoriMap nigoris_; | 209 NigoriMap nigoris_; |
210 | 210 |
211 // The key name associated with the default nigori. If non-empty, must | 211 // The key name associated with the default nigori. If non-empty, must |
212 // correspond to a nigori within |nigoris_|. | 212 // correspond to a nigori within |nigoris_|. |
213 std::string default_nigori_name_; | 213 std::string default_nigori_name_; |
214 | 214 |
215 scoped_ptr<sync_pb::EncryptedData> pending_keys_; | 215 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; |
216 | 216 |
217 DISALLOW_ASSIGN(Cryptographer); | 217 DISALLOW_ASSIGN(Cryptographer); |
218 }; | 218 }; |
219 | 219 |
220 } // namespace syncer | 220 } // namespace syncer |
221 | 221 |
222 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ | 222 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ |
OLD | NEW |