| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { | 159 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { |
| 160 if (CanAutoClose()) | 160 if (CanAutoClose()) |
| 161 mouse_watcher_.Start(); | 161 mouse_watcher_.Start(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 content::PageNavigator* DownloadShelfView::GetNavigator() { | 164 content::PageNavigator* DownloadShelfView::GetNavigator() { |
| 165 return browser_; | 165 return browser_; |
| 166 } | 166 } |
| 167 | 167 |
| 168 gfx::Size DownloadShelfView::GetPreferredSize() { | 168 gfx::Size DownloadShelfView::GetPreferredSize() const { |
| 169 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); | 169 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); |
| 170 AdjustSize(close_button_, &prefsize); | 170 AdjustSize(close_button_, &prefsize); |
| 171 AdjustSize(show_all_view_, &prefsize); | 171 AdjustSize(show_all_view_, &prefsize); |
| 172 // Add one download view to the preferred size. | 172 // Add one download view to the preferred size. |
| 173 if (!download_views_.empty()) { | 173 if (!download_views_.empty()) { |
| 174 AdjustSize(*download_views_.begin(), &prefsize); | 174 AdjustSize(*download_views_.begin(), &prefsize); |
| 175 prefsize.Enlarge(kDownloadPadding, 0); | 175 prefsize.Enlarge(kDownloadPadding, 0); |
| 176 } | 176 } |
| 177 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); | 177 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); |
| 178 if (shelf_animation_->is_animating()) { | 178 if (shelf_animation_->is_animating()) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool DownloadShelfView::CanAutoClose() { | 417 bool DownloadShelfView::CanAutoClose() { |
| 418 for (size_t i = 0; i < download_views_.size(); ++i) { | 418 for (size_t i = 0; i < download_views_.size(); ++i) { |
| 419 if (!download_views_[i]->download()->GetOpened()) | 419 if (!download_views_[i]->download()->GetOpened()) |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 return true; | 422 return true; |
| 423 } | 423 } |
| OLD | NEW |