| OLD | NEW |
| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 highlighted_bounds.height()); | 690 highlighted_bounds.height()); |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 | 693 |
| 694 void DownloadItemTabView::DidChangeBounds(const CRect& previous, | 694 void DownloadItemTabView::DidChangeBounds(const CRect& previous, |
| 695 const CRect& current) { | 695 const CRect& current) { |
| 696 Layout(); | 696 Layout(); |
| 697 } | 697 } |
| 698 | 698 |
| 699 bool DownloadItemTabView::OnMousePressed(const ChromeViews::MouseEvent& event) { | 699 bool DownloadItemTabView::OnMousePressed(const ChromeViews::MouseEvent& event) { |
| 700 CPoint point(event.x(), event.y()); | 700 gfx::Point point(event.location()); |
| 701 | 701 |
| 702 // If the click is in the highlight region, then highlight this download. | 702 // If the click is in the highlight region, then highlight this download. |
| 703 // Otherwise, remove the highlighting from any download. | 703 // Otherwise, remove the highlighting from any download. |
| 704 CRect select_rect(kDownloadIconOffset - download_util::kBigProgressIconOffset, | 704 gfx::Rect select_rect( |
| 705 0, | 705 kDownloadIconOffset - download_util::kBigProgressIconOffset, |
| 706 kDownloadIconOffset - | 706 0, |
| 707 download_util::kBigProgressIconOffset + | 707 kDownloadIconOffset - download_util::kBigProgressIconOffset + |
| 708 download_util::kBigProgressIconSize + kInfoPadding + | 708 download_util::kBigProgressIconSize + kInfoPadding + kFilenameSize, |
| 709 kFilenameSize, | 709 download_util::kBigProgressIconSize); |
| 710 download_util::kBigProgressIconSize); | |
| 711 | 710 |
| 712 // The position of the highlighted region does not take into account the | 711 // The position of the highlighted region does not take into account the |
| 713 // View's UI layout so we have to manually mirror the position if the View is | 712 // View's UI layout so we have to manually mirror the position if the View is |
| 714 // using a right-to-left UI layout. | 713 // using a right-to-left UI layout. |
| 715 gfx::Rect mirrored_rect(select_rect); | 714 gfx::Rect mirrored_rect(select_rect); |
| 716 select_rect.MoveToX(MirroredLeftPointForRect(mirrored_rect)); | 715 select_rect.set_x(MirroredLeftPointForRect(mirrored_rect)); |
| 717 if (select_rect.PtInRect(point)) { | 716 if (select_rect.Contains(point)) { |
| 718 parent_->ItemBecameSelected(model_); | 717 parent_->ItemBecameSelected(model_); |
| 719 | 718 |
| 720 // Don't show the right-click menu if we are prompting the user for a | 719 // Don't show the right-click menu if we are prompting the user for a |
| 721 // dangerous download. | 720 // dangerous download. |
| 722 if (event.IsRightMouseButton() && | 721 if (event.IsRightMouseButton() && |
| 723 model_->safety_state() != DownloadItem::DANGEROUS) { | 722 model_->safety_state() != DownloadItem::DANGEROUS) { |
| 724 ChromeViews::View::ConvertPointToScreen(this, &point); | 723 ChromeViews::View::ConvertPointToScreen(this, &point); |
| 725 | 724 |
| 726 download_util::DownloadDestinationContextMenu menu( | 725 download_util::DownloadDestinationContextMenu menu( |
| 727 model_, GetViewContainer()->GetHWND(), point); | 726 model_, GetViewContainer()->GetHWND(), point.ToPOINT()); |
| 728 } | 727 } |
| 729 } else { | 728 } else { |
| 730 parent_->ItemBecameSelected(NULL); | 729 parent_->ItemBecameSelected(NULL); |
| 731 } | 730 } |
| 732 | 731 |
| 733 return true; | 732 return true; |
| 734 } | 733 } |
| 735 | 734 |
| 736 // Handle drag (file copy) operations. | 735 // Handle drag (file copy) operations. |
| 737 bool DownloadItemTabView::OnMouseDragged(const ChromeViews::MouseEvent& event) { | 736 bool DownloadItemTabView::OnMouseDragged(const ChromeViews::MouseEvent& event) { |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 DCHECK(profile()->HasCreatedDownloadManager()); | 1332 DCHECK(profile()->HasCreatedDownloadManager()); |
| 1334 contents_->SetIsLoading( | 1333 contents_->SetIsLoading( |
| 1335 profile()->GetDownloadManager()->in_progress_count() > 0, | 1334 profile()->GetDownloadManager()->in_progress_count() > 0, |
| 1336 NULL); | 1335 NULL); |
| 1337 break; | 1336 break; |
| 1338 default: | 1337 default: |
| 1339 break; | 1338 break; |
| 1340 } | 1339 } |
| 1341 } | 1340 } |
| 1342 | 1341 |
| OLD | NEW |