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

Side by Side Diff: chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc

Issue 7981045: Make infobars ignore button clicks when closing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/gtk/infobars/confirm_infobar_gtk.h" 5 #include "chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0); 76 gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0);
77 g_signal_connect(button, "clicked", 77 g_signal_connect(button, "clicked",
78 G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ? 78 G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ?
79 OnOkButtonThunk : OnCancelButtonThunk), 79 OnOkButtonThunk : OnCancelButtonThunk),
80 this); 80 this);
81 } 81 }
82 } 82 }
83 83
84 void ConfirmInfoBarGtk::OnOkButton(GtkWidget* widget) { 84 void ConfirmInfoBarGtk::OnOkButton(GtkWidget* widget) {
85 if (!owned())
86 return; // We're closing; don't call anything, it might access the owner.
85 if (delegate()->AsConfirmInfoBarDelegate()->Accept()) 87 if (delegate()->AsConfirmInfoBarDelegate()->Accept())
86 RemoveSelf(); 88 RemoveSelf();
87 } 89 }
88 90
89 void ConfirmInfoBarGtk::OnCancelButton(GtkWidget* widget) { 91 void ConfirmInfoBarGtk::OnCancelButton(GtkWidget* widget) {
92 if (!owned())
93 return; // We're closing; don't call anything, it might access the owner.
90 if (delegate()->AsConfirmInfoBarDelegate()->Cancel()) 94 if (delegate()->AsConfirmInfoBarDelegate()->Cancel())
91 RemoveSelf(); 95 RemoveSelf();
92 } 96 }
93 97
94 void ConfirmInfoBarGtk::OnLinkClicked(GtkWidget* widget) { 98 void ConfirmInfoBarGtk::OnLinkClicked(GtkWidget* widget) {
99 if (!owned())
100 return; // We're closing; don't call anything, it might access the owner.
95 if (delegate()->AsConfirmInfoBarDelegate()->LinkClicked( 101 if (delegate()->AsConfirmInfoBarDelegate()->LinkClicked(
96 gtk_util::DispositionForCurrentButtonPressEvent())) 102 gtk_util::DispositionForCurrentButtonPressEvent()))
97 RemoveSelf(); 103 RemoveSelf();
98 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698