OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_pending_re
quest_task.h" | 5 #include "components/password_manager/core/browser/credential_manager_pending_re
quest_task.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
8 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 10 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
9 #include "components/password_manager/core/browser/password_manager_client.h" | 11 #include "components/password_manager/core/browser/password_manager_client.h" |
10 #include "components/password_manager/core/browser/password_manager_util.h" | 12 #include "components/password_manager/core/browser/password_manager_util.h" |
11 #include "components/password_manager/core/common/credential_manager_types.h" | 13 #include "components/password_manager/core/common/credential_manager_types.h" |
12 #include "url/gurl.h" | 14 #include "url/gurl.h" |
13 | 15 |
14 namespace password_manager { | 16 namespace password_manager { |
15 | 17 |
16 CredentialManagerPendingRequestTask::CredentialManagerPendingRequestTask( | 18 CredentialManagerPendingRequestTask::CredentialManagerPendingRequestTask( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 auto it = std::find(local_results.begin(), local_results.end(), | 97 auto it = std::find(local_results.begin(), local_results.end(), |
96 zero_click_form_to_return); | 98 zero_click_form_to_return); |
97 CredentialInfo info(*zero_click_form_to_return, | 99 CredentialInfo info(*zero_click_form_to_return, |
98 zero_click_form_to_return->federation_url.is_empty() | 100 zero_click_form_to_return->federation_url.is_empty() |
99 ? CredentialType::CREDENTIAL_TYPE_PASSWORD | 101 ? CredentialType::CREDENTIAL_TYPE_PASSWORD |
100 : CredentialType::CREDENTIAL_TYPE_FEDERATED); | 102 : CredentialType::CREDENTIAL_TYPE_FEDERATED); |
101 DCHECK(it != local_results.end()); | 103 DCHECK(it != local_results.end()); |
102 std::swap(*it, local_results[0]); | 104 std::swap(*it, local_results[0]); |
103 // Clear the form pointer since its owner is being passed. | 105 // Clear the form pointer since its owner is being passed. |
104 zero_click_form_to_return = nullptr; | 106 zero_click_form_to_return = nullptr; |
105 delegate_->client()->NotifyUserAutoSignin(local_results.Pass()); | 107 delegate_->client()->NotifyUserAutoSignin(std::move(local_results)); |
106 delegate_->SendCredential(id_, info); | 108 delegate_->SendCredential(id_, info); |
107 return; | 109 return; |
108 } | 110 } |
109 | 111 |
110 if (zero_click_only_ || | 112 if (zero_click_only_ || |
111 !delegate_->client()->PromptUserToChooseCredentials( | 113 !delegate_->client()->PromptUserToChooseCredentials( |
112 local_results.Pass(), federated_results.Pass(), origin_, | 114 std::move(local_results), std::move(federated_results), origin_, |
113 base::Bind( | 115 base::Bind( |
114 &CredentialManagerPendingRequestTaskDelegate::SendCredential, | 116 &CredentialManagerPendingRequestTaskDelegate::SendCredential, |
115 base::Unretained(delegate_), id_))) { | 117 base::Unretained(delegate_), id_))) { |
116 delegate_->SendCredential(id_, CredentialInfo()); | 118 delegate_->SendCredential(id_, CredentialInfo()); |
117 } | 119 } |
118 } | 120 } |
119 | 121 |
120 } // namespace password_manager | 122 } // namespace password_manager |
OLD | NEW |