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/views/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download_shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 void DownloadShelfView::Show() { | 379 void DownloadShelfView::Show() { |
380 shelf_animation_->Show(); | 380 shelf_animation_->Show(); |
381 } | 381 } |
382 | 382 |
383 void DownloadShelfView::Close() { | 383 void DownloadShelfView::Close() { |
384 parent_->SetDownloadShelfVisible(false); | 384 parent_->SetDownloadShelfVisible(false); |
385 shelf_animation_->Hide(); | 385 shelf_animation_->Hide(); |
386 } | 386 } |
387 | 387 |
| 388 Browser* DownloadShelfView::browser() const { |
| 389 return browser_; |
| 390 } |
| 391 |
388 void DownloadShelfView::Closed() { | 392 void DownloadShelfView::Closed() { |
389 // When the close animation is complete, remove all completed downloads. | 393 // When the close animation is complete, remove all completed downloads. |
390 size_t i = 0; | 394 size_t i = 0; |
391 while (i < download_views_.size()) { | 395 while (i < download_views_.size()) { |
392 DownloadItem* download = download_views_[i]->download(); | 396 DownloadItem* download = download_views_[i]->download(); |
393 bool is_transfer_done = download->state() == DownloadItem::COMPLETE || | 397 bool is_transfer_done = download->state() == DownloadItem::COMPLETE || |
394 download->state() == DownloadItem::CANCELLED; | 398 download->state() == DownloadItem::CANCELLED; |
395 if (is_transfer_done && | 399 if (is_transfer_done && |
396 download->safety_state() != DownloadItem::DANGEROUS) { | 400 download->safety_state() != DownloadItem::DANGEROUS) { |
397 RemoveDownloadView(download_views_[i]); | 401 RemoveDownloadView(download_views_[i]); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 const DownloadItemView* download_item_view) { | 440 const DownloadItemView* download_item_view) { |
437 gfx::Rect bounds = download_item_view->bounds(); | 441 gfx::Rect bounds = download_item_view->bounds(); |
438 | 442 |
439 #if defined(TOOLKIT_VIEWS) | 443 #if defined(TOOLKIT_VIEWS) |
440 bounds.set_height(bounds.height() - 1); | 444 bounds.set_height(bounds.height() - 1); |
441 bounds.Offset(0, 3); | 445 bounds.Offset(0, 3); |
442 #endif | 446 #endif |
443 | 447 |
444 return bounds; | 448 return bounds; |
445 } | 449 } |
OLD | NEW |