| OLD | NEW |
| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 void DownloadShelfGtk::Close() { | 172 void DownloadShelfGtk::Close() { |
| 173 // When we are closing, we can vertically overlap the render view. Make sure | 173 // When we are closing, we can vertically overlap the render view. Make sure |
| 174 // we are on top. | 174 // we are on top. |
| 175 gdk_window_raise(shelf_.get()->window); | 175 gdk_window_raise(shelf_.get()->window); |
| 176 slide_widget_->Close(); | 176 slide_widget_->Close(); |
| 177 browser_->UpdateDownloadShelfVisibility(false); | 177 browser_->UpdateDownloadShelfVisibility(false); |
| 178 } | 178 } |
| 179 | 179 |
| 180 Browser* DownloadShelfGtk::browser() const { |
| 181 return browser_; |
| 182 } |
| 183 |
| 180 void DownloadShelfGtk::Closed() { | 184 void DownloadShelfGtk::Closed() { |
| 181 // When the close animation is complete, remove all completed downloads. | 185 // When the close animation is complete, remove all completed downloads. |
| 182 size_t i = 0; | 186 size_t i = 0; |
| 183 while (i < download_items_.size()) { | 187 while (i < download_items_.size()) { |
| 184 DownloadItem* download = download_items_[i]->get_download(); | 188 DownloadItem* download = download_items_[i]->get_download(); |
| 185 bool is_transfer_done = download->state() == DownloadItem::COMPLETE || | 189 bool is_transfer_done = download->state() == DownloadItem::COMPLETE || |
| 186 download->state() == DownloadItem::CANCELLED; | 190 download->state() == DownloadItem::CANCELLED; |
| 187 if (is_transfer_done && | 191 if (is_transfer_done && |
| 188 download->safety_state() != DownloadItem::DANGEROUS) { | 192 download->safety_state() != DownloadItem::DANGEROUS) { |
| 189 RemoveDownloadItem(download_items_[i]); | 193 RemoveDownloadItem(download_items_[i]); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 260 } |
| 257 | 261 |
| 258 void DownloadShelfGtk::OnButtonClick(GtkWidget* button) { | 262 void DownloadShelfGtk::OnButtonClick(GtkWidget* button) { |
| 259 if (button == close_button_->widget()) { | 263 if (button == close_button_->widget()) { |
| 260 Close(); | 264 Close(); |
| 261 } else { | 265 } else { |
| 262 // The link button was clicked. | 266 // The link button was clicked. |
| 263 browser_->ShowDownloadsTab(); | 267 browser_->ShowDownloadsTab(); |
| 264 } | 268 } |
| 265 } | 269 } |
| OLD | NEW |