| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; | 468 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; |
| 469 | 469 |
| 470 // If any experiment is enabled, then we want to enable a user gesture by | 470 // If any experiment is enabled, then we want to enable a user gesture by |
| 471 // default, otherwise the experiment does nothing. | 471 // default, otherwise the experiment does nothing. |
| 472 if ((document.settings() && | 472 if ((document.settings() && |
| 473 document.settings()->mediaPlaybackRequiresUserGesture()) || | 473 document.settings()->mediaPlaybackRequiresUserGesture()) || |
| 474 m_autoplayHelper->isExperimentEnabled()) { | 474 m_autoplayHelper->isExperimentEnabled()) { |
| 475 m_lockedPendingUserGesture = true; | 475 m_lockedPendingUserGesture = true; |
| 476 } | 476 } |
| 477 | 477 |
| 478 LocalFrame* frame = document.frame(); |
| 479 if (frame) { |
| 480 m_remotePlaybackClient = |
| 481 frame->loader().client()->createWebRemotePlaybackClient(*this); |
| 482 } |
| 483 |
| 478 setHasCustomStyleCallbacks(); | 484 setHasCustomStyleCallbacks(); |
| 479 addElementToDocumentMap(this, &document); | 485 addElementToDocumentMap(this, &document); |
| 480 | 486 |
| 481 UseCounter::count(document, UseCounter::HTMLMediaElement); | 487 UseCounter::count(document, UseCounter::HTMLMediaElement); |
| 482 } | 488 } |
| 483 | 489 |
| 484 HTMLMediaElement::~HTMLMediaElement() { | 490 HTMLMediaElement::~HTMLMediaElement() { |
| 485 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")"; | 491 BLINK_MEDIA_LOG << "~HTMLMediaElement(" << (void*)this << ")"; |
| 486 | 492 |
| 487 // m_audioSourceNode is explicitly cleared by AudioNode::dispose(). | 493 // m_audioSourceNode is explicitly cleared by AudioNode::dispose(). |
| (...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3932 | 3938 |
| 3933 void HTMLMediaElement::notifyPositionMayHaveChanged( | 3939 void HTMLMediaElement::notifyPositionMayHaveChanged( |
| 3934 const IntRect& visibleRect) { | 3940 const IntRect& visibleRect) { |
| 3935 m_autoplayHelper->positionChanged(visibleRect); | 3941 m_autoplayHelper->positionChanged(visibleRect); |
| 3936 } | 3942 } |
| 3937 | 3943 |
| 3938 void HTMLMediaElement::updatePositionNotificationRegistration() { | 3944 void HTMLMediaElement::updatePositionNotificationRegistration() { |
| 3939 m_autoplayHelper->updatePositionNotificationRegistration(); | 3945 m_autoplayHelper->updatePositionNotificationRegistration(); |
| 3940 } | 3946 } |
| 3941 | 3947 |
| 3942 void HTMLMediaElement::setRemotePlaybackClient( | |
| 3943 WebRemotePlaybackClient* client) { | |
| 3944 m_remotePlaybackClient = client; | |
| 3945 } | |
| 3946 | |
| 3947 // TODO(liberato): remove once autoplay gesture override experiment concludes. | 3948 // TODO(liberato): remove once autoplay gesture override experiment concludes. |
| 3948 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() { | 3949 void HTMLMediaElement::triggerAutoplayViewportCheckForTesting() { |
| 3949 if (FrameView* view = document().view()) | 3950 if (FrameView* view = document().view()) |
| 3950 m_autoplayHelper->positionChanged( | 3951 m_autoplayHelper->positionChanged( |
| 3951 view->rootFrameToContents(view->computeVisibleArea())); | 3952 view->rootFrameToContents(view->computeVisibleArea())); |
| 3952 m_autoplayHelper->triggerAutoplayViewportCheckForTesting(); | 3953 m_autoplayHelper->triggerAutoplayViewportCheckForTesting(); |
| 3953 } | 3954 } |
| 3954 | 3955 |
| 3955 void HTMLMediaElement::scheduleResolvePlayPromises() { | 3956 void HTMLMediaElement::scheduleResolvePlayPromises() { |
| 3956 // TODO(mlamouri): per spec, we should create a new task but we can't create | 3957 // TODO(mlamouri): per spec, we should create a new task but we can't create |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4178 | 4179 |
| 4179 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4180 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4180 const { | 4181 const { |
| 4181 IntRect result; | 4182 IntRect result; |
| 4182 if (LayoutObject* object = m_element->layoutObject()) | 4183 if (LayoutObject* object = m_element->layoutObject()) |
| 4183 result = object->absoluteBoundingBoxRect(); | 4184 result = object->absoluteBoundingBoxRect(); |
| 4184 return result; | 4185 return result; |
| 4185 } | 4186 } |
| 4186 | 4187 |
| 4187 } // namespace blink | 4188 } // namespace blink |
| OLD | NEW |