| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "ui/gfx/canvas.h" | 53 #include "ui/gfx/canvas.h" |
| 54 #include "ui/gfx/color_palette.h" | 54 #include "ui/gfx/color_palette.h" |
| 55 #include "ui/gfx/color_utils.h" | 55 #include "ui/gfx/color_utils.h" |
| 56 #include "ui/gfx/image/image.h" | 56 #include "ui/gfx/image/image.h" |
| 57 #include "ui/gfx/paint_vector_icon.h" | 57 #include "ui/gfx/paint_vector_icon.h" |
| 58 #include "ui/gfx/text_elider.h" | 58 #include "ui/gfx/text_elider.h" |
| 59 #include "ui/gfx/text_utils.h" | 59 #include "ui/gfx/text_utils.h" |
| 60 #include "ui/gfx/vector_icons_public.h" | 60 #include "ui/gfx/vector_icons_public.h" |
| 61 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 61 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 62 #include "ui/views/animation/ink_drop_delegate.h" | 62 #include "ui/views/animation/ink_drop_delegate.h" |
| 63 #include "ui/views/animation/ink_drop_hover.h" | 63 #include "ui/views/animation/ink_drop_highlight.h" |
| 64 #include "ui/views/border.h" | 64 #include "ui/views/border.h" |
| 65 #include "ui/views/controls/button/image_button.h" | 65 #include "ui/views/controls/button/image_button.h" |
| 66 #include "ui/views/controls/button/md_text_button.h" | 66 #include "ui/views/controls/button/md_text_button.h" |
| 67 #include "ui/views/controls/label.h" | 67 #include "ui/views/controls/label.h" |
| 68 #include "ui/views/mouse_constants.h" | 68 #include "ui/views/mouse_constants.h" |
| 69 #include "ui/views/widget/root_view.h" | 69 #include "ui/views/widget/root_view.h" |
| 70 #include "ui/views/widget/widget.h" | 70 #include "ui/views/widget/widget.h" |
| 71 | 71 |
| 72 using content::DownloadItem; | 72 using content::DownloadItem; |
| 73 using extensions::ExperienceSamplingEvent; | 73 using extensions::ExperienceSamplingEvent; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 layer()->SetMasksToBounds(true); | 472 layer()->SetMasksToBounds(true); |
| 473 } | 473 } |
| 474 | 474 |
| 475 std::unique_ptr<views::InkDropRipple> DownloadItemViewMd::CreateInkDropRipple() | 475 std::unique_ptr<views::InkDropRipple> DownloadItemViewMd::CreateInkDropRipple() |
| 476 const { | 476 const { |
| 477 return base::WrapUnique(new views::FloodFillInkDropRipple( | 477 return base::WrapUnique(new views::FloodFillInkDropRipple( |
| 478 GetLocalBounds(), ink_drop_delegate_.last_ink_drop_location(), | 478 GetLocalBounds(), ink_drop_delegate_.last_ink_drop_location(), |
| 479 color_utils::DeriveDefaultIconColor(GetTextColor()))); | 479 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
| 480 } | 480 } |
| 481 | 481 |
| 482 std::unique_ptr<views::InkDropHover> DownloadItemViewMd::CreateInkDropHover() | 482 std::unique_ptr<views::InkDropHighlight> |
| 483 const { | 483 DownloadItemViewMd::CreateInkDropHighlight() const { |
| 484 if (IsShowingWarningDialog()) | 484 if (IsShowingWarningDialog()) |
| 485 return nullptr; | 485 return nullptr; |
| 486 | 486 |
| 487 gfx::Size size = GetPreferredSize(); | 487 gfx::Size size = GetPreferredSize(); |
| 488 return base::WrapUnique(new views::InkDropHover( | 488 return base::WrapUnique(new views::InkDropHighlight( |
| 489 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), | 489 size, kInkDropSmallCornerRadius, gfx::Rect(size).CenterPoint(), |
| 490 color_utils::DeriveDefaultIconColor(GetTextColor()))); | 490 color_utils::DeriveDefaultIconColor(GetTextColor()))); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { | 493 void DownloadItemViewMd::OnGestureEvent(ui::GestureEvent* event) { |
| 494 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 494 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 495 HandlePressEvent(*event, true); | 495 HandlePressEvent(*event, true); |
| 496 event->SetHandled(); | 496 event->SetHandled(); |
| 497 return; | 497 return; |
| 498 } | 498 } |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 SchedulePaint(); | 1114 SchedulePaint(); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 SkColor DownloadItemViewMd::GetTextColor() const { | 1117 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1118 return GetTextColorForThemeProvider(GetThemeProvider()); | 1118 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1121 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1122 return SkColorSetA(GetTextColor(), 0xC7); | 1122 return SkColorSetA(GetTextColor(), 0xC7); |
| 1123 } | 1123 } |
| OLD | NEW |