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_item_view.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (IsShowingWarningDialog()) | 400 if (IsShowingWarningDialog()) |
401 return true; | 401 return true; |
402 | 402 |
403 if (!starting_drag_) { | 403 if (!starting_drag_) { |
404 starting_drag_ = true; | 404 starting_drag_ = true; |
405 drag_start_point_ = event.location(); | 405 drag_start_point_ = event.location(); |
406 } | 406 } |
407 if (dragging_) { | 407 if (dragging_) { |
408 if (download()->IsComplete()) { | 408 if (download()->IsComplete()) { |
409 IconManager* im = g_browser_process->icon_manager(); | 409 IconManager* im = g_browser_process->icon_manager(); |
410 gfx::Image* icon = im->LookupIcon(download()->GetUserVerifiedFilePath(), | 410 gfx::Image* icon = im->LookupIconFromFilepath( |
411 IconLoader::SMALL); | 411 download()->GetUserVerifiedFilePath(), IconLoader::SMALL); |
412 if (icon) { | 412 if (icon) { |
413 views::Widget* widget = GetWidget(); | 413 views::Widget* widget = GetWidget(); |
414 download_util::DragDownload(download(), icon, | 414 download_util::DragDownload(download(), icon, |
415 widget ? widget->GetNativeView() : NULL); | 415 widget ? widget->GetNativeView() : NULL); |
416 } | 416 } |
417 } | 417 } |
418 } else if (ExceededDragThreshold(event.location() - drag_start_point_)) { | 418 } else if (ExceededDragThreshold(event.location() - drag_start_point_)) { |
419 dragging_ = true; | 419 dragging_ = true; |
420 } | 420 } |
421 return true; | 421 return true; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 767 |
768 // Draw the file's name. | 768 // Draw the file's name. |
769 canvas->DrawStringInt(filename, font_, | 769 canvas->DrawStringInt(filename, font_, |
770 enabled() ? file_name_color | 770 enabled() ? file_name_color |
771 : kFileNameDisabledColor, | 771 : kFileNameDisabledColor, |
772 mirrored_x, y, kTextWidth, font_.GetHeight()); | 772 mirrored_x, y, kTextWidth, font_.GetHeight()); |
773 } | 773 } |
774 | 774 |
775 // Load the icon. | 775 // Load the icon. |
776 IconManager* im = g_browser_process->icon_manager(); | 776 IconManager* im = g_browser_process->icon_manager(); |
777 gfx::Image* image = im->LookupIcon(download()->GetUserVerifiedFilePath(), | 777 gfx::Image* image = im->LookupIconFromFilepath( |
778 IconLoader::SMALL); | 778 download()->GetUserVerifiedFilePath(),IconLoader::SMALL); |
779 const gfx::ImageSkia* icon = NULL; | 779 const gfx::ImageSkia* icon = NULL; |
780 if (IsShowingWarningDialog()) | 780 if (IsShowingWarningDialog()) |
781 icon = warning_icon_; | 781 icon = warning_icon_; |
782 else if (image) | 782 else if (image) |
783 icon = image->ToImageSkia(); | 783 icon = image->ToImageSkia(); |
784 | 784 |
785 // We count on the fact that the icon manager will cache the icons and if one | 785 // We count on the fact that the icon manager will cache the icons and if one |
786 // is available, it will be cached here. We *don't* want to request the icon | 786 // is available, it will be cached here. We *don't* want to request the icon |
787 // to be loaded here, since this will also get called if the icon can't be | 787 // to be loaded here, since this will also get called if the icon can't be |
788 // loaded, in which case LookupIcon will always be NULL. The loading will be | 788 // loaded, in which case LookupIcon will always be NULL. The loading will be |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 void DownloadItemView::AnimateStateTransition(State from, State to, | 1215 void DownloadItemView::AnimateStateTransition(State from, State to, |
1216 ui::SlideAnimation* animation) { | 1216 ui::SlideAnimation* animation) { |
1217 if (from == NORMAL && to == HOT) { | 1217 if (from == NORMAL && to == HOT) { |
1218 animation->Show(); | 1218 animation->Show(); |
1219 } else if (from == HOT && to == NORMAL) { | 1219 } else if (from == HOT && to == NORMAL) { |
1220 animation->Hide(); | 1220 animation->Hide(); |
1221 } else if (from != to) { | 1221 } else if (from != to) { |
1222 animation->Reset((to == HOT) ? 1.0 : 0.0); | 1222 animation->Reset((to == HOT) ? 1.0 : 0.0); |
1223 } | 1223 } |
1224 } | 1224 } |
OLD | NEW |