Chromium Code Reviews| Index: chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc |
| diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc |
| index fbc8f56a2f4be05b77fa0aa65cc4bb578a370e33..fde9b91683eff3551cc0f5ab1d56e03b414fd6af 100644 |
| --- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc |
| +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc |
| @@ -75,13 +75,36 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( |
| if (screen_list) { |
| source_types_.push_back(DesktopMediaID::TYPE_SCREEN); |
| + const DesktopMediaSourceViewStyle kSingleScreenStyle( |
|
msw
2016/05/20 23:26:36
Hard-coding all these values is a fairly strange a
qiangchen
2016/05/24 00:03:37
My understanding of the different styles is:
For
|
| + 1, // columns |
| + gfx::Size(360, 280), // item_size |
| + gfx::Rect(20, 220, 320, 40), // label_position |
|
msw
2016/05/20 23:26:37
Does this work well enough for internationalizatio
qiangchen
2016/05/24 00:03:37
It should work, as I use the same height, and not
|
| + gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment |
| + gfx::Rect(20, 20, 320, 200), // image_position |
| + 2, // selection_border_thickness |
| + 5, // paint_inset_horizontal |
| + 5); // paint_inset_vertical |
| + |
| + const DesktopMediaSourceViewStyle kGenericScreenStyle( |
| + 2, // columns |
| + gfx::Size(270, 220), // item_size |
| + gfx::Rect(15, 165, 240, 40), // label_position |
| + gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment |
| + gfx::Rect(15, 15, 240, 150), // image_position |
| + 2, // selection_border_thickness |
| + 5, // paint_inset_horizontal |
| + 5); // paint_inset_vertical |
| + |
| views::ScrollView* screen_scroll_view = |
| views::ScrollView::CreateScrollViewWithBorder(); |
| - list_views_.push_back( |
| - new DesktopMediaListView(this, std::move(screen_list))); |
| + list_views_.push_back(new DesktopMediaListView( |
| + this, std::move(screen_list), kSingleScreenStyle, kGenericScreenStyle)); |
| screen_scroll_view->SetContents(list_views_.back()); |
| - screen_scroll_view->ClipHeightTo(kListItemHeight, kListItemHeight * 2); |
| + screen_scroll_view->ClipHeightTo( |
| + kGenericScreenStyle.item_size.height(), |
| + kGenericScreenStyle.item_size.height() * 2); |
| + screen_scroll_view->set_hide_horizontal_scrollbar(true); |
|
msw
2016/05/20 23:26:36
Does this mean that we're overflowing the availabl
qiangchen
2016/05/24 00:03:37
Actually the sizes are guaranteed not to overflow.
msw
2016/05/24 18:54:25
I mentioned that calling SetSize in Layout seems w
qiangchen
2016/05/25 16:24:08
Without set_hide_horizontal_scrollbar here and Set
|
| pane_->AddTab( |
| l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_SCREEN), |
| screen_scroll_view); |
| @@ -90,13 +113,26 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( |
| if (window_list) { |
| source_types_.push_back(DesktopMediaID::TYPE_WINDOW); |
| + |
| + const DesktopMediaSourceViewStyle kWindowStyle( |
| + 3, // columns |
| + gfx::Size(180, 160), // item_size |
| + gfx::Rect(10, 110, 160, 40), // label_position |
| + gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment |
| + gfx::Rect(8, 8, 164, 104), // image_position |
| + 2, // selection_border_thickness |
| + 5, // paint_inset_horizontal |
| + 5); // paint_inset_vertical |
| + |
| views::ScrollView* window_scroll_view = |
| views::ScrollView::CreateScrollViewWithBorder(); |
| - list_views_.push_back( |
| - new DesktopMediaListView(this, std::move(window_list))); |
| + list_views_.push_back(new DesktopMediaListView(this, std::move(window_list), |
| + kWindowStyle, kWindowStyle)); |
| window_scroll_view->SetContents(list_views_.back()); |
| - window_scroll_view->ClipHeightTo(kListItemHeight, kListItemHeight * 2); |
| + window_scroll_view->ClipHeightTo(kWindowStyle.item_size.height(), |
| + kWindowStyle.item_size.height() * 2); |
| + window_scroll_view->set_hide_horizontal_scrollbar(true); |
| pane_->AddTab( |
| l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_WINDOW), |
| @@ -106,12 +142,26 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( |
| if (tab_list) { |
| source_types_.push_back(DesktopMediaID::TYPE_WEB_CONTENTS); |
| + |
| + const DesktopMediaSourceViewStyle kTabStyle( |
| + 1, // columns |
| + gfx::Size(600, 30), // item_size |
| + gfx::Rect(46, 0, 490, 30), // label_position |
| + gfx::HorizontalAlignment::ALIGN_LEFT, // text_alignment |
| + gfx::Rect(10, 2, 26, 26), // image_position |
| + 1, // selection_border_thickness |
| + 0, // paint_inset_horizontal |
| + 0); // paint_inset_vertical |
| + |
| views::ScrollView* tab_scroll_view = |
| views::ScrollView::CreateScrollViewWithBorder(); |
| - list_views_.push_back(new DesktopMediaListView(this, std::move(tab_list))); |
| + list_views_.push_back(new DesktopMediaListView(this, std::move(tab_list), |
| + kTabStyle, kTabStyle)); |
| tab_scroll_view->SetContents(list_views_.back()); |
| - tab_scroll_view->ClipHeightTo(kListItemHeight, kListItemHeight * 2); |
| + tab_scroll_view->ClipHeightTo(kTabStyle.item_size.height(), |
| + kTabStyle.item_size.height() * 2); |
| + tab_scroll_view->set_hide_horizontal_scrollbar(true); |
| pane_->AddTab( |
| l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_TAB), |