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

Side by Side Diff: chrome/browser/views/download_tab_view.cc

Issue 14806: Fixes crash in download tab view that resulted from attempting to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/download_tab_view.h" 5 #include "chrome/browser/views/download_tab_view.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 void DownloadTabView::Paint(ChromeCanvas* canvas) { 870 void DownloadTabView::Paint(ChromeCanvas* canvas) {
871 views::View::Paint(canvas); 871 views::View::Paint(canvas);
872 872
873 if (download_util::kBigIconSize == 0 || downloads_.size() == 0) 873 if (download_util::kBigIconSize == 0 || downloads_.size() == 0)
874 return; 874 return;
875 875
876 SkRect clip; 876 SkRect clip;
877 if (canvas->getClipBounds(&clip)) { 877 if (canvas->getClipBounds(&clip)) {
878 int row_start = (SkScalarRound(clip.fTop) - kSpacer) / 878 int row_start = (SkScalarRound(clip.fTop) - kSpacer) /
879 (big_icon_size_ + kSpacer); 879 (big_icon_size_ + kSpacer);
880 int row_stop = SkScalarRound(clip.fBottom) / (big_icon_size_ + kSpacer); 880 int row_stop =
881 std::min(static_cast<int>(downloads_.size()) - 1,
882 (SkScalarRound(clip.fBottom) - kSpacer) /
883 (big_icon_size_ + kSpacer));
881 SkRect download_rect; 884 SkRect download_rect;
882 for (int i = row_start; i <= row_stop; ++i) { 885 for (int i = row_start; i <= row_stop; ++i) {
883 int y = i * (big_icon_size_ + kSpacer) + kSpacer; 886 int y = i * (big_icon_size_ + kSpacer) + kSpacer;
884 if (HasFloatingViewForPoint(0, y)) 887 if (HasFloatingViewForPoint(0, y))
885 continue; 888 continue;
886 download_rect.set(SkIntToScalar(0), 889 download_rect.set(SkIntToScalar(0),
887 SkIntToScalar(y), 890 SkIntToScalar(y),
888 SkIntToScalar(width()), 891 SkIntToScalar(width()),
889 SkIntToScalar(y + big_icon_size_)); 892 SkIntToScalar(y + big_icon_size_));
890 if (SkRect::Intersects(clip, download_rect)) { 893 if (SkRect::Intersects(clip, download_rect)) {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 case NOTIFY_DOWNLOAD_STOP: 1329 case NOTIFY_DOWNLOAD_STOP:
1327 DCHECK(profile()->HasCreatedDownloadManager()); 1330 DCHECK(profile()->HasCreatedDownloadManager());
1328 contents_->SetIsLoading( 1331 contents_->SetIsLoading(
1329 profile()->GetDownloadManager()->in_progress_count() > 0, 1332 profile()->GetDownloadManager()->in_progress_count() > 0,
1330 NULL); 1333 NULL);
1331 break; 1334 break;
1332 default: 1335 default:
1333 break; 1336 break;
1334 } 1337 }
1335 } 1338 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698