| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( | 496 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( |
| 497 const gfx::RectF& bounds) { | 497 const gfx::RectF& bounds) { |
| 498 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 498 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 499 return bounds + client_area.OffsetFromOrigin(); | 499 return bounds + client_area.OffsetFromOrigin(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 502 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| 503 content::RenderFrameHost* render_frame_host, | 503 content::RenderFrameHost* render_frame_host, |
| 504 const gfx::RectF& bounds, | 504 const gfx::RectF& bounds, |
| 505 int max_length, | 505 int max_length, |
| 506 const base::string16& generation_element, |
| 507 bool is_manually_triggered, |
| 506 const autofill::PasswordForm& form) { | 508 const autofill::PasswordForm& form) { |
| 507 // TODO(gcasto): Validate data in PasswordForm. | 509 // TODO(gcasto): Validate data in PasswordForm. |
| 508 | 510 |
| 511 auto* driver = driver_factory_->GetDriverForFrame(render_frame_host); |
| 512 password_manager_.SetGenerationElementAndReasonForForm( |
| 513 driver, form, generation_element, is_manually_triggered); |
| 509 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 514 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 510 | 515 |
| 511 popup_controller_ = | 516 popup_controller_ = |
| 512 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 517 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 513 popup_controller_, element_bounds_in_screen_space, form, max_length, | 518 popup_controller_, element_bounds_in_screen_space, form, max_length, |
| 514 &password_manager_, | 519 &password_manager_, driver, observer_, web_contents(), |
| 515 driver_factory_->GetDriverForFrame(render_frame_host), observer_, | 520 web_contents()->GetNativeView()); |
| 516 web_contents(), web_contents()->GetNativeView()); | |
| 517 popup_controller_->Show(true /* display_password */); | 521 popup_controller_->Show(true /* display_password */); |
| 518 } | 522 } |
| 519 | 523 |
| 520 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 524 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| 521 content::RenderFrameHost* render_frame_host, | 525 content::RenderFrameHost* render_frame_host, |
| 522 const gfx::RectF& bounds, | 526 const gfx::RectF& bounds, |
| 523 const autofill::PasswordForm& form) { | 527 const autofill::PasswordForm& form) { |
| 524 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 528 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 525 popup_controller_ = | 529 popup_controller_ = |
| 526 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 530 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 619 |
| 616 const password_manager::CredentialsFilter* | 620 const password_manager::CredentialsFilter* |
| 617 ChromePasswordManagerClient::GetStoreResultFilter() const { | 621 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 618 return &credentials_filter_; | 622 return &credentials_filter_; |
| 619 } | 623 } |
| 620 | 624 |
| 621 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 625 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 622 const { | 626 const { |
| 623 return log_manager_.get(); | 627 return log_manager_.get(); |
| 624 } | 628 } |
| OLD | NEW |