| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // windows.h must be first otherwise Win8 SDK breaks. | 5 // windows.h must be first otherwise Win8 SDK breaks. |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #include <LM.h> | 7 #include <LM.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <wincred.h> | 10 #include <wincred.h> |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void GetOsPasswordStatus() { | 200 void GetOsPasswordStatus() { |
| 201 // Preferences can be accessed on the UI thread only. | 201 // Preferences can be accessed on the UI thread only. |
| 202 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 202 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 203 PrefService* local_state = g_browser_process->local_state(); | 203 PrefService* local_state = g_browser_process->local_state(); |
| 204 std::unique_ptr<PasswordCheckPrefs> prefs(new PasswordCheckPrefs); | 204 std::unique_ptr<PasswordCheckPrefs> prefs(new PasswordCheckPrefs); |
| 205 prefs->Read(local_state); | 205 prefs->Read(local_state); |
| 206 std::unique_ptr<OsPasswordStatus> status( | 206 std::unique_ptr<OsPasswordStatus> status( |
| 207 new OsPasswordStatus(PASSWORD_STATUS_UNKNOWN)); | 207 new OsPasswordStatus(PASSWORD_STATUS_UNKNOWN)); |
| 208 PasswordCheckPrefs* prefs_weak = prefs.get(); | 208 PasswordCheckPrefs* prefs_weak = prefs.get(); |
| 209 OsPasswordStatus* status_weak = status.get(); | 209 OsPasswordStatus* status_weak = status.get(); |
| 210 // This task calls ::LogonUser(), hence MayBlock(). |
| 210 base::PostTaskWithTraitsAndReply( | 211 base::PostTaskWithTraitsAndReply( |
| 211 FROM_HERE, base::TaskTraits() | 212 FROM_HERE, base::TaskTraits() |
| 212 .WithPriority(base::TaskPriority::BACKGROUND) | 213 .WithPriority(base::TaskPriority::BACKGROUND) |
| 213 .WithWait(), | 214 .MayBlock(), |
| 214 base::Bind(&GetOsPasswordStatusInternal, prefs_weak, status_weak), | 215 base::Bind(&GetOsPasswordStatusInternal, prefs_weak, status_weak), |
| 215 base::Bind(&ReplyOsPasswordStatus, base::Passed(&prefs), | 216 base::Bind(&ReplyOsPasswordStatus, base::Passed(&prefs), |
| 216 base::Passed(&status))); | 217 base::Passed(&status))); |
| 217 } | 218 } |
| 218 | 219 |
| 219 } // namespace | 220 } // namespace |
| 220 | 221 |
| 221 void DelayReportOsPassword() { | 222 void DelayReportOsPassword() { |
| 222 content::BrowserThread::PostDelayedTask(content::BrowserThread::UI, FROM_HERE, | 223 content::BrowserThread::PostDelayedTask(content::BrowserThread::UI, FROM_HERE, |
| 223 base::Bind(&GetOsPasswordStatus), | 224 base::Bind(&GetOsPasswordStatus), |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 318 } |
| 318 } | 319 } |
| 319 SecureZeroMemory(password, sizeof(password)); | 320 SecureZeroMemory(password, sizeof(password)); |
| 320 } | 321 } |
| 321 } while (credErr == NO_ERROR && | 322 } while (credErr == NO_ERROR && |
| 322 (retval == false && tries < kMaxPasswordRetries)); | 323 (retval == false && tries < kMaxPasswordRetries)); |
| 323 return retval; | 324 return retval; |
| 324 } | 325 } |
| 325 | 326 |
| 326 } // namespace password_manager_util_win | 327 } // namespace password_manager_util_win |
| OLD | NEW |