| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download/download_shelf_gtk.h" | 5 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); | 113 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); |
| 114 gtk_box_pack_start(GTK_BOX(vbox), top_border_, FALSE, FALSE, 0); | 114 gtk_box_pack_start(GTK_BOX(vbox), top_border_, FALSE, FALSE, 0); |
| 115 gtk_box_pack_start(GTK_BOX(vbox), padding_bg_, FALSE, FALSE, 0); | 115 gtk_box_pack_start(GTK_BOX(vbox), padding_bg_, FALSE, FALSE, 0); |
| 116 | 116 |
| 117 // Put the shelf in an event box so it gets its own window, which makes it | 117 // Put the shelf in an event box so it gets its own window, which makes it |
| 118 // easier to get z-ordering right. | 118 // easier to get z-ordering right. |
| 119 shelf_.Own(gtk_event_box_new()); | 119 shelf_.Own(gtk_event_box_new()); |
| 120 gtk_container_add(GTK_CONTAINER(shelf_.get()), vbox); | 120 gtk_container_add(GTK_CONTAINER(shelf_.get()), vbox); |
| 121 | 121 |
| 122 // Create and pack the close button. | 122 // Create and pack the close button. |
| 123 close_button_.reset(CustomDrawButton::CloseButton(theme_service_)); | 123 close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_)); |
| 124 gtk_util::CenterWidgetInHBox(outer_hbox, close_button_->widget(), true, 0); | 124 gtk_util::CenterWidgetInHBox(outer_hbox, close_button_->widget(), true, 0); |
| 125 g_signal_connect(close_button_->widget(), "clicked", | 125 g_signal_connect(close_button_->widget(), "clicked", |
| 126 G_CALLBACK(OnButtonClickThunk), this); | 126 G_CALLBACK(OnButtonClickThunk), this); |
| 127 | 127 |
| 128 // Create the "Show all downloads..." link and connect to the click event. | 128 // Create the "Show all downloads..." link and connect to the click event. |
| 129 link_button_ = theme_service_->BuildChromeLinkButton( | 129 link_button_ = theme_service_->BuildChromeLinkButton( |
| 130 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS)); | 130 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS)); |
| 131 g_signal_connect(link_button_, "clicked", | 131 g_signal_connect(link_button_, "clicked", |
| 132 G_CALLBACK(OnButtonClickThunk), this); | 132 G_CALLBACK(OnButtonClickThunk), this); |
| 133 gtk_util::SetButtonTriggersNavigation(link_button_); | 133 gtk_util::SetButtonTriggersNavigation(link_button_); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 ThemeProperties::COLOR_BOOKMARK_TEXT); | 261 ThemeProperties::COLOR_BOOKMARK_TEXT); |
| 262 GdkColor bookmark_color = theme_service_->GetGdkColor( | 262 GdkColor bookmark_color = theme_service_->GetGdkColor( |
| 263 ThemeProperties::COLOR_BOOKMARK_TEXT); | 263 ThemeProperties::COLOR_BOOKMARK_TEXT); |
| 264 gtk_chrome_link_button_set_normal_color( | 264 gtk_chrome_link_button_set_normal_color( |
| 265 GTK_CHROME_LINK_BUTTON(link_button_), | 265 GTK_CHROME_LINK_BUTTON(link_button_), |
| 266 use_default_color ? NULL : &bookmark_color); | 266 use_default_color ? NULL : &bookmark_color); |
| 267 | 267 |
| 268 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 268 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 269 close_button_->SetBackground( | 269 close_button_->SetBackground( |
| 270 theme_service_->GetColor(ThemeProperties::COLOR_TAB_TEXT), | 270 theme_service_->GetColor(ThemeProperties::COLOR_TAB_TEXT), |
| 271 rb.GetImageNamed(IDR_CLOSE_BAR).AsBitmap(), | 271 rb.GetImageNamed(IDR_CLOSE_1).AsBitmap(), |
| 272 rb.GetImageNamed(IDR_CLOSE_BAR_MASK).AsBitmap()); | 272 rb.GetImageNamed(IDR_CLOSE_1_MASK).AsBitmap()); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 int DownloadShelfGtk::GetHeight() const { | 276 int DownloadShelfGtk::GetHeight() const { |
| 277 GtkAllocation allocation; | 277 GtkAllocation allocation; |
| 278 gtk_widget_get_allocation(slide_widget_->widget(), &allocation); | 278 gtk_widget_get_allocation(slide_widget_->widget(), &allocation); |
| 279 return allocation.height; | 279 return allocation.height; |
| 280 } | 280 } |
| 281 | 281 |
| 282 void DownloadShelfGtk::RemoveDownloadItem(DownloadItemGtk* download_item) { | 282 void DownloadShelfGtk::RemoveDownloadItem(DownloadItemGtk* download_item) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 MessageLoop::current()->PostDelayedTask( | 397 MessageLoop::current()->PostDelayedTask( |
| 398 FROM_HERE, | 398 FROM_HERE, |
| 399 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), | 399 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), |
| 400 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs)); | 400 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs)); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void DownloadShelfGtk::MouseEnteredShelf() { | 403 void DownloadShelfGtk::MouseEnteredShelf() { |
| 404 weak_factory_.InvalidateWeakPtrs(); | 404 weak_factory_.InvalidateWeakPtrs(); |
| 405 } | 405 } |
| OLD | NEW |