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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 469 void DownloadItemViewMd::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
470 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 470 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
471 // The layer that's added to host the ink drop layer must mask to bounds | 471 // The layer that's added to host the ink drop layer must mask to bounds |
472 // so the hover effect is clipped while animating open. | 472 // so the hover effect is clipped while animating open. |
473 layer()->SetMasksToBounds(true); | 473 layer()->SetMasksToBounds(true); |
474 } | 474 } |
475 | 475 |
476 std::unique_ptr<views::InkDropAnimation> | 476 std::unique_ptr<views::InkDropAnimation> |
477 DownloadItemViewMd::CreateInkDropAnimation() const { | 477 DownloadItemViewMd::CreateInkDropAnimation() const { |
478 return base::WrapUnique(new views::FloodFillInkDropAnimation( | 478 return base::WrapUnique(new views::FloodFillInkDropAnimation( |
479 size(), ink_drop_delegate_.last_ink_drop_location(), | 479 GetLocalBounds(), ink_drop_delegate_.last_ink_drop_location(), |
480 color_utils::DeriveDefaultIconColor(GetTextColor()))); | 480 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
481 } | 481 } |
482 | 482 |
483 std::unique_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() | 483 std::unique_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() |
484 const { | 484 const { |
485 if (IsShowingWarningDialog()) | 485 if (IsShowingWarningDialog()) |
486 return nullptr; | 486 return nullptr; |
487 | 487 |
488 gfx::Size size = GetPreferredSize(); | 488 gfx::Size size = GetPreferredSize(); |
489 return base::WrapUnique(new views::InkDropHover( | 489 return base::WrapUnique(new views::InkDropHover( |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, | 828 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, |
829 bool active_event) { | 829 bool active_event) { |
830 // The event should not activate us in dangerous mode. | 830 // The event should not activate us in dangerous mode. |
831 if (mode_ == DANGEROUS_MODE) | 831 if (mode_ == DANGEROUS_MODE) |
832 return; | 832 return; |
833 | 833 |
834 // Stop any completion animation. | 834 // Stop any completion animation. |
835 if (complete_animation_.get() && complete_animation_->is_animating()) | 835 if (complete_animation_.get() && complete_animation_->is_animating()) |
836 complete_animation_->End(); | 836 complete_animation_->End(); |
837 | 837 |
| 838 // Don't show the ripple for right clicks. |
| 839 if (!active_event) |
| 840 return; |
| 841 |
838 ink_drop_delegate_.set_last_ink_drop_location(event.location()); | 842 ink_drop_delegate_.set_last_ink_drop_location(event.location()); |
839 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); | 843 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); |
840 } | 844 } |
841 | 845 |
842 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, | 846 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, |
843 bool active_event) { | 847 bool active_event) { |
844 // Mouse should not activate us in dangerous mode. | 848 // Mouse should not activate us in dangerous mode. |
845 if (mode_ == DANGEROUS_MODE) | 849 if (mode_ == DANGEROUS_MODE) |
846 return; | 850 return; |
847 | 851 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 SchedulePaint(); | 1117 SchedulePaint(); |
1114 } | 1118 } |
1115 | 1119 |
1116 SkColor DownloadItemViewMd::GetTextColor() const { | 1120 SkColor DownloadItemViewMd::GetTextColor() const { |
1117 return GetTextColorForThemeProvider(GetThemeProvider()); | 1121 return GetTextColorForThemeProvider(GetThemeProvider()); |
1118 } | 1122 } |
1119 | 1123 |
1120 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1124 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
1121 return SkColorSetA(GetTextColor(), 0xC7); | 1125 return SkColorSetA(GetTextColor(), 0xC7); |
1122 } | 1126 } |
OLD | NEW |