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 <wincred.h> | 8 #include <wincred.h> |
9 | 9 |
10 // SECURITY_WIN32 must be defined in order to get | 10 // SECURITY_WIN32 must be defined in order to get |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/threading/worker_pool.h" | 21 #include "base/threading/worker_pool.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/grit/chromium_strings.h" | 25 #include "chrome/grit/chromium_strings.h" |
26 #include "components/password_manager/core/browser/password_manager.h" | 26 #include "components/password_manager/core/browser/password_manager.h" |
27 #include "components/password_manager/core/common/password_manager_pref_names.h" | 27 #include "components/password_manager/core/common/password_manager_pref_names.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
30 #include "content/public/browser/render_widget_host_view.h" | 30 #include "content/public/browser/render_widget_host_view.h" |
31 #include "ui/base/l10n/l10n_util.h" | |
32 | |
33 #if defined(USE_AURA) | |
34 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
35 #include "ui/aura/window_tree_host.h" | 32 #include "ui/aura/window_tree_host.h" |
36 #endif | 33 #include "ui/base/l10n/l10n_util.h" |
37 | 34 |
38 namespace password_manager_util { | 35 namespace password_manager_util { |
39 namespace { | 36 namespace { |
40 | 37 |
41 const unsigned kMaxPasswordRetries = 3; | 38 const unsigned kMaxPasswordRetries = 3; |
42 | 39 |
43 const unsigned kCredUiDefaultFlags = | 40 const unsigned kCredUiDefaultFlags = |
44 CREDUI_FLAGS_GENERIC_CREDENTIALS | | 41 CREDUI_FLAGS_GENERIC_CREDENTIALS | |
45 CREDUI_FLAGS_EXCLUDE_CERTIFICATES | | 42 CREDUI_FLAGS_EXCLUDE_CERTIFICATES | |
46 CREDUI_FLAGS_KEEP_USERNAME | | 43 CREDUI_FLAGS_KEEP_USERNAME | |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 238 } |
242 } | 239 } |
243 | 240 |
244 // Try and obtain a friendly display name. | 241 // Try and obtain a friendly display name. |
245 username_length = CREDUI_MAX_USERNAME_LENGTH; | 242 username_length = CREDUI_MAX_USERNAME_LENGTH; |
246 if (GetUserNameEx(NameDisplay, displayname, &username_length)) | 243 if (GetUserNameEx(NameDisplay, displayname, &username_length)) |
247 use_displayname = true; | 244 use_displayname = true; |
248 | 245 |
249 cui.cbSize = sizeof(CREDUI_INFO); | 246 cui.cbSize = sizeof(CREDUI_INFO); |
250 cui.hwndParent = NULL; | 247 cui.hwndParent = NULL; |
251 #if defined(USE_AURA) | |
252 cui.hwndParent = window->GetHost()->GetAcceleratedWidget(); | 248 cui.hwndParent = window->GetHost()->GetAcceleratedWidget(); |
253 #else | |
254 cui.hwndParent = window; | |
255 #endif | |
256 | 249 |
257 cui.pszMessageText = password_prompt.c_str(); | 250 cui.pszMessageText = password_prompt.c_str(); |
258 cui.pszCaptionText = product_name.c_str(); | 251 cui.pszCaptionText = product_name.c_str(); |
259 | 252 |
260 cui.hbmBanner = NULL; | 253 cui.hbmBanner = NULL; |
261 BOOL save_password = FALSE; | 254 BOOL save_password = FALSE; |
262 DWORD credErr = NO_ERROR; | 255 DWORD credErr = NO_ERROR; |
263 | 256 |
264 do { | 257 do { |
265 tries++; | 258 tries++; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 291 } |
299 } | 292 } |
300 SecureZeroMemory(password, sizeof(password)); | 293 SecureZeroMemory(password, sizeof(password)); |
301 } | 294 } |
302 } while (credErr == NO_ERROR && | 295 } while (credErr == NO_ERROR && |
303 (retval == false && tries < kMaxPasswordRetries)); | 296 (retval == false && tries < kMaxPasswordRetries)); |
304 return retval; | 297 return retval; |
305 } | 298 } |
306 | 299 |
307 } // namespace password_manager_util | 300 } // namespace password_manager_util |
OLD | NEW |