| 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_item_view.h" | 5 #include "chrome/browser/views/download_item_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gfx/chrome_canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "app/win_util.h" | 13 #include "app/win_util.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/download/download_item_model.h" | 17 #include "chrome/browser/download/download_item_model.h" |
| 18 #include "chrome/browser/download/download_util.h" | 18 #include "chrome/browser/download/download_util.h" |
| 19 #include "chrome/browser/views/download_shelf_view.h" | 19 #include "chrome/browser/views/download_shelf_view.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // user did this to detect whether we're being clickjacked. | 422 // user did this to detect whether we're being clickjacked. |
| 423 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", | 423 UMA_HISTOGRAM_LONG_TIMES("clickjacking.save_download", |
| 424 base::Time::Now() - creation_time_); | 424 base::Time::Now() - creation_time_); |
| 425 // This will change the state and notify us. | 425 // This will change the state and notify us. |
| 426 download_->manager()->DangerousDownloadValidated(download_); | 426 download_->manager()->DangerousDownloadValidated(download_); |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 // Load an icon for the file type we're downloading, and animate any in progress | 430 // Load an icon for the file type we're downloading, and animate any in progress |
| 431 // download state. | 431 // download state. |
| 432 void DownloadItemView::Paint(ChromeCanvas* canvas) { | 432 void DownloadItemView::Paint(gfx::Canvas* canvas) { |
| 433 BodyImageSet* body_image_set; | 433 BodyImageSet* body_image_set; |
| 434 switch (body_state_) { | 434 switch (body_state_) { |
| 435 case NORMAL: | 435 case NORMAL: |
| 436 case HOT: | 436 case HOT: |
| 437 body_image_set = &normal_body_image_set_; | 437 body_image_set = &normal_body_image_set_; |
| 438 break; | 438 break; |
| 439 case PUSHED: | 439 case PUSHED: |
| 440 body_image_set = &pushed_body_image_set_; | 440 body_image_set = &pushed_body_image_set_; |
| 441 break; | 441 break; |
| 442 case DANGEROUS: | 442 case DANGEROUS: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 SkPaint paint; | 617 SkPaint paint; |
| 618 paint.setAlpha(120); | 618 paint.setAlpha(120); |
| 619 canvas->DrawBitmapInt(*icon, | 619 canvas->DrawBitmapInt(*icon, |
| 620 download_util::kSmallProgressIconOffset, | 620 download_util::kSmallProgressIconOffset, |
| 621 download_util::kSmallProgressIconOffset, | 621 download_util::kSmallProgressIconOffset, |
| 622 paint); | 622 paint); |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 | 626 |
| 627 void DownloadItemView::PaintBitmaps(ChromeCanvas* canvas, | 627 void DownloadItemView::PaintBitmaps(gfx::Canvas* canvas, |
| 628 const SkBitmap* top_bitmap, | 628 const SkBitmap* top_bitmap, |
| 629 const SkBitmap* center_bitmap, | 629 const SkBitmap* center_bitmap, |
| 630 const SkBitmap* bottom_bitmap, | 630 const SkBitmap* bottom_bitmap, |
| 631 int x, int y, int height, int width) { | 631 int x, int y, int height, int width) { |
| 632 int middle_height = height - top_bitmap->height() - bottom_bitmap->height(); | 632 int middle_height = height - top_bitmap->height() - bottom_bitmap->height(); |
| 633 // Draw the top. | 633 // Draw the top. |
| 634 canvas->DrawBitmapInt(*top_bitmap, | 634 canvas->DrawBitmapInt(*top_bitmap, |
| 635 0, 0, top_bitmap->width(), top_bitmap->height(), | 635 0, 0, top_bitmap->width(), top_bitmap->height(), |
| 636 x, y, width, top_bitmap->height(), false); | 636 x, y, width, top_bitmap->height(), false); |
| 637 y += top_bitmap->height(); | 637 y += top_bitmap->height(); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 size = dangerous_download_label_->GetPreferredSize(); | 930 size = dangerous_download_label_->GetPreferredSize(); |
| 931 | 931 |
| 932 dangerous_download_label_->SetBounds(0, 0, size.width(), size.height()); | 932 dangerous_download_label_->SetBounds(0, 0, size.width(), size.height()); |
| 933 dangerous_download_label_sized_ = true; | 933 dangerous_download_label_sized_ = true; |
| 934 } | 934 } |
| 935 | 935 |
| 936 void DownloadItemView::Reenable() { | 936 void DownloadItemView::Reenable() { |
| 937 disabled_while_opening_ = false; | 937 disabled_while_opening_ = false; |
| 938 SetEnabled(true); // Triggers a repaint. | 938 SetEnabled(true); // Triggers a repaint. |
| 939 } | 939 } |
| OLD | NEW |