Chromium Code Reviews| 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..2b5fe680350b26a0f5f7f73ca31512f6e712fd92 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,10 +2595,22 @@ content::PresentationServiceDelegate* |
| ChromeContentBrowserClient::GetPresentationServiceDelegate( |
| content::WebContents* web_contents) { |
| #if defined(ENABLE_MEDIA_ROUTER) |
| - if (switches::MediaRouterEnabled() && |
| - !web_contents->GetBrowserContext()->IsOffTheRecord()) { |
| - return media_router::PresentationServiceDelegateImpl:: |
| - GetOrCreateForWebContents(web_contents); |
| + 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; |
| + } else { |
|
whywhat
2015/10/13 15:21:30
nit: I believe
if (a)
return b;
else
return c
imcheng
2015/10/17 01:00:22
Done.
|
| + return media_router::PresentationServiceDelegateImpl:: |
| + GetOrCreateForWebContents(web_contents); |
| + } |
| } |
| #endif |
| return nullptr; |