| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Align vertically with show_all_view_. | 311 // Align vertically with show_all_view_. |
| 312 arrow_image_->SetBounds(next_x, | 312 arrow_image_->SetBounds(next_x, |
| 313 CenterPosition(image_size.height(), height()), | 313 CenterPosition(image_size.height(), height()), |
| 314 image_size.width(), image_size.height()); | 314 image_size.width(), image_size.height()); |
| 315 next_x += image_size.width() + kDownloadsTitlePadding; | 315 next_x += image_size.width() + kDownloadsTitlePadding; |
| 316 show_all_view_->SetBounds(next_x, | 316 show_all_view_->SetBounds(next_x, |
| 317 CenterPosition(show_all_size.height(), height()), | 317 CenterPosition(show_all_size.height(), height()), |
| 318 show_all_size.width(), | 318 show_all_size.width(), |
| 319 show_all_size.height()); | 319 show_all_size.height()); |
| 320 next_x += show_all_size.width() + GetCloseAndLinkPadding(); | 320 next_x += show_all_size.width() + GetCloseAndLinkPadding(); |
| 321 // If the window is maximized, we want to expand the hitbox of the close | 321 close_button_->SizeToPreferredSize(); |
| 322 // button to the right and bottom to make it easier to click. | 322 close_button_->SetPosition( |
| 323 bool is_maximized = browser_->window()->IsMaximized(); | 323 gfx::Point(next_x, CenterPosition(close_button_->height(), height()))); |
| 324 int y = CenterPosition(close_button_size.height(), height()); | |
| 325 close_button_->SetBounds(next_x, y, | |
| 326 is_maximized ? width() - next_x : close_button_size.width(), | |
| 327 is_maximized ? height() - y : close_button_size.height()); | |
| 328 if (show_link_only) { | 324 if (show_link_only) { |
| 329 // Let's hide all the items. | 325 // Let's hide all the items. |
| 330 for (auto ri = download_views_.rbegin(); ri != download_views_.rend(); ++ri) | 326 for (auto ri = download_views_.rbegin(); ri != download_views_.rend(); ++ri) |
| 331 (*ri)->SetVisible(false); | 327 (*ri)->SetVisible(false); |
| 332 return; | 328 return; |
| 333 } | 329 } |
| 334 | 330 |
| 335 next_x = GetStartPadding(); | 331 next_x = GetStartPadding(); |
| 336 for (auto ri = download_views_.rbegin(); ri != download_views_.rend(); ++ri) { | 332 for (auto ri = download_views_.rbegin(); ri != download_views_.rend(); ++ri) { |
| 337 gfx::Size view_size = (*ri)->GetPreferredSize(); | 333 gfx::Size view_size = (*ri)->GetPreferredSize(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 485 |
| 490 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { | 486 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { |
| 491 if (ui::MaterialDesignController::IsModeMaterial()) | 487 if (ui::MaterialDesignController::IsModeMaterial()) |
| 492 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); | 488 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); |
| 493 return static_cast<DownloadItemView*>(download_views_[i])->download(); | 489 return static_cast<DownloadItemView*>(download_views_[i])->download(); |
| 494 } | 490 } |
| 495 | 491 |
| 496 SkColor DownloadShelfView::GetTextColorForIconMd() { | 492 SkColor DownloadShelfView::GetTextColorForIconMd() { |
| 497 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); | 493 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); |
| 498 } | 494 } |
| OLD | NEW |