Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Side by Side Diff: ios/chrome/browser/passwords/password_controller.mm

Issue 2262843002: Make PasswordFormManager::best_matches_ const (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@621355_pass_creds_to_update_by_value
Patch Set: Just rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698