| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 264 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
| 265 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 265 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
| 266 const GURL& origin, | 266 const GURL& origin, |
| 267 const CredentialsCallback& callback) { | 267 const CredentialsCallback& callback) { |
| 268 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one | 268 // Set up an intercept callback if the prompt is zero-clickable (e.g. just one |
| 269 // form provided). | 269 // form provided). |
| 270 CredentialsCallback intercept = | 270 CredentialsCallback intercept = |
| 271 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, | 271 base::Bind(&ChromePasswordManagerClient::OnCredentialsChosen, |
| 272 base::Unretained(this), callback, local_forms.size() == 1); | 272 base::Unretained(this), callback, local_forms.size() == 1); |
| 273 std::vector<std::unique_ptr<autofill::PasswordForm>> dummy_federations; | |
| 274 #if defined(OS_ANDROID) | 273 #if defined(OS_ANDROID) |
| 275 // Deletes itself on the event from Java counterpart, when user interacts with | 274 // Deletes itself on the event from Java counterpart, when user interacts with |
| 276 // dialog. | 275 // dialog. |
| 277 AccountChooserDialogAndroid* acccount_chooser_dialog = | 276 AccountChooserDialogAndroid* acccount_chooser_dialog = |
| 278 new AccountChooserDialogAndroid(web_contents(), std::move(local_forms), | 277 new AccountChooserDialogAndroid(web_contents(), std::move(local_forms), |
| 279 std::move(dummy_federations), origin, | 278 origin, intercept); |
| 280 intercept); | |
| 281 acccount_chooser_dialog->ShowDialog(); | 279 acccount_chooser_dialog->ShowDialog(); |
| 282 return true; | 280 return true; |
| 283 #else | 281 #else |
| 284 return PasswordsClientUIDelegateFromWebContents(web_contents()) | 282 return PasswordsClientUIDelegateFromWebContents(web_contents()) |
| 285 ->OnChooseCredentials(std::move(local_forms), | 283 ->OnChooseCredentials(std::move(local_forms), origin, intercept); |
| 286 std::move(dummy_federations), | |
| 287 origin, intercept); | |
| 288 #endif | 284 #endif |
| 289 } | 285 } |
| 290 | 286 |
| 291 void ChromePasswordManagerClient::OnCredentialsChosen( | 287 void ChromePasswordManagerClient::OnCredentialsChosen( |
| 292 const CredentialsCallback& callback, | 288 const CredentialsCallback& callback, |
| 293 bool one_local_credential, | 289 bool one_local_credential, |
| 294 const autofill::PasswordForm* form) { | 290 const autofill::PasswordForm* form) { |
| 295 callback.Run(form); | 291 callback.Run(form); |
| 296 // If a site gets back a credential some navigations are likely to occur. They | 292 // If a site gets back a credential some navigations are likely to occur. They |
| 297 // shouldn't trigger the autofill password manager. | 293 // shouldn't trigger the autofill password manager. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 ChromePasswordManagerClient::FromWebContents(web_contents); | 613 ChromePasswordManagerClient::FromWebContents(web_contents); |
| 618 | 614 |
| 619 // Try to bind to the driver, but if driver is not available for this render | 615 // Try to bind to the driver, but if driver is not available for this render |
| 620 // frame host, the request will be just dropped. This will cause the message | 616 // frame host, the request will be just dropped. This will cause the message |
| 621 // pipe to be closed, which will raise a connection error on the peer side. | 617 // pipe to be closed, which will raise a connection error on the peer side. |
| 622 if (!instance) | 618 if (!instance) |
| 623 return; | 619 return; |
| 624 | 620 |
| 625 instance->credential_manager_impl_.BindRequest(std::move(request)); | 621 instance->credential_manager_impl_.BindRequest(std::move(request)); |
| 626 } | 622 } |
| OLD | NEW |