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

Side by Side Diff: third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 WebMediaPlayerClient* client) { 780 WebMediaPlayerClient* client) {
781 WebLocalFrameImpl* webFrame = 781 WebLocalFrameImpl* webFrame =
782 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame()); 782 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame());
783 783
784 if (!webFrame || !webFrame->client()) 784 if (!webFrame || !webFrame->client())
785 return nullptr; 785 return nullptr;
786 786
787 HTMLMediaElementEncryptedMedia& encryptedMedia = 787 HTMLMediaElementEncryptedMedia& encryptedMedia =
788 HTMLMediaElementEncryptedMedia::from(htmlMediaElement); 788 HTMLMediaElementEncryptedMedia::from(htmlMediaElement);
789 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); 789 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement));
790 return wrapUnique(webFrame->client()->createMediaPlayer( 790 std::unique_ptr<WebMediaPlayer> mediaPlayer =
791 source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), 791 wrapUnique(webFrame->client()->createMediaPlayer(
792 sinkId)); 792 source, client, &encryptedMedia,
793 encryptedMedia.contentDecryptionModule(), sinkId));
794
795 // Notify WebMediaPlayer: if the current media is active fullscreen element;
796 // or is a descendant of the fullscreen element and covers most of the window.
797 Element* fullscreenElement =
798 Fullscreen::currentFullScreenElementFrom(htmlMediaElement.document());
799 if (fullscreenElement == htmlMediaElement) {
800 mediaPlayer->enteredFullscreen();
foolip 2016/10/11 09:37:13 Does the case where the media element itself is th
xjz 2016/10/11 19:27:25 It's currently handled same for Media Remoting.
foolip 2016/10/12 11:51:42 Yes, but wouldn't it be covered by any heuristic u
xjz 2016/10/12 17:40:57 The heuristic used for when the fullscreen element
801 } else if (fullscreenElement->contains(&htmlMediaElement) &&
802 htmlMediaElement.clientWidth() >=
803 htmlMediaElement.document().domWindow()->innerWidth() * 0.9 &&
foolip 2016/10/11 09:37:13 This check could pass for two videos where one obs
xjz 2016/10/11 19:27:26 Yes, it could be. I think this case is not common
804 htmlMediaElement.clientHeight() >=
805 htmlMediaElement.document().domWindow()->innerHeight() * 0.9) {
806 mediaPlayer->enterFullWindow();
807 }
808
809 return mediaPlayer;
793 } 810 }
794 811
795 ObjectContentType FrameLoaderClientImpl::getObjectContentType( 812 ObjectContentType FrameLoaderClientImpl::getObjectContentType(
796 const KURL& url, 813 const KURL& url,
797 const String& explicitMimeType, 814 const String& explicitMimeType,
798 bool shouldPreferPlugInsForImages) { 815 bool shouldPreferPlugInsForImages) {
799 // This code is based on Apple's implementation from 816 // This code is based on Apple's implementation from
800 // WebCoreSupport/WebFrameBridge.mm. 817 // WebCoreSupport/WebFrameBridge.mm.
801 818
802 String mimeType = explicitMimeType; 819 String mimeType = explicitMimeType;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() { 1008 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() {
992 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) 1009 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot())
993 ->devToolsAgentImpl(); 1010 ->devToolsAgentImpl();
994 } 1011 }
995 1012
996 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1013 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
997 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1014 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
998 } 1015 }
999 1016
1000 } // namespace blink 1017 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698