| Index: chrome/browser/ui/views/desktop_media_picker_views.cc
|
| diff --git a/chrome/browser/ui/views/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_media_picker_views.cc
|
| index 2614f56088103a2849e8d0ee12042d020ab0c801..6ede50b751c6b47fb28ae53318bf952a9d09475a 100644
|
| --- a/chrome/browser/ui/views/desktop_media_picker_views.cc
|
| +++ b/chrome/browser/ui/views/desktop_media_picker_views.cc
|
| @@ -28,6 +28,7 @@
|
| #include "ui/native_theme/native_theme.h"
|
| #include "ui/views/background.h"
|
| #include "ui/views/bubble/bubble_frame_view.h"
|
| +#include "ui/views/controls/button/checkbox.h"
|
| #include "ui/views/controls/image_view.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/controls/scroll_view.h"
|
| @@ -388,10 +389,12 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
|
| DesktopMediaPickerViews* parent,
|
| const base::string16& app_name,
|
| const base::string16& target_name,
|
| - scoped_ptr<DesktopMediaList> media_list)
|
| + scoped_ptr<DesktopMediaList> media_list,
|
| + bool request_audio)
|
| : parent_(parent),
|
| app_name_(app_name),
|
| label_(new views::Label()),
|
| + checkbox_(nullptr),
|
| scroll_view_(views::ScrollView::CreateScrollViewWithBorder()),
|
| list_view_(new DesktopMediaListView(this, std::move(media_list))) {
|
| if (app_name == target_name) {
|
| @@ -405,6 +408,12 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
|
| label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
|
| AddChildView(label_);
|
|
|
| + if (request_audio) {
|
| + checkbox_ = new views::Checkbox(
|
| + l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_AUDIO_SHARE));
|
| + AddChildView(checkbox_);
|
| + }
|
| +
|
| scroll_view_->SetContents(list_view_);
|
| scroll_view_->ClipHeightTo(
|
| GetMediaListViewHeightForRows(1), GetMediaListViewHeightForRows(2));
|
| @@ -461,9 +470,12 @@ gfx::Size DesktopMediaPickerDialogView::GetPreferredSize() const {
|
| size_t label_height =
|
| label_->GetHeightForWidth(kDialogViewWidth - title_insets.height() * 2);
|
|
|
| + size_t checkbox_height =
|
| + checkbox_ ? checkbox_->GetPreferredSize().height() : 0;
|
| +
|
| return gfx::Size(kDialogViewWidth,
|
| views::kPanelVertMargin * 2 + label_height +
|
| - views::kPanelVerticalSpacing +
|
| + checkbox_height + views::kPanelVerticalSpacing +
|
| scroll_view_->GetPreferredSize().height());
|
| }
|
|
|
| @@ -478,6 +490,13 @@ void DesktopMediaPickerDialogView::Layout() {
|
| label_->GetHeightForWidth(rect.width()));
|
| label_->SetBoundsRect(label_rect);
|
|
|
| + if (checkbox_) {
|
| + gfx::Rect checkbox_rect(
|
| + rect.x(), label_rect.bottom() + views::kPanelVertMargin, rect.width(),
|
| + checkbox_->GetHeightForWidth(rect.width()));
|
| + checkbox_->SetBoundsRect(checkbox_rect);
|
| + }
|
| +
|
| int scroll_view_top = label_rect.bottom() + views::kPanelVerticalSpacing;
|
| scroll_view_->SetBounds(
|
| rect.x(), scroll_view_top,
|
| @@ -519,6 +538,10 @@ bool DesktopMediaPickerDialogView::Accept() {
|
| if (selection)
|
| source = selection->source_id();
|
|
|
| + if (checkbox_) {
|
| + source.audio_share = checkbox_->checked();
|
| + }
|
| +
|
| if (parent_)
|
| parent_->NotifyDialogResult(source);
|
|
|
| @@ -580,11 +603,12 @@ void DesktopMediaPickerViews::Show(content::WebContents* web_contents,
|
| const base::string16& app_name,
|
| const base::string16& target_name,
|
| scoped_ptr<DesktopMediaList> media_list,
|
| + bool request_audio,
|
| const DoneCallback& done_callback) {
|
| callback_ = done_callback;
|
| - dialog_ =
|
| - new DesktopMediaPickerDialogView(web_contents, context, this, app_name,
|
| - target_name, std::move(media_list));
|
| + dialog_ = new DesktopMediaPickerDialogView(
|
| + web_contents, context, this, app_name, target_name, std::move(media_list),
|
| + request_audio);
|
| }
|
|
|
| void DesktopMediaPickerViews::NotifyDialogResult(DesktopMediaID source) {
|
|
|