OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/proximity_auth/proximity_auth_system.h" | 5 #include "components/proximity_auth/proximity_auth_system.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "base/time/default_clock.h" | 9 #include "base/time/default_clock.h" |
10 #include "components/proximity_auth/logging/logging.h" | 10 #include "components/proximity_auth/logging/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // password to authenticate. | 22 // password to authenticate. |
23 const int64_t kPasswordReauthPeriodHours = 20; | 23 const int64_t kPasswordReauthPeriodHours = 20; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 ProximityAuthSystem::ProximityAuthSystem( | 27 ProximityAuthSystem::ProximityAuthSystem( |
28 ScreenlockType screenlock_type, | 28 ScreenlockType screenlock_type, |
29 ProximityAuthClient* proximity_auth_client) | 29 ProximityAuthClient* proximity_auth_client) |
30 : screenlock_type_(screenlock_type), | 30 : screenlock_type_(screenlock_type), |
31 proximity_auth_client_(proximity_auth_client), | 31 proximity_auth_client_(proximity_auth_client), |
32 unlock_manager_( | |
33 new UnlockManagerImpl(screenlock_type, proximity_auth_client)), | |
34 clock_(new base::DefaultClock()), | 32 clock_(new base::DefaultClock()), |
35 pref_manager_(new ProximityAuthPrefManager( | 33 pref_manager_(new ProximityAuthPrefManager( |
36 proximity_auth_client->GetPrefService())), | 34 proximity_auth_client->GetPrefService())), |
| 35 unlock_manager_(new UnlockManagerImpl(screenlock_type, |
| 36 proximity_auth_client_, |
| 37 pref_manager_.get())), |
37 suspended_(false), | 38 suspended_(false), |
38 started_(false), | 39 started_(false), |
39 weak_ptr_factory_(this) {} | 40 weak_ptr_factory_(this) {} |
40 | 41 |
41 ProximityAuthSystem::ProximityAuthSystem( | 42 ProximityAuthSystem::ProximityAuthSystem( |
42 ScreenlockType screenlock_type, | 43 ScreenlockType screenlock_type, |
43 ProximityAuthClient* proximity_auth_client, | 44 ProximityAuthClient* proximity_auth_client, |
44 std::unique_ptr<UnlockManager> unlock_manager, | 45 std::unique_ptr<UnlockManager> unlock_manager, |
45 std::unique_ptr<base::Clock> clock, | 46 std::unique_ptr<base::Clock> clock, |
46 std::unique_ptr<ProximityAuthPrefManager> pref_manager) | 47 std::unique_ptr<ProximityAuthPrefManager> pref_manager) |
47 : screenlock_type_(screenlock_type), | 48 : screenlock_type_(screenlock_type), |
48 proximity_auth_client_(proximity_auth_client), | 49 proximity_auth_client_(proximity_auth_client), |
49 unlock_manager_(std::move(unlock_manager)), | |
50 clock_(std::move(clock)), | 50 clock_(std::move(clock)), |
51 pref_manager_(std::move(pref_manager)), | 51 pref_manager_(std::move(pref_manager)), |
| 52 unlock_manager_(std::move(unlock_manager)), |
52 suspended_(false), | 53 suspended_(false), |
53 started_(false), | 54 started_(false), |
54 weak_ptr_factory_(this) {} | 55 weak_ptr_factory_(this) {} |
55 | 56 |
56 ProximityAuthSystem::~ProximityAuthSystem() { | 57 ProximityAuthSystem::~ProximityAuthSystem() { |
57 ScreenlockBridge::Get()->RemoveObserver(this); | 58 ScreenlockBridge::Get()->RemoveObserver(this); |
58 unlock_manager_->SetRemoteDeviceLifeCycle(nullptr); | 59 unlock_manager_->SetRemoteDeviceLifeCycle(nullptr); |
59 } | 60 } |
60 | 61 |
61 void ProximityAuthSystem::Start() { | 62 void ProximityAuthSystem::Start() { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 PA_LOG(ERROR) << "Invalid last password timestamp: now=" << now_ms | 212 PA_LOG(ERROR) << "Invalid last password timestamp: now=" << now_ms |
212 << ", last_password=" << last_password_ms; | 213 << ", last_password=" << last_password_ms; |
213 return true; | 214 return true; |
214 } | 215 } |
215 | 216 |
216 return base::TimeDelta::FromMilliseconds(now_ms - last_password_ms) > | 217 return base::TimeDelta::FromMilliseconds(now_ms - last_password_ms) > |
217 base::TimeDelta::FromHours(kPasswordReauthPeriodHours); | 218 base::TimeDelta::FromHours(kPasswordReauthPeriodHours); |
218 } | 219 } |
219 | 220 |
220 } // proximity_auth | 221 } // proximity_auth |
OLD | NEW |