| OLD | NEW |
| 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/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 "chrome/browser/download/download_item.h" | 9 #include "chrome/browser/download/download_item.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Pack the link and the icon in outer hbox. | 135 // Pack the link and the icon in outer hbox. |
| 136 gtk_util::CenterWidgetInHBox(outer_hbox, link_button_, true, 0); | 136 gtk_util::CenterWidgetInHBox(outer_hbox, link_button_, true, 0); |
| 137 gtk_util::CenterWidgetInHBox(outer_hbox, download_image, true, 0); | 137 gtk_util::CenterWidgetInHBox(outer_hbox, download_image, true, 0); |
| 138 | 138 |
| 139 slide_widget_.reset(new SlideAnimatorGtk(shelf_.get(), | 139 slide_widget_.reset(new SlideAnimatorGtk(shelf_.get(), |
| 140 SlideAnimatorGtk::UP, | 140 SlideAnimatorGtk::UP, |
| 141 kShelfAnimationDurationMs, | 141 kShelfAnimationDurationMs, |
| 142 false, true, this)); | 142 false, true, this)); |
| 143 | 143 |
| 144 theme_service_->InitThemesFor(this); | 144 theme_service_->InitThemesFor(this); |
| 145 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 145 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 146 Source<ThemeService>(theme_service_)); | 146 Source<ThemeService>(theme_service_)); |
| 147 | 147 |
| 148 gtk_widget_show_all(shelf_.get()); | 148 gtk_widget_show_all(shelf_.get()); |
| 149 | 149 |
| 150 // Stick ourselves at the bottom of the parent browser. | 150 // Stick ourselves at the bottom of the parent browser. |
| 151 gtk_box_pack_end(GTK_BOX(parent), slide_widget_->widget(), | 151 gtk_box_pack_end(GTK_BOX(parent), slide_widget_->widget(), |
| 152 FALSE, FALSE, 0); | 152 FALSE, FALSE, 0); |
| 153 // Make sure we are at the very end. | 153 // Make sure we are at the very end. |
| 154 gtk_box_reorder_child(GTK_BOX(parent), slide_widget_->widget(), 0); | 154 gtk_box_reorder_child(GTK_BOX(parent), slide_widget_->widget(), 0); |
| 155 Show(); | 155 Show(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 RemoveDownloadItem(download_items_[i]); | 213 RemoveDownloadItem(download_items_[i]); |
| 214 } else { | 214 } else { |
| 215 // We set all remaining items as "opened", so that the shelf will auto- | 215 // We set all remaining items as "opened", so that the shelf will auto- |
| 216 // close in the future without the user clicking on them. | 216 // close in the future without the user clicking on them. |
| 217 download->set_opened(true); | 217 download->set_opened(true); |
| 218 ++i; | 218 ++i; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void DownloadShelfGtk::Observe(NotificationType type, | 223 void DownloadShelfGtk::Observe(int type, |
| 224 const NotificationSource& source, | 224 const NotificationSource& source, |
| 225 const NotificationDetails& details) { | 225 const NotificationDetails& details) { |
| 226 if (type == NotificationType::BROWSER_THEME_CHANGED) { | 226 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { |
| 227 GdkColor color = theme_service_->GetGdkColor( | 227 GdkColor color = theme_service_->GetGdkColor( |
| 228 ThemeService::COLOR_TOOLBAR); | 228 ThemeService::COLOR_TOOLBAR); |
| 229 gtk_widget_modify_bg(padding_bg_, GTK_STATE_NORMAL, &color); | 229 gtk_widget_modify_bg(padding_bg_, GTK_STATE_NORMAL, &color); |
| 230 | 230 |
| 231 color = theme_service_->GetBorderColor(); | 231 color = theme_service_->GetBorderColor(); |
| 232 gtk_widget_modify_bg(top_border_, GTK_STATE_NORMAL, &color); | 232 gtk_widget_modify_bg(top_border_, GTK_STATE_NORMAL, &color); |
| 233 | 233 |
| 234 // When using a non-standard, non-gtk theme, we make the link color match | 234 // When using a non-standard, non-gtk theme, we make the link color match |
| 235 // the bookmark text color. Otherwise, standard link blue can look very | 235 // the bookmark text color. Otherwise, standard link blue can look very |
| 236 // bad for some dark themes. | 236 // bad for some dark themes. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 MessageLoop::current()->PostDelayedTask( | 369 MessageLoop::current()->PostDelayedTask( |
| 370 FROM_HERE, | 370 FROM_HERE, |
| 371 auto_close_factory_.NewRunnableMethod(&DownloadShelfGtk::Close), | 371 auto_close_factory_.NewRunnableMethod(&DownloadShelfGtk::Close), |
| 372 kAutoCloseDelayMs); | 372 kAutoCloseDelayMs); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void DownloadShelfGtk::MouseEnteredShelf() { | 375 void DownloadShelfGtk::MouseEnteredShelf() { |
| 376 auto_close_factory_.RevokeAll(); | 376 auto_close_factory_.RevokeAll(); |
| 377 } | 377 } |
| OLD | NEW |