| 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( | 488 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( |
| 489 const gfx::RectF& bounds) { | 489 const gfx::RectF& bounds) { |
| 490 gfx::Rect client_area = web_contents()->GetContainerBounds(); | 490 gfx::Rect client_area = web_contents()->GetContainerBounds(); |
| 491 return bounds + client_area.OffsetFromOrigin(); | 491 return bounds + client_area.OffsetFromOrigin(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( | 494 void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
| 495 content::RenderFrameHost* render_frame_host, | 495 content::RenderFrameHost* render_frame_host, |
| 496 const gfx::RectF& bounds, | 496 const gfx::RectF& bounds, |
| 497 int max_length, | 497 int max_length, |
| 498 const base::string16& generation_element, |
| 499 bool is_manually_triggered, |
| 498 const autofill::PasswordForm& form) { | 500 const autofill::PasswordForm& form) { |
| 499 // TODO(gcasto): Validate data in PasswordForm. | 501 // TODO(gcasto): Validate data in PasswordForm. |
| 500 | 502 |
| 503 auto* driver = driver_factory_->GetDriverForFrame(render_frame_host); |
| 504 password_manager_.SetGenerationElementAndReasonForForm( |
| 505 driver, form, generation_element, is_manually_triggered); |
| 501 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 506 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 502 | 507 |
| 503 popup_controller_ = | 508 popup_controller_ = |
| 504 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 509 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| 505 popup_controller_, element_bounds_in_screen_space, form, max_length, | 510 popup_controller_, element_bounds_in_screen_space, form, max_length, |
| 506 &password_manager_, | 511 &password_manager_, driver, observer_, web_contents(), |
| 507 driver_factory_->GetDriverForFrame(render_frame_host), observer_, | 512 web_contents()->GetNativeView()); |
| 508 web_contents(), web_contents()->GetNativeView()); | |
| 509 popup_controller_->Show(true /* display_password */); | 513 popup_controller_->Show(true /* display_password */); |
| 510 } | 514 } |
| 511 | 515 |
| 512 void ChromePasswordManagerClient::ShowPasswordEditingPopup( | 516 void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
| 513 content::RenderFrameHost* render_frame_host, | 517 content::RenderFrameHost* render_frame_host, |
| 514 const gfx::RectF& bounds, | 518 const gfx::RectF& bounds, |
| 515 const autofill::PasswordForm& form) { | 519 const autofill::PasswordForm& form) { |
| 516 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); | 520 gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
| 517 popup_controller_ = | 521 popup_controller_ = |
| 518 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( | 522 autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 611 |
| 608 const password_manager::CredentialsFilter* | 612 const password_manager::CredentialsFilter* |
| 609 ChromePasswordManagerClient::GetStoreResultFilter() const { | 613 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 610 return &credentials_filter_; | 614 return &credentials_filter_; |
| 611 } | 615 } |
| 612 | 616 |
| 613 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 617 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 614 const { | 618 const { |
| 615 return log_manager_.get(); | 619 return log_manager_.get(); |
| 616 } | 620 } |
| OLD | NEW |