| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 return true; | 725 return true; |
| 726 } | 726 } |
| 727 | 727 |
| 728 // Handle drag (file copy) operations. | 728 // Handle drag (file copy) operations. |
| 729 bool DownloadItemTabView::OnMouseDragged(const views::MouseEvent& event) { | 729 bool DownloadItemTabView::OnMouseDragged(const views::MouseEvent& event) { |
| 730 if (model_->state() != DownloadItem::COMPLETE || | 730 if (model_->state() != DownloadItem::COMPLETE || |
| 731 model_->safety_state() == DownloadItem::DANGEROUS) | 731 model_->safety_state() == DownloadItem::DANGEROUS) |
| 732 return false; | 732 return false; |
| 733 | 733 |
| 734 CPoint point(event.x(), event.y()); | 734 gfx::Point point(event.x(), event.y()); |
| 735 | 735 |
| 736 // In order to make sure drag and drop works as expected when the UI is | 736 // In order to make sure drag and drop works as expected when the UI is |
| 737 // mirrored, we can either flip the mouse X coordinate or flip the X position | 737 // mirrored, we can either flip the mouse X coordinate or flip the X position |
| 738 // of the drag rectangle. Flipping the mouse X coordinate is easier. | 738 // of the drag rectangle. Flipping the mouse X coordinate is easier. |
| 739 point.x = MirroredXCoordinateInsideView(point.x); | 739 point.set_x(MirroredXCoordinateInsideView(point.x())); |
| 740 CRect drag_rect(kDownloadIconOffset - | 740 gfx::Rect drag_rect(kDownloadIconOffset - |
| 741 parent_->big_icon_offset(), | 741 parent_->big_icon_offset(), |
| 742 0, | 742 0, |
| 743 kDownloadIconOffset - | 743 kDownloadIconOffset - |
| 744 parent_->big_icon_offset() + | 744 parent_->big_icon_offset() + |
| 745 parent_->big_icon_size() + kInfoPadding + | 745 parent_->big_icon_size() + kInfoPadding + |
| 746 kFilenameSize, | 746 kFilenameSize, |
| 747 parent_->big_icon_size()); | 747 parent_->big_icon_size()); |
| 748 | 748 |
| 749 if (drag_rect.PtInRect(point)) { | 749 if (drag_rect.Contains(point)) { |
| 750 SkBitmap* icon = parent_->LookupIcon(model_); | 750 SkBitmap* icon = parent_->LookupIcon(model_); |
| 751 if (icon) | 751 if (icon) |
| 752 download_util::DragDownload(model_, icon); | 752 download_util::DragDownload(model_, icon); |
| 753 } | 753 } |
| 754 | 754 |
| 755 return true; | 755 return true; |
| 756 } | 756 } |
| 757 | 757 |
| 758 void DownloadItemTabView::LinkActivated(views::Link* source, int event_flags) { | 758 void DownloadItemTabView::LinkActivated(views::Link* source, int event_flags) { |
| 759 // There are several links in our view that could have been clicked: | 759 // There are several links in our view that could have been clicked: |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 case NOTIFY_DOWNLOAD_STOP: | 1326 case NOTIFY_DOWNLOAD_STOP: |
| 1327 DCHECK(profile()->HasCreatedDownloadManager()); | 1327 DCHECK(profile()->HasCreatedDownloadManager()); |
| 1328 contents_->SetIsLoading( | 1328 contents_->SetIsLoading( |
| 1329 profile()->GetDownloadManager()->in_progress_count() > 0, | 1329 profile()->GetDownloadManager()->in_progress_count() > 0, |
| 1330 NULL); | 1330 NULL); |
| 1331 break; | 1331 break; |
| 1332 default: | 1332 default: |
| 1333 break; | 1333 break; |
| 1334 } | 1334 } |
| 1335 } | 1335 } |
| OLD | NEW |