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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/webdata/autofill_table_encryptor_factory.h
diff --git a/components/autofill/core/browser/webdata/autofill_table_encryptor_factory.h b/components/autofill/core/browser/webdata/autofill_table_encryptor_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..9392bef256b2db3ba76d6d7a7535f13bbff9933e
--- /dev/null
+++ b/components/autofill/core/browser/webdata/autofill_table_encryptor_factory.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_
+#define COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_
+
+#include <memory>
+
+#include "base/memory/singleton.h"
+#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
+
+namespace autofill {
+// Factory for creating Autofill table encryptor.
+// If |delegate_| is set, then |delegate_| is used to create encryptor,
+// else default encrytor (SystemEncryptor) is returned.
+template <typename T>
+struct DefaultSingletonTraits;
+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.
+ public:
+ // Embedders are recommended to use this delegate to inject
+ // their encryptor into Autofill table.
+ class Delegate {
+ public:
+ 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.
+ };
+
+ static AutofillTableEncryptorFactory* GetInstance();
+
+ std::unique_ptr<AutofillTableEncryptor> Create();
+
+ void SetDelegate(
+ 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.
+ delegate);
+
+ private:
+ AutofillTableEncryptorFactory();
+ std::unique_ptr<autofill::AutofillTableEncryptorFactory::Delegate> delegate_;
+
+ friend struct base::DefaultSingletonTraits<AutofillTableEncryptorFactory>;
+ DISALLOW_COPY_AND_ASSIGN(AutofillTableEncryptorFactory);
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_WEBDATA_SERVICES_AUTOFILL_TABLE_ENCRYPTOR_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698