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 | |
|
Mathieu
2017/01/25 22:32:14
#include <utility>
sebsg
2017/01/30 20:27:26
Done.
| |
| 7 #include "base/time/clock.h" | |
| 8 #include "base/time/default_clock.h" | |
| 9 | |
| 10 namespace autofill { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 static base::LazyInstance<AutofillClock> g_autofill_clock = | |
| 15 LAZY_INSTANCE_INITIALIZER; | |
| 16 | |
| 17 } // namespace | |
| 18 | |
| 19 // static | |
| 20 base::Time AutofillClock::Now() { | |
| 21 return g_autofill_clock.Get().clock_->Now(); | |
| 22 } | |
| 23 | |
| 24 AutofillClock::AutofillClock() { | |
| 25 clock_.reset(new base::DefaultClock()); | |
| 26 } | |
| 27 | |
| 28 AutofillClock::~AutofillClock() {} | |
| 29 | |
| 30 // static | |
| 31 void AutofillClock::SetClockForTests(std::unique_ptr<base::Clock> clock) { | |
| 32 g_autofill_clock.Get().clock_ = std::move(clock); | |
| 33 } | |
| 34 | |
| 35 } // namespace autofill | |
| OLD | NEW |