| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 SchedulePaint(); | 466 SchedulePaint(); |
| 467 } | 467 } |
| 468 | 468 |
| 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 scoped_ptr<views::InkDropAnimation> DownloadItemViewMd::CreateInkDropAnimation() |
| 477 DownloadItemViewMd::CreateInkDropAnimation() const { | 477 const { |
| 478 return base::WrapUnique(new views::FloodFillInkDropAnimation( | 478 return make_scoped_ptr(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 scoped_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() const { |
| 484 const { | |
| 485 if (IsShowingWarningDialog()) | 484 if (IsShowingWarningDialog()) |
| 486 return nullptr; | 485 return nullptr; |
| 487 | 486 |
| 488 gfx::Size size = GetPreferredSize(); | 487 gfx::Size size = GetPreferredSize(); |
| 489 return base::WrapUnique(new views::InkDropHover( | 488 return make_scoped_ptr(new views::InkDropHover( |
| 490 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), | 489 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), |
| 491 color_utils::DeriveDefaultIconColor(GetTextColor()))); | 490 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
| 492 } | 491 } |
| 493 | 492 |
| 494 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { | 493 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { |
| 495 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 494 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 496 HandlePressEvent(*event, true); | 495 HandlePressEvent(*event, true); |
| 497 event->SetHandled(); | 496 event->SetHandled(); |
| 498 return; | 497 return; |
| 499 } | 498 } |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, | 827 void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event, |
| 829 bool active_event) { | 828 bool active_event) { |
| 830 // The event should not activate us in dangerous mode. | 829 // The event should not activate us in dangerous mode. |
| 831 if (mode_ == DANGEROUS_MODE) | 830 if (mode_ == DANGEROUS_MODE) |
| 832 return; | 831 return; |
| 833 | 832 |
| 834 // Stop any completion animation. | 833 // Stop any completion animation. |
| 835 if (complete_animation_.get() && complete_animation_->is_animating()) | 834 if (complete_animation_.get() && complete_animation_->is_animating()) |
| 836 complete_animation_->End(); | 835 complete_animation_->End(); |
| 837 | 836 |
| 837 // Don't show the ripple for right clicks. |
| 838 if (!active_event) |
| 839 return; |
| 840 |
| 838 ink_drop_delegate_.set_last_ink_drop_location(event.location()); | 841 ink_drop_delegate_.set_last_ink_drop_location(event.location()); |
| 839 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); | 842 ink_drop_delegate_.OnAction(views::InkDropState::ACTION_PENDING); |
| 840 } | 843 } |
| 841 | 844 |
| 842 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, | 845 void DownloadItemViewMd::HandleClickEvent(const ui::LocatedEvent& event, |
| 843 bool active_event) { | 846 bool active_event) { |
| 844 // Mouse should not activate us in dangerous mode. | 847 // Mouse should not activate us in dangerous mode. |
| 845 if (mode_ == DANGEROUS_MODE) | 848 if (mode_ == DANGEROUS_MODE) |
| 846 return; | 849 return; |
| 847 | 850 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 SchedulePaint(); | 1116 SchedulePaint(); |
| 1114 } | 1117 } |
| 1115 | 1118 |
| 1116 SkColor DownloadItemViewMd::GetTextColor() const { | 1119 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1117 return GetTextColorForThemeProvider(GetThemeProvider()); | 1120 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1118 } | 1121 } |
| 1119 | 1122 |
| 1120 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1123 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1121 return SkColorSetA(GetTextColor(), 0xC7); | 1124 return SkColorSetA(GetTextColor(), 0xC7); |
| 1122 } | 1125 } |
| OLD | NEW |