Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2564)

Unified Diff: chrome/browser/ui/views/desktop_media_picker_views.cc

Issue 1805583002: For Desktop tab sharing, activate selected inactive tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfa7b0ffbbe4a85ea0d2552298547c8f7894edab..04f5c84b71a8fe54cd5f0e3057b62b532ac5edc3 100644
--- a/chrome/browser/ui/views/desktop_media_picker_views.cc
+++ b/chrome/browser/ui/views/desktop_media_picker_views.cc
@@ -18,6 +18,7 @@
#include "components/constrained_window/constrained_window_views.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents_delegate.h"
#include "grit/components_strings.h"
#include "ui/aura/window_tree_host.h"
@@ -514,15 +515,21 @@ bool DesktopMediaPickerDialogView::Accept() {
// Ok button should only be enabled when a source is selected.
DCHECK(selection);
-
- DesktopMediaID source;
- if (selection)
- source = selection->source_id();
-
+ DesktopMediaID source = selection->source_id();
source.audio_share = audio_share_checkbox_ &&
audio_share_checkbox_->enabled() &&
audio_share_checkbox_->checked();
+ // If the media source is an tab, activate it.
+ if (source.type == DesktopMediaID::TYPE_WEB_CONTENTS) {
+ content::WebContents* tab = content::WebContents::FromRenderFrameHost(
+ content::RenderFrameHost::FromID(
+ source.web_contents_id.render_process_id,
+ source.web_contents_id.main_render_frame_id));
+ if (tab)
+ tab->GetDelegate()->ActivateContents(tab);
+ }
+
if (parent_)
parent_->NotifyDialogResult(source);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698