OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/password_manager/core/browser/credential_manager_password_f
orm_manager.h" | 5 #include "components/password_manager/core/browser/credential_manager_password_f
orm_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 delegate_(delegate), | 38 delegate_(delegate), |
39 saved_form_(std::move(saved_form)), | 39 saved_form_(std::move(saved_form)), |
40 weak_factory_(this) { | 40 weak_factory_(this) { |
41 DCHECK(saved_form_); | 41 DCHECK(saved_form_); |
42 // This condition is only false on iOS. | 42 // This condition is only false on iOS. |
43 if (form_fetcher) | 43 if (form_fetcher) |
44 form_fetcher->Fetch(); | 44 form_fetcher->Fetch(); |
45 GrabFetcher(std::move(form_fetcher)); | 45 GrabFetcher(std::move(form_fetcher)); |
46 } | 46 } |
47 | 47 |
48 CredentialManagerPasswordFormManager::~CredentialManagerPasswordFormManager() { | |
49 } | |
50 | |
51 void CredentialManagerPasswordFormManager::ProcessMatches( | 48 void CredentialManagerPasswordFormManager::ProcessMatches( |
52 const std::vector<const PasswordForm*>& non_federated, | 49 const std::vector<const PasswordForm*>& non_federated, |
53 size_t filtered_count) { | 50 size_t filtered_count) { |
54 PasswordFormManager::ProcessMatches(non_federated, filtered_count); | 51 PasswordFormManager::ProcessMatches(non_federated, filtered_count); |
55 | 52 |
56 // Mark the form as "preferred", as we've been told by the API that this is | 53 // Mark the form as "preferred", as we've been told by the API that this is |
57 // indeed the credential set that the user used to sign into the site. | 54 // indeed the credential set that the user used to sign into the site. |
58 saved_form_->preferred = true; | 55 saved_form_->preferred = true; |
59 ProvisionallySave(*saved_form_, IGNORE_OTHER_POSSIBLE_USERNAMES); | 56 ProvisionallySave(*saved_form_, IGNORE_OTHER_POSSIBLE_USERNAMES); |
60 | 57 |
61 // Notify the delegate. This might result in deleting |this|, while | 58 // Notify the delegate. This might result in deleting |this|, while |
62 // ProcessMatches is being called from FormFetcherImpl, owned by |this|. If | 59 // ProcessMatches is being called from FormFetcherImpl, owned by |this|. If |
63 // done directly, once ProcessMatches returns, the FormFetcherImpl will be | 60 // done directly, once ProcessMatches returns, the FormFetcherImpl will be |
64 // used after free. Therefore the call is posted to a separate task. | 61 // used after free. Therefore the call is posted to a separate task. |
65 base::SequencedTaskRunnerHandle::Get()->PostTask( | 62 base::SequencedTaskRunnerHandle::Get()->PostTask( |
66 FROM_HERE, | 63 FROM_HERE, |
67 base::Bind(&CredentialManagerPasswordFormManager::NotifyDelegate, | 64 base::Bind(&CredentialManagerPasswordFormManager::NotifyDelegate, |
68 weak_factory_.GetWeakPtr())); | 65 weak_factory_.GetWeakPtr())); |
69 } | 66 } |
70 | 67 |
| 68 CredentialManagerPasswordFormManager::~CredentialManagerPasswordFormManager() {} |
| 69 |
71 void CredentialManagerPasswordFormManager::NotifyDelegate() { | 70 void CredentialManagerPasswordFormManager::NotifyDelegate() { |
72 delegate_->OnProvisionalSaveComplete(); | 71 delegate_->OnProvisionalSaveComplete(); |
73 } | 72 } |
74 | 73 |
75 } // namespace password_manager | 74 } // namespace password_manager |
OLD | NEW |