OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // the order users would expect. | 120 // the order users would expect. |
121 AddChildViewAt(view, 0); | 121 AddChildViewAt(view, 0); |
122 if (download_views_.size() > kMaxDownloadViews) | 122 if (download_views_.size() > kMaxDownloadViews) |
123 RemoveDownloadView(*download_views_.begin()); | 123 RemoveDownloadView(*download_views_.begin()); |
124 | 124 |
125 new_item_animation_->Reset(); | 125 new_item_animation_->Reset(); |
126 new_item_animation_->Show(); | 126 new_item_animation_->Show(); |
127 } | 127 } |
128 | 128 |
129 void DownloadShelfView::DoAddDownload(DownloadItem* download) { | 129 void DownloadShelfView::DoAddDownload(DownloadItem* download) { |
130 DownloadItemView* view = new DownloadItemView(download, this); | 130 AddDownloadView(new DownloadItemView(download, this)); |
Dan Beam
2015/03/02 18:50:09
same story: -1 line
| |
131 AddDownloadView(view); | |
132 } | 131 } |
133 | 132 |
134 void DownloadShelfView::MouseMovedOutOfHost() { | 133 void DownloadShelfView::MouseMovedOutOfHost() { |
135 Close(AUTOMATIC); | 134 Close(AUTOMATIC); |
136 } | 135 } |
137 | 136 |
138 void DownloadShelfView::RemoveDownloadView(View* view) { | 137 void DownloadShelfView::RemoveDownloadView(View* view) { |
139 DCHECK(view); | 138 DCHECK(view); |
140 std::vector<DownloadItemView*>::iterator i = | 139 std::vector<DownloadItemView*>::iterator i = |
141 find(download_views_.begin(), download_views_.end(), view); | 140 find(download_views_.begin(), download_views_.end(), view); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 SetVisible(false); | 419 SetVisible(false); |
421 } | 420 } |
422 | 421 |
423 bool DownloadShelfView::CanAutoClose() { | 422 bool DownloadShelfView::CanAutoClose() { |
424 for (size_t i = 0; i < download_views_.size(); ++i) { | 423 for (size_t i = 0; i < download_views_.size(); ++i) { |
425 if (!download_views_[i]->download()->GetOpened()) | 424 if (!download_views_[i]->download()->GetOpened()) |
426 return false; | 425 return false; |
427 } | 426 } |
428 return true; | 427 return true; |
429 } | 428 } |
OLD | NEW |