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

Side by Side Diff: components/autofill/core/common/autofill_clock.cc

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Added a scoped TestAutofillClock 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 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 #include "components/autofill/core/common/autofill_clock.h"
6
7 #include <utility>
8
9 #include "base/time/clock.h"
10 #include "base/time/default_clock.h"
11
12 namespace autofill {
13
14 std::unique_ptr<base::Clock> AutofillClock::clock_;
Roger McFarlane (Chromium) 2017/01/31 19:05:54 I think the autofill clock might need to be a sing
sebsg 2017/01/31 21:55:56 Done.
15
16 // static
17 base::Time AutofillClock::Now() {
18 if (!clock_)
19 SetClock();
20
21 return clock_->Now();
22 }
23
24 // static
25 void AutofillClock::SetClock() {
26 clock_.reset(new base::DefaultClock());
27 }
28
29 // static
30 void AutofillClock::SetTestClock(std::unique_ptr<base::Clock> clock) {
31 clock_ = std::move(clock);
32 }
33
34 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698