OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_ | |
6 #define COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_ | |
Roger McFarlane (Chromium)
2017/02/24 03:00:13
Sorry I didn't see this before (and I'm surprised
devarajn
2017/02/24 03:09:40
Good catch!. Done.
Will post a new revision in a m
| |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/sequence_checker.h" | |
11 | |
12 namespace base { | |
13 template <typename T> | |
14 struct DefaultSingletonTraits; | |
15 } // namespace base | |
16 | |
17 namespace autofill { | |
18 | |
19 class AutofillTableEncryptor; | |
20 | |
21 // Factory for creating Autofill table encryptor. | |
22 // If |delegate_| is set, then |delegate_| is used to create encryptor, | |
23 // else default encrytor (SystemEncryptor) is returned. | |
24 class AutofillTableEncryptorFactory { | |
25 public: | |
26 // Embedders are recommended to use this delegate to inject | |
27 // their encryptor into Autofill table. | |
28 class Delegate { | |
29 public: | |
30 virtual ~Delegate() = default; | |
31 | |
32 virtual std::unique_ptr<AutofillTableEncryptor> Create() = 0; | |
33 }; | |
34 | |
35 static AutofillTableEncryptorFactory* GetInstance(); | |
36 | |
37 std::unique_ptr<AutofillTableEncryptor> Create(); | |
38 | |
39 void SetDelegate(std::unique_ptr<Delegate> delegate); | |
40 | |
41 private: | |
42 AutofillTableEncryptorFactory(); | |
43 ~AutofillTableEncryptorFactory(); | |
44 | |
45 std::unique_ptr<Delegate> delegate_; | |
46 base::SequenceChecker sequence_checker_; | |
47 | |
48 friend struct base::DefaultSingletonTraits<AutofillTableEncryptorFactory>; | |
49 DISALLOW_COPY_AND_ASSIGN(AutofillTableEncryptorFactory); | |
50 }; | |
51 | |
52 } // namespace autofill | |
53 | |
54 #endif // COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_ | |
OLD | NEW |