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

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

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Rebased. Add FullscreenObserver. 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();
801 } else if (fullscreenElement &&
802 fullscreenElement->isShadowIncludingInclusiveAncestorOf(
803 &htmlMediaElement) &&
804 htmlMediaElement.clientWidth() >=
805 htmlMediaElement.document().domWindow()->innerWidth() * 0.9 &&
806 htmlMediaElement.clientHeight() >=
807 htmlMediaElement.document().domWindow()->innerHeight() * 0.9) {
808 mediaPlayer->enteredFullWindow();
809 }
810
811 return mediaPlayer;
793 } 812 }
794 813
795 ObjectContentType FrameLoaderClientImpl::getObjectContentType( 814 ObjectContentType FrameLoaderClientImpl::getObjectContentType(
796 const KURL& url, 815 const KURL& url,
797 const String& explicitMimeType, 816 const String& explicitMimeType,
798 bool shouldPreferPlugInsForImages) { 817 bool shouldPreferPlugInsForImages) {
799 // This code is based on Apple's implementation from 818 // This code is based on Apple's implementation from
800 // WebCoreSupport/WebFrameBridge.mm. 819 // WebCoreSupport/WebFrameBridge.mm.
801 820
802 String mimeType = explicitMimeType; 821 String mimeType = explicitMimeType;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() { 1010 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() {
992 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) 1011 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot())
993 ->devToolsAgentImpl(); 1012 ->devToolsAgentImpl();
994 } 1013 }
995 1014
996 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1015 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
997 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1016 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
998 } 1017 }
999 1018
1000 } // namespace blink 1019 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/public/platform/WebMediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698