| 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_md.h" | 5 #include "chrome/browser/ui/views/download/download_item_view_md.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "ui/events/event.h" | 50 #include "ui/events/event.h" |
| 51 #include "ui/gfx/animation/slide_animation.h" | 51 #include "ui/gfx/animation/slide_animation.h" |
| 52 #include "ui/gfx/canvas.h" | 52 #include "ui/gfx/canvas.h" |
| 53 #include "ui/gfx/color_palette.h" | 53 #include "ui/gfx/color_palette.h" |
| 54 #include "ui/gfx/color_utils.h" | 54 #include "ui/gfx/color_utils.h" |
| 55 #include "ui/gfx/image/image.h" | 55 #include "ui/gfx/image/image.h" |
| 56 #include "ui/gfx/paint_vector_icon.h" | 56 #include "ui/gfx/paint_vector_icon.h" |
| 57 #include "ui/gfx/text_elider.h" | 57 #include "ui/gfx/text_elider.h" |
| 58 #include "ui/gfx/text_utils.h" | 58 #include "ui/gfx/text_utils.h" |
| 59 #include "ui/gfx/vector_icons_public.h" | 59 #include "ui/gfx/vector_icons_public.h" |
| 60 #include "ui/views/animation/flood_fill_ink_drop_animation.h" |
| 60 #include "ui/views/animation/ink_drop_delegate.h" | 61 #include "ui/views/animation/ink_drop_delegate.h" |
| 62 #include "ui/views/animation/ink_drop_hover.h" |
| 61 #include "ui/views/border.h" | 63 #include "ui/views/border.h" |
| 62 #include "ui/views/controls/button/image_button.h" | 64 #include "ui/views/controls/button/image_button.h" |
| 63 #include "ui/views/controls/button/label_button.h" | 65 #include "ui/views/controls/button/label_button.h" |
| 64 #include "ui/views/controls/button/md_text_button.h" | 66 #include "ui/views/controls/button/md_text_button.h" |
| 65 #include "ui/views/controls/label.h" | 67 #include "ui/views/controls/label.h" |
| 66 #include "ui/views/mouse_constants.h" | 68 #include "ui/views/mouse_constants.h" |
| 67 #include "ui/views/widget/root_view.h" | 69 #include "ui/views/widget/root_view.h" |
| 68 #include "ui/views/widget/widget.h" | 70 #include "ui/views/widget/widget.h" |
| 69 | 71 |
| 70 using content::DownloadItem; | 72 using content::DownloadItem; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 153 |
| 152 DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item, | 154 DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item, |
| 153 DownloadShelfView* parent) | 155 DownloadShelfView* parent) |
| 154 : shelf_(parent), | 156 : shelf_(parent), |
| 155 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), | 157 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), |
| 156 dropdown_state_(NORMAL), | 158 dropdown_state_(NORMAL), |
| 157 mode_(NORMAL_MODE), | 159 mode_(NORMAL_MODE), |
| 158 dragging_(false), | 160 dragging_(false), |
| 159 starting_drag_(false), | 161 starting_drag_(false), |
| 160 model_(download_item), | 162 model_(download_item), |
| 163 ink_drop_delegate_(this, this), |
| 161 save_button_(nullptr), | 164 save_button_(nullptr), |
| 162 discard_button_(nullptr), | 165 discard_button_(nullptr), |
| 163 dropdown_button_(new BarControlButton(this)), | 166 dropdown_button_(new BarControlButton(this)), |
| 164 dangerous_download_label_(nullptr), | 167 dangerous_download_label_(nullptr), |
| 165 dangerous_download_label_sized_(false), | 168 dangerous_download_label_sized_(false), |
| 166 disabled_while_opening_(false), | 169 disabled_while_opening_(false), |
| 167 creation_time_(base::Time::Now()), | 170 creation_time_(base::Time::Now()), |
| 168 time_download_warning_shown_(base::Time()), | 171 time_download_warning_shown_(base::Time()), |
| 169 weak_ptr_factory_(this) { | 172 weak_ptr_factory_(this) { |
| 170 DCHECK(download()); | 173 DCHECK(download()); |
| 171 DCHECK(ui::MaterialDesignController::IsModeMaterial()); | 174 DCHECK(ui::MaterialDesignController::IsModeMaterial()); |
| 172 download()->AddObserver(this); | 175 download()->AddObserver(this); |
| 173 set_context_menu_controller(this); | 176 set_context_menu_controller(this); |
| 174 | 177 |
| 175 dropdown_button_->SetBorder( | 178 dropdown_button_->SetBorder( |
| 176 views::Border::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth))); | 179 views::Border::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth))); |
| 177 dropdown_button_->set_ink_drop_size(gfx::Size(32, 32)); | 180 dropdown_button_->set_ink_drop_size(gfx::Size(32, 32)); |
| 178 AddChildView(dropdown_button_); | 181 AddChildView(dropdown_button_); |
| 179 | 182 |
| 180 LoadIcon(); | 183 LoadIcon(); |
| 181 | 184 |
| 182 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 185 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 183 font_list_ = | 186 font_list_ = |
| 184 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); | 187 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); |
| 185 status_font_list_ = | 188 status_font_list_ = |
| 186 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); | 189 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); |
| 187 | 190 |
| 188 body_hover_animation_.reset(new gfx::SlideAnimation(this)); | |
| 189 drop_hover_animation_.reset(new gfx::SlideAnimation(this)); | |
| 190 | |
| 191 SetAccessibilityFocusable(true); | 191 SetAccessibilityFocusable(true); |
| 192 | 192 |
| 193 OnDownloadUpdated(download()); | 193 OnDownloadUpdated(download()); |
| 194 | 194 |
| 195 SetDropdownState(NORMAL); | 195 SetDropdownState(NORMAL); |
| 196 UpdateColorsFromTheme(); | 196 UpdateColorsFromTheme(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 DownloadItemViewMd::~DownloadItemViewMd() { | 199 DownloadItemViewMd::~DownloadItemViewMd() { |
| 200 StopDownloadProgress(); | 200 StopDownloadProgress(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } else { | 369 } else { |
| 370 width = kStartPadding + DownloadShelf::kProgressIndicatorSize + | 370 width = kStartPadding + DownloadShelf::kProgressIndicatorSize + |
| 371 kProgressTextPadding + kTextWidth + | 371 kProgressTextPadding + kTextWidth + |
| 372 dropdown_button_->GetPreferredSize().width() + kEndPadding; | 372 dropdown_button_->GetPreferredSize().width() + kEndPadding; |
| 373 } | 373 } |
| 374 | 374 |
| 375 return gfx::Size(width, std::max(kDefaultHeight, | 375 return gfx::Size(width, std::max(kDefaultHeight, |
| 376 2 * kMinimumVerticalPadding + child_height)); | 376 2 * kMinimumVerticalPadding + child_height)); |
| 377 } | 377 } |
| 378 | 378 |
| 379 // Handle a mouse click and open the context menu if the mouse is | |
| 380 // over the drop-down region. | |
| 381 bool DownloadItemViewMd::OnMousePressed(const ui::MouseEvent& event) { | 379 bool DownloadItemViewMd::OnMousePressed(const ui::MouseEvent& event) { |
| 382 HandlePressEvent(event, event.IsOnlyLeftMouseButton()); | 380 HandlePressEvent(event, event.IsOnlyLeftMouseButton()); |
| 383 return true; | 381 return true; |
| 384 } | 382 } |
| 385 | 383 |
| 386 // Handle drag (file copy) operations. | 384 // Handle drag (file copy) operations. |
| 387 bool DownloadItemViewMd::OnMouseDragged(const ui::MouseEvent& event) { | 385 bool DownloadItemViewMd::OnMouseDragged(const ui::MouseEvent& event) { |
| 388 // Mouse should not activate us in dangerous mode. | 386 // Mouse should not activate us in dangerous mode. |
| 389 if (IsShowingWarningDialog()) | 387 if (IsShowingWarningDialog()) |
| 390 return true; | 388 return true; |
| 391 | 389 |
| 392 if (!starting_drag_) { | 390 if (!starting_drag_) { |
| 393 starting_drag_ = true; | 391 starting_drag_ = true; |
| 394 drag_start_point_ = event.location(); | 392 drag_start_point_ = event.location(); |
| 393 ink_drop_delegate_.OnAction(views::InkDropState::HIDDEN); |
| 395 } | 394 } |
| 396 if (dragging_) { | 395 if (dragging_) { |
| 397 if (download()->GetState() == DownloadItem::COMPLETE) { | 396 if (download()->GetState() == DownloadItem::COMPLETE) { |
| 398 IconManager* im = g_browser_process->icon_manager(); | 397 IconManager* im = g_browser_process->icon_manager(); |
| 399 gfx::Image* icon = im->LookupIconFromFilepath( | 398 gfx::Image* icon = im->LookupIconFromFilepath( |
| 400 download()->GetTargetFilePath(), IconLoader::SMALL); | 399 download()->GetTargetFilePath(), IconLoader::SMALL); |
| 401 views::Widget* widget = GetWidget(); | 400 views::Widget* widget = GetWidget(); |
| 402 DragDownloadItem(download(), icon, | 401 DragDownloadItem(download(), icon, |
| 403 widget ? widget->GetNativeView() : NULL); | 402 widget ? widget->GetNativeView() : NULL); |
| 404 } | 403 } |
| 405 } else if (ExceededDragThreshold(event.location() - drag_start_point_)) { | 404 } else if (ExceededDragThreshold(event.location() - drag_start_point_)) { |
| 406 dragging_ = true; | 405 dragging_ = true; |
| 407 } | 406 } |
| 408 return true; | 407 return true; |
| 409 } | 408 } |
| 410 | 409 |
| 411 void DownloadItemViewMd::OnMouseReleased(const ui::MouseEvent& event) { | 410 void DownloadItemViewMd::OnMouseReleased(const ui::MouseEvent& event) { |
| 412 HandleClickEvent(event, event.IsOnlyLeftMouseButton()); | 411 HandleClickEvent(event, event.IsOnlyLeftMouseButton()); |
| 413 } | 412 } |
| 414 | 413 |
| 415 void DownloadItemViewMd::OnMouseCaptureLost() { | 414 void DownloadItemViewMd::OnMouseCaptureLost() { |
| 416 // Mouse should not activate us in dangerous mode. | 415 // Mouse should not activate us in dangerous mode. |
| 417 if (mode_ == DANGEROUS_MODE) | 416 if (mode_ != NORMAL_MODE) |
| 418 return; | 417 return; |
| 419 | 418 |
| 420 if (dragging_) { | 419 if (dragging_) { |
| 421 // Starting a drag results in a MouseCaptureLost. | 420 // Starting a drag results in a MouseCaptureLost. |
| 422 dragging_ = false; | 421 dragging_ = false; |
| 423 starting_drag_ = false; | 422 starting_drag_ = false; |
| 424 } | 423 } |
| 425 } | 424 } |
| 426 | 425 |
| 427 bool DownloadItemViewMd::OnKeyPressed(const ui::KeyEvent& event) { | 426 bool DownloadItemViewMd::OnKeyPressed(const ui::KeyEvent& event) { |
| 428 // Key press should not activate us in dangerous mode. | 427 // Key press should not activate us in dangerous mode. |
| 429 if (IsShowingWarningDialog()) | 428 if (IsShowingWarningDialog()) |
| 430 return true; | 429 return true; |
| 431 | 430 |
| 432 if (event.key_code() == ui::VKEY_SPACE || | 431 if (event.key_code() == ui::VKEY_SPACE || |
| 433 event.key_code() == ui::VKEY_RETURN) { | 432 event.key_code() == ui::VKEY_RETURN) { |
| 433 ink_drop_delegate_.set_last_ink_drop_location( |
| 434 GetLocalBounds().CenterPoint()); |
| 434 // OpenDownload may delete this, so don't add any code after this line. | 435 // OpenDownload may delete this, so don't add any code after this line. |
| 435 OpenDownload(); | 436 OpenDownload(); |
| 436 return true; | 437 return true; |
| 437 } | 438 } |
| 438 return false; | 439 return false; |
| 439 } | 440 } |
| 440 | 441 |
| 441 bool DownloadItemViewMd::GetTooltipText(const gfx::Point& p, | 442 bool DownloadItemViewMd::GetTooltipText(const gfx::Point& p, |
| 442 base::string16* tooltip) const { | 443 base::string16* tooltip) const { |
| 443 if (IsShowingWarningDialog()) { | 444 if (IsShowingWarningDialog()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 456 if (model_.IsDangerous()) | 457 if (model_.IsDangerous()) |
| 457 state->AddStateFlag(ui::AX_STATE_DISABLED); | 458 state->AddStateFlag(ui::AX_STATE_DISABLED); |
| 458 else | 459 else |
| 459 state->AddStateFlag(ui::AX_STATE_HASPOPUP); | 460 state->AddStateFlag(ui::AX_STATE_HASPOPUP); |
| 460 } | 461 } |
| 461 | 462 |
| 462 void DownloadItemViewMd::OnThemeChanged() { | 463 void DownloadItemViewMd::OnThemeChanged() { |
| 463 UpdateColorsFromTheme(); | 464 UpdateColorsFromTheme(); |
| 464 } | 465 } |
| 465 | 466 |
| 467 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 468 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
| 469 // The layer that's added to host the ink drop layer must mask to bounds |
| 470 // so the hover effect is clipped while animating open. |
| 471 layer()->SetMasksToBounds(true); |
| 472 } |
| 473 |
| 474 scoped_ptr<views::InkDropAnimation> DownloadItemViewMd::CreateInkDropAnimation() |
| 475 const { |
| 476 return make_scoped_ptr(new views::FloodFillInkDropAnimation( |
| 477 size(), ink_drop_delegate_.last_ink_drop_location(), |
| 478 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
| 479 } |
| 480 |
| 481 scoped_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() const { |
| 482 if (IsShowingWarningDialog()) |
| 483 return nullptr; |
| 484 |
| 485 gfx::Size size = GetPreferredSize(); |
| 486 return make_scoped_ptr(new views::InkDropHover( |
| 487 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), |
| 488 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
| 489 } |
| 490 |
| 466 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { | 491 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { |
| 467 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 492 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 468 HandlePressEvent(*event, true); | 493 HandlePressEvent(*event, true); |
| 469 event->SetHandled(); | 494 event->SetHandled(); |
| 470 return; | 495 return; |
| 471 } | 496 } |
| 472 | 497 |
| 473 if (event->type() == ui::ET_GESTURE_TAP) { | 498 if (event->type() == ui::ET_GESTURE_TAP) { |
| 474 HandleClickEvent(*event, true); | 499 HandleClickEvent(*event, true); |
| 475 event->SetHandled(); | 500 event->SetHandled(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 } | 722 } |
| 698 | 723 |
| 699 void DownloadItemViewMd::OpenDownload() { | 724 void DownloadItemViewMd::OpenDownload() { |
| 700 DCHECK(!IsShowingWarningDialog()); | 725 DCHECK(!IsShowingWarningDialog()); |
| 701 // We're interested in how long it takes users to open downloads. If they | 726 // We're interested in how long it takes users to open downloads. If they |
| 702 // open downloads super quickly, we should be concerned about clickjacking. | 727 // open downloads super quickly, we should be concerned about clickjacking. |
| 703 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", | 728 UMA_HISTOGRAM_LONG_TIMES("clickjacking.open_download", |
| 704 base::Time::Now() - creation_time_); | 729 base::Time::Now() - creation_time_); |
| 705 | 730 |
| 706 UpdateAccessibleName(); | 731 UpdateAccessibleName(); |
| 732 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_TRIGGERED); |
| 707 | 733 |
| 708 // Calling download()->OpenDownload may delete this, so this must be | 734 // Calling download()->OpenDownload may delete this, so this must be |
| 709 // the last thing we do. | 735 // the last thing we do. |
| 710 download()->OpenDownload(); | 736 download()->OpenDownload(); |
| 711 } | 737 } |
| 712 | 738 |
| 713 bool DownloadItemViewMd::SubmitDownloadToFeedbackService() { | 739 bool DownloadItemViewMd::SubmitDownloadToFeedbackService() { |
| 714 #if defined(FULL_SAFE_BROWSING) | 740 #if defined(FULL_SAFE_BROWSING) |
| 715 safe_browsing::SafeBrowsingService* sb_service = | 741 safe_browsing::SafeBrowsingService* sb_service = |
| 716 g_browser_process->safe_browsing_service(); | 742 g_browser_process->safe_browsing_service(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 818 |
| 793 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, | 819 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, |
| 794 bool active_event) { | 820 bool active_event) { |
| 795 // The event should not activate us in dangerous mode. | 821 // The event should not activate us in dangerous mode. |
| 796 if (mode_ == DANGEROUS_MODE) | 822 if (mode_ == DANGEROUS_MODE) |
| 797 return; | 823 return; |
| 798 | 824 |
| 799 // Stop any completion animation. | 825 // Stop any completion animation. |
| 800 if (complete_animation_.get() && complete_animation_->is_animating()) | 826 if (complete_animation_.get() && complete_animation_->is_animating()) |
| 801 complete_animation_->End(); | 827 complete_animation_->End(); |
| 828 |
| 829 ink_drop_delegate_.set_last_ink_drop_location(event.location()); |
| 830 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); |
| 802 } | 831 } |
| 803 | 832 |
| 804 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, | 833 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, |
| 805 bool active_event) { | 834 bool active_event) { |
| 806 // Mouse should not activate us in dangerous mode. | 835 // Mouse should not activate us in dangerous mode. |
| 807 if (mode_ == DANGEROUS_MODE) | 836 if (mode_ == DANGEROUS_MODE) |
| 808 return; | 837 return; |
| 809 | 838 |
| 810 if (!active_event || IsShowingWarningDialog()) | 839 if (!active_event || IsShowingWarningDialog()) |
| 811 return; | 840 return; |
| 812 | 841 |
| 813 // OpenDownload may delete this, so don't add any code after this line. | 842 // OpenDownload may delete this, so don't add any code after this line. |
| 814 OpenDownload(); | 843 OpenDownload(); |
| 815 } | 844 } |
| 816 | 845 |
| 817 void DownloadItemViewMd::SetDropdownState(State new_state) { | 846 void DownloadItemViewMd::SetDropdownState(State new_state) { |
| 818 // Avoid extra SchedulePaint()s if the state is going to be the same and | 847 // Avoid extra SchedulePaint()s if the state is going to be the same and |
| 819 // |dropdown_button_| has already been initialized. | 848 // |dropdown_button_| has already been initialized. |
| 820 if (dropdown_state_ == new_state && | 849 if (dropdown_state_ == new_state && |
| 821 !dropdown_button_->GetImage(views::CustomButton::STATE_NORMAL).isNull()) | 850 !dropdown_button_->GetImage(views::CustomButton::STATE_NORMAL).isNull()) |
| 822 return; | 851 return; |
| 823 | 852 |
| 824 dropdown_button_->SetIcon( | 853 dropdown_button_->SetIcon( |
| 825 new_state == PUSHED ? gfx::VectorIconId::FIND_NEXT | 854 new_state == PUSHED ? gfx::VectorIconId::FIND_NEXT |
| 826 : gfx::VectorIconId::FIND_PREV, | 855 : gfx::VectorIconId::FIND_PREV, |
| 827 base::Bind(&DownloadItemViewMd::GetTextColor, base::Unretained(this))); | 856 base::Bind(&DownloadItemViewMd::GetTextColor, base::Unretained(this))); |
| 828 dropdown_button_->ink_drop_delegate()->OnAction( | 857 if (new_state != dropdown_state_) { |
| 829 new_state == PUSHED ? views::InkDropState::ACTIVATED | 858 dropdown_button_->ink_drop_delegate()->OnAction( |
| 830 : views::InkDropState::DEACTIVATED); | 859 new_state == PUSHED ? views::InkDropState::ACTIVATED |
| 860 : views::InkDropState::DEACTIVATED); |
| 861 } |
| 831 dropdown_button_->OnThemeChanged(); | 862 dropdown_button_->OnThemeChanged(); |
| 832 dropdown_state_ = new_state; | 863 dropdown_state_ = new_state; |
| 833 SchedulePaint(); | 864 SchedulePaint(); |
| 834 } | 865 } |
| 835 | 866 |
| 836 void DownloadItemViewMd::ToggleWarningDialog() { | 867 void DownloadItemViewMd::ToggleWarningDialog() { |
| 837 if (model_.IsDangerous()) | 868 if (model_.IsDangerous()) |
| 838 ShowWarningDialog(); | 869 ShowWarningDialog(); |
| 839 else | 870 else |
| 840 ClearWarningDialog(); | 871 ClearWarningDialog(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 } | 1097 } |
| 1067 } | 1098 } |
| 1068 | 1099 |
| 1069 void DownloadItemViewMd::ProgressTimerFired() { | 1100 void DownloadItemViewMd::ProgressTimerFired() { |
| 1070 // Only repaint for the indeterminate size case. Otherwise, we'll repaint only | 1101 // Only repaint for the indeterminate size case. Otherwise, we'll repaint only |
| 1071 // when there's an update notified via OnDownloadUpdated(). | 1102 // when there's an update notified via OnDownloadUpdated(). |
| 1072 if (model_.PercentComplete() < 0) | 1103 if (model_.PercentComplete() < 0) |
| 1073 SchedulePaint(); | 1104 SchedulePaint(); |
| 1074 } | 1105 } |
| 1075 | 1106 |
| 1076 SkColor DownloadItemViewMd::GetTextColor() { | 1107 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1077 return GetTextColorForThemeProvider(GetThemeProvider()); | 1108 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1078 } | 1109 } |
| 1079 | 1110 |
| 1080 SkColor DownloadItemViewMd::GetDimmedTextColor() { | 1111 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1081 return SkColorSetA(GetTextColor(), 0xC7); | 1112 return SkColorSetA(GetTextColor(), 0xC7); |
| 1082 } | 1113 } |
| OLD | NEW |