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

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

Issue 8866005: GTK: Speculative fix for crash in PluginInfoBarDelegate::Cancel. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) { 68 void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) {
69 if (delegate()->AsConfirmInfoBarDelegate()->GetButtons() & type) { 69 if (delegate()->AsConfirmInfoBarDelegate()->GetButtons() & type) {
70 if (!size_group_) 70 if (!size_group_)
71 size_group_ = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 71 size_group_ = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
72 72
73 GtkWidget* button = gtk_button_new_with_label(UTF16ToUTF8( 73 GtkWidget* button = gtk_button_new_with_label(UTF16ToUTF8(
74 delegate()->AsConfirmInfoBarDelegate()->GetButtonLabel(type)).c_str()); 74 delegate()->AsConfirmInfoBarDelegate()->GetButtonLabel(type)).c_str());
75 gtk_size_group_add_widget(size_group_, button); 75 gtk_size_group_add_widget(size_group_, button);
76 76
77 gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0); 77 gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0);
78 g_signal_connect(button, "clicked", 78 Signals()->Connect(button, "clicked",
79 G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ? 79 G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ?
80 OnOkButtonThunk : OnCancelButtonThunk), 80 OnOkButtonThunk : OnCancelButtonThunk),
81 this); 81 this);
82 } 82 }
83 } 83 }
84 84
85 void ConfirmInfoBarGtk::OnOkButton(GtkWidget* widget) { 85 void ConfirmInfoBarGtk::OnOkButton(GtkWidget* widget) {
86 if (delegate()->AsConfirmInfoBarDelegate()->Accept()) 86 if (delegate()->AsConfirmInfoBarDelegate()->Accept())
87 RemoveSelf(); 87 RemoveSelf();
88 } 88 }
89 89
90 void ConfirmInfoBarGtk::OnCancelButton(GtkWidget* widget) { 90 void ConfirmInfoBarGtk::OnCancelButton(GtkWidget* widget) {
91 if (delegate()->AsConfirmInfoBarDelegate()->Cancel()) 91 if (delegate()->AsConfirmInfoBarDelegate()->Cancel())
92 RemoveSelf(); 92 RemoveSelf();
93 } 93 }
94 94
95 void ConfirmInfoBarGtk::OnLinkClicked(GtkWidget* widget) { 95 void ConfirmInfoBarGtk::OnLinkClicked(GtkWidget* widget) {
96 if (delegate()->AsConfirmInfoBarDelegate()->LinkClicked( 96 if (delegate()->AsConfirmInfoBarDelegate()->LinkClicked(
97 gtk_util::DispositionForCurrentButtonPressEvent())) 97 gtk_util::DispositionForCurrentButtonPressEvent()))
98 RemoveSelf(); 98 RemoveSelf();
99 } 99 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698