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_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/sequence_checker.h" | |
11 #include "components/autofill/core/browser/webdata/autofill_table_encryptor.h" | |
12 | |
13 namespace base { | |
14 template <typename T> | |
15 struct DefaultSingletonTraits; | |
16 } // namespace base | |
17 | |
18 namespace autofill { | |
19 // Factory for creating Autofill table encryptor. | |
20 // If |delegate_| is set, then |delegate_| is used to create encryptor, | |
21 // else default encrytor (SystemEncryptor) is returned. | |
22 class AutofillTableEncryptorFactory { | |
23 public: | |
24 // Embedders are recommended to use this delegate to inject | |
25 // their encryptor into Autofill table. | |
26 class Delegate { | |
27 public: | |
28 virtual ~Delegate() = default; | |
29 | |
30 virtual std::unique_ptr<AutofillTableEncryptor> Create(); | |
Roger McFarlane (Chromium)
2017/02/22 22:50:52
make this pure virtual
devarajn
2017/02/22 23:10:54
Acknowledged.
| |
31 }; | |
32 | |
33 static AutofillTableEncryptorFactory* GetInstance(); | |
34 | |
35 std::unique_ptr<AutofillTableEncryptor> Create(); | |
36 | |
37 void SetDelegate(std::unique_ptr<Delegate> delegate); | |
38 | |
39 private: | |
40 AutofillTableEncryptorFactory(); | |
41 ~AutofillTableEncryptorFactory(); | |
42 | |
43 std::unique_ptr<Delegate> delegate_; | |
44 base::SequenceChecker sequence_checker_; | |
45 | |
46 friend struct base::DefaultSingletonTraits<AutofillTableEncryptorFactory>; | |
47 DISALLOW_COPY_AND_ASSIGN(AutofillTableEncryptorFactory); | |
48 }; | |
49 | |
50 } // namespace autofill | |
51 | |
52 #endif // COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_ | |
OLD | NEW |