OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/chrome/browser/passwords/password_controller.h" | 5 #import "ios/chrome/browser/passwords/password_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> |
10 #include <memory> | 11 #include <memory> |
11 #include <utility> | 12 #include <utility> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #import "base/ios/weak_nsobject.h" | 15 #import "base/ios/weak_nsobject.h" |
15 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
16 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
17 #include "base/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
18 #include "base/mac/scoped_nsobject.h" | 19 #include "base/mac/scoped_nsobject.h" |
19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 passwordManagerClient_.reset(); | 339 passwordManagerClient_.reset(); |
339 } | 340 } |
340 | 341 |
341 - (void)findAndFillPasswordForms:(NSString*)username | 342 - (void)findAndFillPasswordForms:(NSString*)username |
342 password:(NSString*)password | 343 password:(NSString*)password |
343 completionHandler:(void (^)(BOOL))completionHandler { | 344 completionHandler:(void (^)(BOOL))completionHandler { |
344 [self findPasswordFormsWithCompletionHandler:^( | 345 [self findPasswordFormsWithCompletionHandler:^( |
345 const std::vector<autofill::PasswordForm>& forms) { | 346 const std::vector<autofill::PasswordForm>& forms) { |
346 for (const auto& form : forms) { | 347 for (const auto& form : forms) { |
347 autofill::PasswordFormFillData formData; | 348 autofill::PasswordFormFillData formData; |
348 autofill::PasswordFormMap matches; | 349 std::map<base::string16, const autofill::PasswordForm*> matches; |
349 // Initialize |matches| to satisfy the expectation from | 350 // Initialize |matches| to satisfy the expectation from |
350 // InitPasswordFormFillData() that the preferred match (3rd parameter) | 351 // InitPasswordFormFillData() that the preferred match (3rd parameter) |
351 // should be one of the |matches|. | 352 // should be one of the |matches|. |
352 auto scoped_form = base::WrapUnique(new autofill::PasswordForm(form)); | 353 matches.insert(std::make_pair(form.username_value, &form)); |
353 matches.insert( | |
354 std::make_pair(form.username_value, std::move(scoped_form))); | |
355 autofill::InitPasswordFormFillData(form, matches, &form, false, false, | 354 autofill::InitPasswordFormFillData(form, matches, &form, false, false, |
356 &formData); | 355 &formData); |
357 [self fillPasswordForm:formData | 356 [self fillPasswordForm:formData |
358 withUsername:base::SysNSStringToUTF16(username) | 357 withUsername:base::SysNSStringToUTF16(username) |
359 password:base::SysNSStringToUTF16(password) | 358 password:base::SysNSStringToUTF16(password) |
360 completionHandler:completionHandler]; | 359 completionHandler:completionHandler]; |
361 } | 360 } |
362 }]; | 361 }]; |
363 } | 362 } |
364 | 363 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 break; | 863 break; |
865 | 864 |
866 case PasswordInfoBarType::UPDATE: | 865 case PasswordInfoBarType::UPDATE: |
867 IOSChromeUpdatePasswordInfoBarDelegate::Create( | 866 IOSChromeUpdatePasswordInfoBarDelegate::Create( |
868 isSmartLockBrandingEnabled, infoBarManager, std::move(form)); | 867 isSmartLockBrandingEnabled, infoBarManager, std::move(form)); |
869 break; | 868 break; |
870 } | 869 } |
871 } | 870 } |
872 | 871 |
873 @end | 872 @end |
OLD | NEW |