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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 421 } |
422 | 422 |
423 UpdateStatusLabel(status_label_, status_text_); | 423 UpdateStatusLabel(status_label_, status_text_); |
424 } | 424 } |
425 | 425 |
426 void DownloadItemGtk::AnimationProgressed(const Animation* animation) { | 426 void DownloadItemGtk::AnimationProgressed(const Animation* animation) { |
427 if (animation == complete_animation_.get()) { | 427 if (animation == complete_animation_.get()) { |
428 gtk_widget_queue_draw(progress_area_.get()); | 428 gtk_widget_queue_draw(progress_area_.get()); |
429 } else { | 429 } else { |
430 if (IsDangerous()) { | 430 if (IsDangerous()) { |
431 int progress = static_cast<int>((dangerous_hbox_full_width_ - | 431 int progress = (dangerous_hbox_full_width_ - |
432 dangerous_hbox_start_width_) * | 432 dangerous_hbox_start_width_) * |
433 new_item_animation_->GetCurrentValue()); | 433 new_item_animation_->GetCurrentValue(); |
434 int showing_width = dangerous_hbox_start_width_ + progress; | 434 int showing_width = dangerous_hbox_start_width_ + progress; |
435 gtk_widget_set_size_request(dangerous_hbox_, showing_width, -1); | 435 gtk_widget_set_size_request(dangerous_hbox_, showing_width, -1); |
436 } else { | 436 } else { |
437 DCHECK(animation == new_item_animation_.get()); | 437 DCHECK(animation == new_item_animation_.get()); |
438 int showing_width = std::max(kMinDownloadItemWidth, | 438 int showing_width = std::max(kMinDownloadItemWidth, |
439 static_cast<int>(kBodyWidth * | 439 static_cast<int>(kBodyWidth * |
440 new_item_animation_->GetCurrentValue())); | 440 new_item_animation_->GetCurrentValue())); |
441 gtk_widget_set_size_request(body_.get(), showing_width, -1); | 441 gtk_widget_set_size_request(body_.get(), showing_width, -1); |
442 } | 442 } |
443 } | 443 } |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 880 |
881 // static | 881 // static |
882 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, | 882 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, |
883 DownloadItemGtk* item) { | 883 DownloadItemGtk* item) { |
884 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", | 884 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", |
885 base::Time::Now() - item->creation_time_); | 885 base::Time::Now() - item->creation_time_); |
886 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) | 886 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) |
887 item->get_download()->Cancel(true); | 887 item->get_download()->Cancel(true); |
888 item->get_download()->Remove(true); | 888 item->get_download()->Remove(true); |
889 } | 889 } |
OLD | NEW |