| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { | 204 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { |
| 205 if (CanAutoClose()) | 205 if (CanAutoClose()) |
| 206 mouse_watcher_.Start(); | 206 mouse_watcher_.Start(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 gfx::Size DownloadShelfView::GetPreferredSize() { | 209 gfx::Size DownloadShelfView::GetPreferredSize() { |
| 210 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); | 210 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); |
| 211 AdjustSize(close_button_, &prefsize); | 211 AdjustSize(close_button_, &prefsize); |
| 212 AdjustSize(show_all_view_, &prefsize); | 212 AdjustSize(show_all_view_, &prefsize); |
| 213 // Add one download view to the preferred size. | 213 // Add one download view to the preferred size. |
| 214 if (download_views_.size() > 0) { | 214 if (!download_views_.empty()) { |
| 215 AdjustSize(*download_views_.begin(), &prefsize); | 215 AdjustSize(*download_views_.begin(), &prefsize); |
| 216 prefsize.Enlarge(kDownloadPadding, 0); | 216 prefsize.Enlarge(kDownloadPadding, 0); |
| 217 } | 217 } |
| 218 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); | 218 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); |
| 219 if (shelf_animation_->is_animating()) { | 219 if (shelf_animation_->is_animating()) { |
| 220 prefsize.set_height(static_cast<int>( | 220 prefsize.set_height(static_cast<int>( |
| 221 static_cast<double>(prefsize.height()) * | 221 static_cast<double>(prefsize.height()) * |
| 222 shelf_animation_->GetCurrentValue())); | 222 shelf_animation_->GetCurrentValue())); |
| 223 } | 223 } |
| 224 return prefsize; | 224 return prefsize; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 const DownloadItemView* download_item_view) { | 436 const DownloadItemView* download_item_view) { |
| 437 gfx::Rect bounds = download_item_view->bounds(); | 437 gfx::Rect bounds = download_item_view->bounds(); |
| 438 | 438 |
| 439 #if defined(TOOLKIT_VIEWS) | 439 #if defined(TOOLKIT_VIEWS) |
| 440 bounds.set_height(bounds.height() - 1); | 440 bounds.set_height(bounds.height() - 1); |
| 441 bounds.Offset(0, 3); | 441 bounds.Offset(0, 3); |
| 442 #endif | 442 #endif |
| 443 | 443 |
| 444 return bounds; | 444 return bounds; |
| 445 } | 445 } |
| OLD | NEW |