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 |
48 void CredentialManagerPasswordFormManager::ProcessMatches( | 51 void CredentialManagerPasswordFormManager::ProcessMatches( |
49 const std::vector<const PasswordForm*>& non_federated, | 52 const std::vector<const PasswordForm*>& non_federated, |
50 size_t filtered_count) { | 53 size_t filtered_count) { |
51 PasswordFormManager::ProcessMatches(non_federated, filtered_count); | 54 PasswordFormManager::ProcessMatches(non_federated, filtered_count); |
52 | 55 |
53 // Mark the form as "preferred", as we've been told by the API that this is | 56 // Mark the form as "preferred", as we've been told by the API that this is |
54 // indeed the credential set that the user used to sign into the site. | 57 // indeed the credential set that the user used to sign into the site. |
55 saved_form_->preferred = true; | 58 saved_form_->preferred = true; |
56 ProvisionallySave(*saved_form_, IGNORE_OTHER_POSSIBLE_USERNAMES); | 59 ProvisionallySave(*saved_form_, IGNORE_OTHER_POSSIBLE_USERNAMES); |
57 | 60 |
58 // Notify the delegate. This might result in deleting |this|, while | 61 // Notify the delegate. This might result in deleting |this|, while |
59 // ProcessMatches is being called from FormFetcherImpl, owned by |this|. If | 62 // ProcessMatches is being called from FormFetcherImpl, owned by |this|. If |
60 // done directly, once ProcessMatches returns, the FormFetcherImpl will be | 63 // done directly, once ProcessMatches returns, the FormFetcherImpl will be |
61 // used after free. Therefore the call is posted to a separate task. | 64 // used after free. Therefore the call is posted to a separate task. |
62 base::SequencedTaskRunnerHandle::Get()->PostTask( | 65 base::SequencedTaskRunnerHandle::Get()->PostTask( |
63 FROM_HERE, | 66 FROM_HERE, |
64 base::Bind(&CredentialManagerPasswordFormManager::NotifyDelegate, | 67 base::Bind(&CredentialManagerPasswordFormManager::NotifyDelegate, |
65 weak_factory_.GetWeakPtr())); | 68 weak_factory_.GetWeakPtr())); |
66 } | 69 } |
67 | 70 |
68 CredentialManagerPasswordFormManager::~CredentialManagerPasswordFormManager() {} | |
69 | |
70 void CredentialManagerPasswordFormManager::NotifyDelegate() { | 71 void CredentialManagerPasswordFormManager::NotifyDelegate() { |
71 delegate_->OnProvisionalSaveComplete(); | 72 delegate_->OnProvisionalSaveComplete(); |
72 } | 73 } |
73 | 74 |
74 } // namespace password_manager | 75 } // namespace password_manager |
OLD | NEW |