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