| 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.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ripple.h" | 60 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 61 #include "ui/views/animation/ink_drop_highlight.h" | 61 #include "ui/views/animation/ink_drop_highlight.h" |
| 62 #include "ui/views/animation/ink_drop_impl.h" |
| 62 #include "ui/views/border.h" | 63 #include "ui/views/border.h" |
| 63 #include "ui/views/controls/button/md_text_button.h" | 64 #include "ui/views/controls/button/md_text_button.h" |
| 64 #include "ui/views/controls/button/vector_icon_button.h" | 65 #include "ui/views/controls/button/vector_icon_button.h" |
| 65 #include "ui/views/controls/focusable_border.h" | 66 #include "ui/views/controls/focusable_border.h" |
| 66 #include "ui/views/controls/label.h" | 67 #include "ui/views/controls/label.h" |
| 67 #include "ui/views/mouse_constants.h" | 68 #include "ui/views/mouse_constants.h" |
| 68 #include "ui/views/widget/root_view.h" | 69 #include "ui/views/widget/root_view.h" |
| 69 #include "ui/views/widget/widget.h" | 70 #include "ui/views/widget/widget.h" |
| 70 | 71 |
| 71 using content::DownloadItem; | 72 using content::DownloadItem; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 creation_time_(base::Time::Now()), | 189 creation_time_(base::Time::Now()), |
| 189 time_download_warning_shown_(base::Time()), | 190 time_download_warning_shown_(base::Time()), |
| 190 weak_ptr_factory_(this) { | 191 weak_ptr_factory_(this) { |
| 191 SetInkDropMode(InkDropMode::ON); | 192 SetInkDropMode(InkDropMode::ON); |
| 192 DCHECK(download()); | 193 DCHECK(download()); |
| 193 download()->AddObserver(this); | 194 download()->AddObserver(this); |
| 194 set_context_menu_controller(this); | 195 set_context_menu_controller(this); |
| 195 | 196 |
| 196 dropdown_button_->SetBorder( | 197 dropdown_button_->SetBorder( |
| 197 views::Border::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth))); | 198 views::Border::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth))); |
| 198 dropdown_button_->set_ink_drop_size(gfx::Size(32, 32)); | |
| 199 AddChildView(dropdown_button_); | 199 AddChildView(dropdown_button_); |
| 200 | 200 |
| 201 LoadIcon(); | 201 LoadIcon(); |
| 202 | 202 |
| 203 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 203 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 204 font_list_ = | 204 font_list_ = |
| 205 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); | 205 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); |
| 206 status_font_list_ = | 206 status_font_list_ = |
| 207 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); | 207 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); |
| 208 | 208 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 SchedulePaint(); | 484 SchedulePaint(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void DownloadItemView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 487 void DownloadItemView::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 488 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 488 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
| 489 // The layer that's added to host the ink drop layer must mask to bounds | 489 // The layer that's added to host the ink drop layer must mask to bounds |
| 490 // so the hover effect is clipped while animating open. | 490 // so the hover effect is clipped while animating open. |
| 491 layer()->SetMasksToBounds(true); | 491 layer()->SetMasksToBounds(true); |
| 492 } | 492 } |
| 493 | 493 |
| 494 std::unique_ptr<views::InkDrop> DownloadItemView::CreateInkDrop() { |
| 495 return CreateDefaultFloodFillInkDropImpl(); |
| 496 } |
| 497 |
| 494 std::unique_ptr<views::InkDropRipple> DownloadItemView::CreateInkDropRipple() | 498 std::unique_ptr<views::InkDropRipple> DownloadItemView::CreateInkDropRipple() |
| 495 const { | 499 const { |
| 496 return base::MakeUnique<views::FloodFillInkDropRipple>( | 500 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 497 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), | 501 GetLocalBounds(), GetInkDropCenterBasedOnLastEvent(), |
| 498 color_utils::DeriveDefaultIconColor(GetTextColor()), | 502 color_utils::DeriveDefaultIconColor(GetTextColor()), |
| 499 ink_drop_visible_opacity()); | 503 ink_drop_visible_opacity()); |
| 500 } | 504 } |
| 501 | 505 |
| 502 std::unique_ptr<views::InkDropHighlight> | 506 std::unique_ptr<views::InkDropHighlight> |
| 503 DownloadItemView::CreateInkDropHighlight() const { | 507 DownloadItemView::CreateInkDropHighlight() const { |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 SchedulePaint(); | 1111 SchedulePaint(); |
| 1108 } | 1112 } |
| 1109 | 1113 |
| 1110 SkColor DownloadItemView::GetTextColor() const { | 1114 SkColor DownloadItemView::GetTextColor() const { |
| 1111 return GetTextColorForThemeProvider(GetThemeProvider()); | 1115 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1112 } | 1116 } |
| 1113 | 1117 |
| 1114 SkColor DownloadItemView::GetDimmedTextColor() const { | 1118 SkColor DownloadItemView::GetDimmedTextColor() const { |
| 1115 return SkColorSetA(GetTextColor(), 0xC7); | 1119 return SkColorSetA(GetTextColor(), 0xC7); |
| 1116 } | 1120 } |
| OLD | NEW |