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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments #18-21 Created 5 years, 2 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
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 71adb8355ef636cdc07f1de89521c80a5813a689..aa5621c5dcbae101cf01156c7b1b298cd4b2610b 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -265,6 +265,7 @@
#if defined(ENABLE_MEDIA_ROUTER)
#include "chrome/browser/media/router/presentation_service_delegate_impl.h"
+#include "chrome/browser/media/router/receiver_presentation_service_delegate_impl.h"
#endif
using base::FileDescriptor;
@@ -2594,8 +2595,19 @@ content::PresentationServiceDelegate*
ChromeContentBrowserClient::GetPresentationServiceDelegate(
content::WebContents* web_contents) {
#if defined(ENABLE_MEDIA_ROUTER)
- if (switches::MediaRouterEnabled() &&
- !web_contents->GetBrowserContext()->IsOffTheRecord()) {
+ if (switches::MediaRouterEnabled()) {
+ // ReceiverPresentationServiceDelegateImpl are for WebContents created for
+ // offscreen presentations. The WebContents is from an incognito profile.
+ if (auto* impl = media_router::ReceiverPresentationServiceDelegateImpl::
+ FromWebContents(web_contents)) {
+ DCHECK(web_contents->GetBrowserContext()->IsOffTheRecord());
+ return impl;
+ }
+ // TODO(imcheng): Presentation API is disabled in incognito mode for the
+ // time being. crbug.com/524795
+ if (web_contents->GetBrowserContext()->IsOffTheRecord())
+ return nullptr;
+
return media_router::PresentationServiceDelegateImpl::
GetOrCreateForWebContents(web_contents);
}

Powered by Google App Engine
This is Rietveld 408576698