Chromium Code Reviews| Index: chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc |
| diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc |
| index b5457d816603cb990dcaa55908a33048695feaf7..79b1517e309d33eccbc62135e1546b1eaa5d10c7 100644 |
| --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc |
| +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc |
| @@ -20,6 +20,7 @@ |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/browser/ui/chrome_pages.h" |
| #include "chrome/common/url_constants.h" |
| +#include "content/public/browser/web_contents_view.h" |
| #include "content/public/common/password_form.h" |
| #include "ui/gfx/rect.h" |
| @@ -35,6 +36,11 @@ TabAutofillManagerDelegate::TabAutofillManagerDelegate( |
| DCHECK(web_contents); |
| } |
| +TabAutofillManagerDelegate::~TabAutofillManagerDelegate() { |
| + if (autofill_popup_controller_) |
| + autofill_popup_controller_->Hide(); |
|
Ilya Sherman
2013/02/26 02:12:15
Optional nit: Might be slightly cleaner to call Hi
kaiwang
2013/02/26 05:24:12
Done.
|
| +} |
| + |
| InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { |
| return InfoBarService::FromWebContents(web_contents_); |
| } |
| @@ -118,6 +124,34 @@ void TabAutofillManagerDelegate::RequestAutocompleteDialogClosed() { |
| autofill_dialog_controller_ = NULL; |
| } |
| +void TabAutofillManagerDelegate::ShowAutofillPopup( |
| + const gfx::RectF& element_bounds, |
| + const std::vector<string16>& values, |
| + const std::vector<string16>& labels, |
| + const std::vector<string16>& icons, |
| + const std::vector<int>& identifiers, |
| + AutofillPopupDelegate* delegate) { |
| + // Convert element_bounds to be in screen space. |
| + gfx::Rect client_area; |
| + web_contents_->GetContainerBounds(&client_area); |
| + gfx::RectF element_bounds_in_screen_space = |
| + element_bounds + client_area.OffsetFromOrigin(); |
| + |
| + // Will delete or reuse the old |autofill_popup_controller_|. |
| + autofill_popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( |
| + autofill_popup_controller_, |
| + delegate, |
| + web_contents()->GetView()->GetContentNativeView(), |
| + element_bounds_in_screen_space); |
| + |
| + autofill_popup_controller_->Show(values, labels, icons, identifiers); |
| +} |
| + |
| +void TabAutofillManagerDelegate::HideAutofillPopup() { |
| + if (autofill_popup_controller_) |
| + autofill_popup_controller_->Hide(); |
| +} |
| + |
| void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
| // TODO(ahutter): Notify |autofill_dialog_controller_| of the change once it |
| // stays open for Autocheckout. |