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

Side by Side Diff: chrome/browser/ui/views/download/download_shelf_view.cc

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 1 month 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) 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/download_shelf_view.h" 5 #include "chrome/browser/ui/views/download/download_shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 void DownloadShelfView::Closed() { 414 void DownloadShelfView::Closed() {
415 // When the close animation is complete, remove all completed downloads. 415 // When the close animation is complete, remove all completed downloads.
416 size_t i = 0; 416 size_t i = 0;
417 while (i < download_views_.size()) { 417 while (i < download_views_.size()) {
418 DownloadItem* download = download_views_[i]->download(); 418 DownloadItem* download = download_views_[i]->download();
419 bool is_transfer_done = download->IsComplete() || 419 bool is_transfer_done = download->IsComplete() ||
420 download->IsCancelled() || 420 download->IsCancelled() ||
421 download->IsInterrupted(); 421 download->IsInterrupted();
422 if (is_transfer_done && 422 if (is_transfer_done &&
423 download->safety_state() != DownloadItem::DANGEROUS) { 423 download->GetSafetyState() != DownloadItem::DANGEROUS) {
424 RemoveDownloadView(download_views_[i]); 424 RemoveDownloadView(download_views_[i]);
425 } else { 425 } else {
426 // Treat the item as opened when we close. This way if we get shown again 426 // Treat the item as opened when we close. This way if we get shown again
427 // the user need not open this item for the shelf to auto-close. 427 // the user need not open this item for the shelf to auto-close.
428 download->set_opened(true); 428 download->SetOpened(true);
429 ++i; 429 ++i;
430 } 430 }
431 } 431 }
432 } 432 }
433 433
434 bool DownloadShelfView::CanAutoClose() { 434 bool DownloadShelfView::CanAutoClose() {
435 for (size_t i = 0; i < download_views_.size(); ++i) { 435 for (size_t i = 0; i < download_views_.size(); ++i) {
436 if (!download_views_[i]->download()->opened()) 436 if (!download_views_[i]->download()->GetOpened())
437 return false; 437 return false;
438 } 438 }
439 return true; 439 return true;
440 } 440 }
441 441
442 void DownloadShelfView::SchedulePaintForDownloadItem(views::View* view) { 442 void DownloadShelfView::SchedulePaintForDownloadItem(views::View* view) {
443 // Make sure it's not NULL. (Focus sometimes changes to or from NULL.) 443 // Make sure it's not NULL. (Focus sometimes changes to or from NULL.)
444 if (!view) 444 if (!view)
445 return; 445 return;
446 446
(...skipping 16 matching lines...) Expand all
463 const DownloadItemView* download_item_view) { 463 const DownloadItemView* download_item_view) {
464 gfx::Rect bounds = download_item_view->bounds(); 464 gfx::Rect bounds = download_item_view->bounds();
465 465
466 #if defined(TOOLKIT_VIEWS) 466 #if defined(TOOLKIT_VIEWS)
467 bounds.set_height(bounds.height() - 1); 467 bounds.set_height(bounds.height() - 1);
468 bounds.Offset(0, 3); 468 bounds.Offset(0, 3);
469 #endif 469 #endif
470 470
471 return bounds; 471 return bounds;
472 } 472 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.cc ('k') | chrome/browser/ui/webui/active_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698