Chromium Code Reviews| Index: chrome/browser/ui/views/desktop_capture/desktop_media_source_view.cc |
| diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.cc |
| index 0731c5cef44efcef5b212f2fce76694a5795503a..b9db3015518606d7d0dfa85aefebdff2593cb3ad 100644 |
| --- a/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.cc |
| +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_source_view.cc |
| @@ -23,6 +23,7 @@ DesktopMediaSourceViewStyle::DesktopMediaSourceViewStyle( |
| DesktopMediaSourceViewStyle::DesktopMediaSourceViewStyle( |
| int columns, |
| const gfx::Size& item_size, |
| + const gfx::Rect& icon_rect, |
| const gfx::Rect& label_rect, |
| gfx::HorizontalAlignment text_alignment, |
| const gfx::Rect& image_rect, |
| @@ -30,6 +31,7 @@ DesktopMediaSourceViewStyle::DesktopMediaSourceViewStyle( |
| int focus_rectangle_inset) |
| : columns(columns), |
| item_size(item_size), |
| + icon_rect(icon_rect), |
| label_rect(label_rect), |
| text_alignment(text_alignment), |
| image_rect(image_rect), |
| @@ -43,12 +45,15 @@ DesktopMediaSourceView::DesktopMediaSourceView( |
| : parent_(parent), |
| source_id_(source_id), |
| style_(style), |
| + icon_view_(new views::ImageView()), |
| image_view_(new views::ImageView()), |
| label_(new views::Label()), |
| selected_(false) { |
| + AddChildView(icon_view_); |
| AddChildView(image_view_); |
| AddChildView(label_); |
| image_view_->set_interactive(false); |
| + icon_view_->set_interactive(false); |
|
msw
2016/08/23 21:37:12
nit: order before image_view_->set_interactive(fal
qiangchen
2016/08/23 23:24:30
Done.
|
| SetFocusBehavior(FocusBehavior::ALWAYS); |
| SetStyle(style_); |
| } |
| @@ -66,6 +71,10 @@ void DesktopMediaSourceView::SetThumbnail(const gfx::ImageSkia& thumbnail) { |
| image_view_->SetImage(thumbnail); |
| } |
| +void DesktopMediaSourceView::SetIcon(const gfx::ImageSkia& icon) { |
| + icon_view_->SetImage(icon); |
| +} |
| + |
| void DesktopMediaSourceView::SetSelected(bool selected) { |
| if (selected == selected_) |
| return; |
| @@ -127,6 +136,9 @@ void DesktopMediaSourceView::SetStyle(DesktopMediaSourceViewStyle style) { |
| image_view_->SetBorder(views::Border::CreateSolidBorder( |
| style_.selection_border_thickness, border_color)); |
| } |
| + icon_view_->SetBoundsRect(style_.icon_rect); |
| + icon_view_->SetImageSize(gfx::Size(style_.icon_rect.width(), |
|
msw
2016/08/23 21:37:12
nit: icon_view_->SetImageSize(style_.icon_rect.siz
qiangchen
2016/08/23 23:24:30
Done.
|
| + style_.icon_rect.height())); |
| label_->SetBoundsRect(style_.label_rect); |
| label_->SetHorizontalAlignment(style_.text_alignment); |
| } |