Chromium Code Reviews| Index: third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp |
| diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp |
| similarity index 68% |
| rename from third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp |
| rename to third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp |
| index f971c9f0841175adf5bb766edf00f3317c55b17f..961d6dca24bb55e81ad372497f8dc6b38638e31b 100644 |
| --- a/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp |
| +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsWindowEventListener.cpp |
| @@ -2,12 +2,12 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "core/html/shadow/MediaControlsWindowEventListener.h" |
| +#include "modules/media_controls/MediaControlsWindowEventListener.h" |
| #include "core/events/Event.h" |
| #include "core/frame/LocalDOMWindow.h" |
| -#include "core/html/media/MediaControls.h" |
| #include "core/html/shadow/MediaControlElements.h" |
| +#include "modules/media_controls/MediaControlsImpl.h" |
| namespace blink { |
| @@ -25,14 +25,14 @@ LocalDOMWindow* getTopLocalDOMWindow(LocalDOMWindow* window) { |
| } // anonymous namespace |
| MediaControlsWindowEventListener* MediaControlsWindowEventListener::create( |
| - MediaControls* mediaControls, |
| + MediaControlsImpl* mediaControls, |
| std::unique_ptr<Callback> callback) { |
| return new MediaControlsWindowEventListener(mediaControls, |
| std::move(callback)); |
| } |
| MediaControlsWindowEventListener::MediaControlsWindowEventListener( |
| - MediaControls* mediaControls, |
| + MediaControlsImpl* mediaControls, |
| std::unique_ptr<Callback> callback) |
| : EventListener(CPPEventListenerType), |
| m_mediaControls(mediaControls), |
| @@ -50,7 +50,7 @@ void MediaControlsWindowEventListener::start() { |
| if (m_isActive) |
| return; |
| - if (LocalDOMWindow* window = m_mediaControls->ownerDocument().domWindow()) { |
| + if (LocalDOMWindow* window = m_mediaControls->document().domWindow()) { |
| window->addEventListener(EventTypeNames::click, this, true); |
| if (LocalDOMWindow* outerWindow = getTopLocalDOMWindow(window)) { |
| @@ -60,14 +60,14 @@ void MediaControlsWindowEventListener::start() { |
| } |
| } |
| - m_mediaControls->panelElement()->addEventListener(EventTypeNames::click, this, |
| + m_mediaControls->m_panel->addEventListener(EventTypeNames::click, this, |
| + false); |
| + m_mediaControls->m_timeline->addEventListener(EventTypeNames::click, this, |
| + false); |
| + m_mediaControls->m_castButton->addEventListener(EventTypeNames::click, this, |
| + false); |
| + m_mediaControls->m_volumeSlider->addEventListener(EventTypeNames::click, this, |
|
whywhat
2017/04/07 20:13:59
nit: not sure why accessing buttons directly is be
mlamouri (slow - plz ping)
2017/04/09 15:36:41
The idea of MediaControlsWindowEventListener being
|
| false); |
| - m_mediaControls->timelineElement()->addEventListener(EventTypeNames::click, |
| - this, false); |
| - m_mediaControls->castButtonElement()->addEventListener(EventTypeNames::click, |
| - this, false); |
| - m_mediaControls->volumeSliderElement()->addEventListener( |
| - EventTypeNames::click, this, false); |
| m_isActive = true; |
| } |
| @@ -76,7 +76,7 @@ void MediaControlsWindowEventListener::stop() { |
| if (!m_isActive) |
| return; |
| - if (LocalDOMWindow* window = m_mediaControls->ownerDocument().domWindow()) { |
| + if (LocalDOMWindow* window = m_mediaControls->document().domWindow()) { |
| window->removeEventListener(EventTypeNames::click, this, true); |
| if (LocalDOMWindow* outerWindow = getTopLocalDOMWindow(window)) { |
| @@ -88,14 +88,14 @@ void MediaControlsWindowEventListener::stop() { |
| m_isActive = false; |
| } |
| - m_mediaControls->panelElement()->removeEventListener(EventTypeNames::click, |
| + m_mediaControls->m_panel->removeEventListener(EventTypeNames::click, this, |
| + false); |
| + m_mediaControls->m_timeline->removeEventListener(EventTypeNames::click, this, |
| + false); |
| + m_mediaControls->m_castButton->removeEventListener(EventTypeNames::click, |
| + this, false); |
| + m_mediaControls->m_volumeSlider->removeEventListener(EventTypeNames::click, |
| this, false); |
| - m_mediaControls->timelineElement()->removeEventListener(EventTypeNames::click, |
| - this, false); |
| - m_mediaControls->castButtonElement()->removeEventListener( |
| - EventTypeNames::click, this, false); |
| - m_mediaControls->volumeSliderElement()->removeEventListener( |
| - EventTypeNames::click, this, false); |
| m_isActive = false; |
| } |