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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table_encryptor_factory.h

Issue 2698103002: Allow embedder to use custom cryptography in Autofill table. (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
1 // Copyright (c) 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/memory/singleton.h"
11 #include "components/autofill/core/browser/webdata/autofill_table_encryptor.h"
Roger McFarlane (Chromium) 2017/02/17 21:04:08 nit: forward declare AutofillTaableEncryptor in na
devarajn 2017/02/17 22:28:54 Done.
Roger McFarlane (Chromium) 2017/02/22 19:29:50 I think you forgot this one. It's not done. :)
devarajn 2017/02/22 22:07:59 Sorry missed it. I will ensure new revision has it
12
13 namespace autofill {
14 // Factory for creating Autofill table encryptor.
15 // If |delegate_| is set, then |delegate_| is used to create encryptor,
16 // else default encrytor (SystemEncryptor) is returned.
17 template <typename T>
18 struct DefaultSingletonTraits;
19 class AutofillTableEncryptorFactory {
Roger McFarlane (Chromium) 2017/02/17 21:04:09 What are the expected threading constraints on the
devarajn 2017/02/17 22:28:54 Make sense! done.
devarajn 2017/02/17 23:02:50 On second thought, can you explain little bit more
Roger McFarlane (Chromium) 2017/02/21 20:57:05 Create() and SetDelegate() are not threadsafe. Thi
devarajn 2017/02/21 21:19:54 Acknowledged.
20 public:
21 // Embedders are recommended to use this delegate to inject
22 // their encryptor into Autofill table.
23 class Delegate {
24 public:
25 virtual std::unique_ptr<autofill::AutofillTableEncryptor> Create();
Roger McFarlane (Chromium) 2017/02/17 21:04:08 nit: no need for autofill::
devarajn 2017/02/17 22:28:54 Done.
26 };
27
28 static AutofillTableEncryptorFactory* GetInstance();
29
30 std::unique_ptr<AutofillTableEncryptor> Create();
31
32 void SetDelegate(
33 std::unique_ptr<autofill::AutofillTableEncryptorFactory::Delegate>
Roger McFarlane (Chromium) 2017/02/17 21:04:08 nit: no need for autofill::AutofillEncryptorFactor
devarajn 2017/02/17 22:28:54 Done.
34 delegate);
35
36 private:
37 AutofillTableEncryptorFactory();
38 std::unique_ptr<autofill::AutofillTableEncryptorFactory::Delegate> delegate_;
39
40 friend struct base::DefaultSingletonTraits<AutofillTableEncryptorFactory>;
41 DISALLOW_COPY_AND_ASSIGN(AutofillTableEncryptorFactory);
42 };
43
44 } // namespace autofill
45
46 #endif // COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698