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

Side by Side Diff: chrome/browser/gtk/download_shelf_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/download_shelf_gtk.h" 5 #include "chrome/browser/gtk/download_shelf_gtk.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/gfx/gtk_util.h" 9 #include "base/gfx/gtk_util.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Create and pack the close button. 90 // Create and pack the close button.
91 close_button_.reset(CustomDrawButton::CloseButton(theme_provider_)); 91 close_button_.reset(CustomDrawButton::CloseButton(theme_provider_));
92 gtk_util::CenterWidgetInHBox(hbox_.get(), close_button_->widget(), true, 0); 92 gtk_util::CenterWidgetInHBox(hbox_.get(), close_button_->widget(), true, 0);
93 g_signal_connect(close_button_->widget(), "clicked", 93 g_signal_connect(close_button_->widget(), "clicked",
94 G_CALLBACK(OnButtonClick), this); 94 G_CALLBACK(OnButtonClick), this);
95 95
96 // Create the "Show all downloads..." link and connect to the click event. 96 // Create the "Show all downloads..." link and connect to the click event.
97 std::string link_text = 97 std::string link_text =
98 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS); 98 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS);
99 GtkWidget* link_button = gtk_chrome_link_button_new(link_text.c_str()); 99 GtkWidget* link_button = gtk_chrome_link_button_new(link_text.c_str());
100 gtk_chrome_link_button_set_use_gtk_theme(
101 GTK_CHROME_LINK_BUTTON(link_button), FALSE);
100 g_signal_connect(link_button, "clicked", 102 g_signal_connect(link_button, "clicked",
101 G_CALLBACK(OnButtonClick), this); 103 G_CALLBACK(OnButtonClick), this);
102 // Until we switch to vector graphics, force the font size. 104 // Until we switch to vector graphics, force the font size.
103 // 13.4px == 10pt @ 96dpi 105 // 13.4px == 10pt @ 96dpi
104 gtk_util::ForceFontSizePixels(GTK_CHROME_LINK_BUTTON(link_button)->label, 106 gtk_util::ForceFontSizePixels(GTK_CHROME_LINK_BUTTON(link_button)->label,
105 13.4); 107 13.4);
106 108
107 // Make the download arrow icon. 109 // Make the download arrow icon.
108 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 110 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
109 GdkPixbuf* download_pixbuf = rb.GetPixbufNamed(IDR_DOWNLOADS_FAVICON); 111 GdkPixbuf* download_pixbuf = rb.GetPixbufNamed(IDR_DOWNLOADS_FAVICON);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // static 211 // static
210 void DownloadShelfGtk::OnButtonClick(GtkWidget* button, 212 void DownloadShelfGtk::OnButtonClick(GtkWidget* button,
211 DownloadShelfGtk* shelf) { 213 DownloadShelfGtk* shelf) {
212 if (button == shelf->close_button_->widget()) { 214 if (button == shelf->close_button_->widget()) {
213 shelf->Close(); 215 shelf->Close();
214 } else { 216 } else {
215 // The link button was clicked. 217 // The link button was clicked.
216 shelf->browser_->ShowDownloadsTab(); 218 shelf->browser_->ShowDownloadsTab();
217 } 219 }
218 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698