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 "chrome/browser/signin/easy_unlock_service_regular.h" | 5 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 void EasyUnlockServiceRegular::InitializeInternal() { | 159 void EasyUnlockServiceRegular::InitializeInternal() { |
160 registrar_.Init(profile()->GetPrefs()); | 160 registrar_.Init(profile()->GetPrefs()); |
161 registrar_.Add( | 161 registrar_.Add( |
162 prefs::kEasyUnlockAllowed, | 162 prefs::kEasyUnlockAllowed, |
163 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, | 163 base::Bind(&EasyUnlockServiceRegular::OnPrefsChanged, |
164 base::Unretained(this))); | 164 base::Unretained(this))); |
165 OnPrefsChanged(); | 165 OnPrefsChanged(); |
166 } | 166 } |
167 | 167 |
| 168 void EasyUnlockServiceRegular::ShutdownInternal() { |
| 169 turn_off_flow_.reset(); |
| 170 turn_off_flow_status_ = EasyUnlockService::IDLE; |
| 171 registrar_.RemoveAll(); |
| 172 } |
| 173 |
168 bool EasyUnlockServiceRegular::IsAllowedInternal() { | 174 bool EasyUnlockServiceRegular::IsAllowedInternal() { |
169 #if defined(OS_CHROMEOS) | 175 #if defined(OS_CHROMEOS) |
170 if (!user_manager::UserManager::Get()->IsLoggedInAsRegularUser()) | 176 if (!user_manager::UserManager::Get()->IsLoggedInAsRegularUser()) |
171 return false; | 177 return false; |
172 | 178 |
173 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) | 179 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) |
174 return false; | 180 return false; |
175 | 181 |
176 return true; | 182 return true; |
177 #else | 183 #else |
(...skipping 16 matching lines...) Expand all Loading... |
194 | 200 |
195 if (!success) { | 201 if (!success) { |
196 SetTurnOffFlowStatus(FAIL); | 202 SetTurnOffFlowStatus(FAIL); |
197 return; | 203 return; |
198 } | 204 } |
199 | 205 |
200 ClearRemoteDevices(); | 206 ClearRemoteDevices(); |
201 SetTurnOffFlowStatus(IDLE); | 207 SetTurnOffFlowStatus(IDLE); |
202 ReloadApp(); | 208 ReloadApp(); |
203 } | 209 } |
OLD | NEW |