Skip to content

Commit

Permalink
Reverse the order of media-picker dialog-tabs for gCBCM
Browse files Browse the repository at this point in the history
gCBCM = getCurrentBrowsingContextMedia
Reverse the order of the dialog-tabs, so that they would be, left to right:
This Tab, Other Tab, Window, Entire Screen.

(cherry picked from commit cc73417)

Bug: 1184908, 1136942
Change-Id: I54831a203b4ae9f72305802c92753e05e507cf1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2736980
Auto-Submit: Elad Alon <eladalon@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#860149}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2740915
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4430@{#195}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
Elad Alon authored and Chromium LUCI CQ committed Mar 6, 2021
1 parent 2cb4166 commit 55949b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
20 changes: 12 additions & 8 deletions chrome/browser/media/webrtc/display_media_access_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,18 @@ void DisplayMediaAccessHandler::ProcessQueuedAccessRequest(
const PendingAccessRequest& pending_request = *queue.front();
UpdateTrusted(pending_request.request, false /* is_trusted */);

std::vector<DesktopMediaList::Type> media_types = {
DesktopMediaList::Type::kScreen, DesktopMediaList::Type::kWindow,
DesktopMediaList::Type::kWebContents};
std::vector<DesktopMediaList::Type> media_types;
if (pending_request.request.video_type ==
blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB) {
media_types = {DesktopMediaList::Type::kCurrentTab,
DesktopMediaList::Type::kWebContents,
DesktopMediaList::Type::kWindow,
DesktopMediaList::Type::kScreen};
} else {
media_types = {DesktopMediaList::Type::kScreen,
DesktopMediaList::Type::kWindow,
DesktopMediaList::Type::kWebContents};
}

// Avoid offering window-capture as a separate source, since PipeWire's
// content-picker will offer both screen and window sources.
Expand All @@ -225,11 +234,6 @@ void DisplayMediaAccessHandler::ProcessQueuedAccessRequest(
base::Erase(media_types, DesktopMediaList::Type::kWindow);
}

if (pending_request.request.video_type ==
blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB) {
media_types.push_back(DesktopMediaList::Type::kCurrentTab);
}

auto source_lists =
picker_factory_->CreateMediaList(media_types, web_contents);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
? DialogSource::kGetCurrentBrowsingContextMedia
: DialogSource::kGetDisplayMedia;

int selected_tab = 0;

for (auto& source_list : source_lists) {
switch (source_list->GetMediaListType()) {
case DesktopMediaList::Type::kNone: {
Expand Down Expand Up @@ -316,7 +314,6 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
break;
}
case DesktopMediaList::Type::kCurrentTab: {
selected_tab = source_types_.size();
source_types_.push_back(DesktopMediaList::Type::kCurrentTab);
const DesktopMediaSourceViewStyle kCurrentTabStyle(
1, // columns
Expand Down Expand Up @@ -368,11 +365,7 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(

DCHECK(!source_types_.empty());

// Focus on the correct dialog-tab.
OnSourceTypeSwitched(selected_tab);
if (tabbed_pane_) {
tabbed_pane_->SelectTabAt(selected_tab);
}
OnSourceTypeSwitched(0);

// If |params.web_contents| is set and it's not a background page then the
// picker will be shown modal to the web contents. Otherwise the picker is
Expand Down

0 comments on commit 55949b8

Please sign in to comment.