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

Unified Diff: components/autofill/core/common/autofill_clock.h

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Addressed comments Created 3 years, 11 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/common/autofill_clock.h
diff --git a/components/autofill/core/common/autofill_clock.h b/components/autofill/core/common/autofill_clock.h
new file mode 100644
index 0000000000000000000000000000000000000000..2bb3cf408030d104fa1bb50a89de1eaed5f53093
--- /dev/null
+++ b/components/autofill/core/common/autofill_clock.h
@@ -0,0 +1,40 @@
+// Copyright 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_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_
Mathieu 2017/01/25 22:32:14 fix
sebsg 2017/01/30 20:27:26 Done.
+#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_
+
+#include <memory>
+
+#include "base/gtest_prod_util.h"
Mathieu 2017/01/25 22:32:14 need?
sebsg 2017/01/30 20:27:26 Done.
+#include "base/lazy_instance.h"
Mathieu 2017/01/25 22:32:14 move to cc?
sebsg 2017/01/30 20:27:26 Done.
+#include "base/macros.h"
+
+namespace base {
+class Clock;
+class Time;
+} // namespace base
+
+namespace autofill {
+
+class AutofillClock {
Mathieu 2017/01/25 22:32:14 Please add at least a class comment
sebsg 2017/01/30 20:27:26 Done.
+ public:
+ static base::Time Now();
+
+ AutofillClock();
Mathieu 2017/01/25 22:32:14 nit: I think I would put ctor and dtor before the
sebsg 2017/01/30 20:27:26 Done.
+ ~AutofillClock();
+
+ private:
+ friend class PersonalDataManagerTest;
+
+ static void SetClockForTests(std::unique_ptr<base::Clock> clock);
+
+ std::unique_ptr<base::Clock> clock_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutofillClock);
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_

Powered by Google App Engine
This is Rietveld 408576698