| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/download_item_gtk.h" | 5 #include "chrome/browser/gtk/download_item_gtk.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/gfx/canvas_paint.h" | 8 #include "app/gfx/canvas_paint.h" |
| 9 #include "app/gfx/font.h" | 9 #include "app/gfx/font.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 417 } |
| 418 | 418 |
| 419 UpdateStatusLabel(status_label_, status_text_); | 419 UpdateStatusLabel(status_label_, status_text_); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void DownloadItemGtk::AnimationProgressed(const Animation* animation) { | 422 void DownloadItemGtk::AnimationProgressed(const Animation* animation) { |
| 423 if (animation == complete_animation_.get()) { | 423 if (animation == complete_animation_.get()) { |
| 424 gtk_widget_queue_draw(progress_area_.get()); | 424 gtk_widget_queue_draw(progress_area_.get()); |
| 425 } else { | 425 } else { |
| 426 if (IsDangerous()) { | 426 if (IsDangerous()) { |
| 427 int progress = (dangerous_hbox_full_width_ - | 427 int progress = static_cast<int>((dangerous_hbox_full_width_ - |
| 428 dangerous_hbox_start_width_) * | 428 dangerous_hbox_start_width_) * |
| 429 new_item_animation_->GetCurrentValue(); | 429 new_item_animation_->GetCurrentValue()); |
| 430 int showing_width = dangerous_hbox_start_width_ + progress; | 430 int showing_width = dangerous_hbox_start_width_ + progress; |
| 431 gtk_widget_set_size_request(dangerous_hbox_, showing_width, -1); | 431 gtk_widget_set_size_request(dangerous_hbox_, showing_width, -1); |
| 432 } else { | 432 } else { |
| 433 DCHECK(animation == new_item_animation_.get()); | 433 DCHECK(animation == new_item_animation_.get()); |
| 434 int showing_width = std::max(kMinDownloadItemWidth, | 434 int showing_width = std::max(kMinDownloadItemWidth, |
| 435 static_cast<int>(kBodyWidth * | 435 static_cast<int>(kBodyWidth * |
| 436 new_item_animation_->GetCurrentValue())); | 436 new_item_animation_->GetCurrentValue())); |
| 437 gtk_widget_set_size_request(body_.get(), showing_width, -1); | 437 gtk_widget_set_size_request(body_.get(), showing_width, -1); |
| 438 } | 438 } |
| 439 } | 439 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 | 871 |
| 872 // static | 872 // static |
| 873 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, | 873 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, |
| 874 DownloadItemGtk* item) { | 874 DownloadItemGtk* item) { |
| 875 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 875 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
| 876 base::Time::Now() - item->creation_time_); | 876 base::Time::Now() - item->creation_time_); |
| 877 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) | 877 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) |
| 878 item->get_download()->Cancel(true); | 878 item->get_download()->Cancel(true); |
| 879 item->get_download()->Remove(true); | 879 item->get_download()->Remove(true); |
| 880 } | 880 } |
| OLD | NEW |