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

Side by Side Diff: chrome/browser/gtk/infobar_gtk.cc

Issue 160495: retry r2226, with a fix for a case where we could double free. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/infobar_gtk.h" 5 #include "chrome/browser/gtk/infobar_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/gfx/gtk_util.h" 9 #include "base/gfx/gtk_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 LinkInfoBar(LinkInfoBarDelegate* delegate) 177 LinkInfoBar(LinkInfoBarDelegate* delegate)
178 : InfoBar(delegate) { 178 : InfoBar(delegate) {
179 size_t link_offset; 179 size_t link_offset;
180 std::wstring display_text = 180 std::wstring display_text =
181 delegate->GetMessageTextWithOffset(&link_offset); 181 delegate->GetMessageTextWithOffset(&link_offset);
182 std::wstring link_text = delegate->GetLinkText(); 182 std::wstring link_text = delegate->GetLinkText();
183 183
184 // Create the link button. 184 // Create the link button.
185 GtkWidget* link_button = 185 GtkWidget* link_button =
186 gtk_chrome_link_button_new(WideToUTF8(link_text).c_str()); 186 gtk_chrome_link_button_new(WideToUTF8(link_text).c_str());
187 gtk_chrome_link_button_set_use_gtk_theme(
188 GTK_CHROME_LINK_BUTTON(link_button), FALSE);
187 g_signal_connect(link_button, "clicked", 189 g_signal_connect(link_button, "clicked",
188 G_CALLBACK(OnLinkClick), this); 190 G_CALLBACK(OnLinkClick), this);
189 191
190 // If link_offset is npos, we right-align the link instead of embedding it 192 // If link_offset is npos, we right-align the link instead of embedding it
191 // in the text. 193 // in the text.
192 if (link_offset == std::wstring::npos) { 194 if (link_offset == std::wstring::npos) {
193 gtk_box_pack_end(GTK_BOX(hbox_), link_button, FALSE, FALSE, 0); 195 gtk_box_pack_end(GTK_BOX(hbox_), link_button, FALSE, FALSE, 0);
194 GtkWidget* label = gtk_label_new(WideToUTF8(display_text).c_str()); 196 GtkWidget* label = gtk_label_new(WideToUTF8(display_text).c_str());
195 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gfx::kGdkBlack); 197 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gfx::kGdkBlack);
196 gtk_box_pack_start(GTK_BOX(hbox_), label, FALSE, FALSE, 0); 198 gtk_box_pack_start(GTK_BOX(hbox_), label, FALSE, FALSE, 0);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 283
282 InfoBar* LinkInfoBarDelegate::CreateInfoBar() { 284 InfoBar* LinkInfoBarDelegate::CreateInfoBar() {
283 return new LinkInfoBar(this); 285 return new LinkInfoBar(this);
284 } 286 }
285 287
286 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: -------------------------- 288 // ConfirmInfoBarDelegate, InfoBarDelegate overrides: --------------------------
287 289
288 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { 290 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() {
289 return new ConfirmInfoBar(this); 291 return new ConfirmInfoBar(this);
290 } 292 }
OLDNEW
« chrome/browser/gtk/gtk_chrome_link_button.cc ('K') | « chrome/browser/gtk/gtk_chrome_link_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698