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