Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 12556002: Always Close the Autofill UI through the same path (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disable Test On Linux Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
index 45a0c5e8b1b323d18e0e8fab35e4e87162fc844b..d18bc3352bf15960a876d2c1d3224fb6a1fc6b3b 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
@@ -34,13 +34,17 @@ AutofillPopupViewViews::AutofillPopupViewViews(
observing_widget_(NULL) {}
AutofillPopupViewViews::~AutofillPopupViewViews() {
+}
+
+void AutofillPopupViewViews::Hide() {
+ AutofillPopupView::Hide();
+
if (observing_widget_)
observing_widget_->RemoveObserver(this);
- controller_->ViewDestroyed();
-}
+ // The controller is no longer valid after it hides us.
+ controller_ = NULL;
-void AutofillPopupViewViews::Hide() {
if (GetWidget()) {
// This deletes |this|.
GetWidget()->Close();
@@ -50,6 +54,13 @@ void AutofillPopupViewViews::Hide() {
}
void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
+ // This can happen if we have a paint message in the queue when the popup
+ // is told to hide (so the controller is invalid at this point). Its ok to
+ // avoid drawing popup, sine we don't have access to the data anymore, and it
+ // should be hidden soon.
+ if (!controller_)
+ return;
+
canvas->DrawColor(kPopupBackground);
OnPaintBorder(canvas);
@@ -106,7 +117,7 @@ void AutofillPopupViewViews::OnMouseReleased(const ui::MouseEvent& event) {
void AutofillPopupViewViews::OnWidgetBoundsChanged(
views::Widget* widget,
const gfx::Rect& new_bounds) {
- Hide();
+ controller_->Hide();
}
void AutofillPopupViewViews::Show() {
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698