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

Unified Diff: chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm

Issue 1812543002: For desktop tab sharing in mac, activate selected 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/cocoa/media_picker/desktop_media_picker_controller.mm
diff --git a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
index 673f8b5f2dc34f03c91d1debbd54b696773c7a4e..52539a80d120a5c995ee272a97fb75c7e3cf62ee 100644
--- a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
+++ b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
@@ -15,6 +15,9 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_delegate.h"
#include "grit/components_strings.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#import "ui/base/cocoa/flipped_view.h"
@@ -225,6 +228,16 @@ const int kExcessButtonPadding = 6;
sourceID.audio_share = [audioShareCheckbox_ isEnabled] &&
[audioShareCheckbox_ state] == NSOnState;
+ // If the media source is an tab, activate it.
+ if (sourceID.type == content::DesktopMediaID::TYPE_WEB_CONTENTS) {
+ content::WebContents* tab = content::WebContents::FromRenderFrameHost(
+ content::RenderFrameHost::FromID(
+ sourceID.web_contents_id.render_process_id,
+ sourceID.web_contents_id.main_render_frame_id));
+ if (tab)
+ tab->GetDelegate()->ActivateContents(tab);
+ }
+
// Notify the |callback_| asynchronously because it may release the
// controller.
content::BrowserThread::PostTask(
« 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