Chromium Code Reviews| 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 | |
| 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 | |
| OLD | NEW |