OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/media_controls/MediaControlsOrientationLockDelegate.h" | 5 #include "modules/media_controls/MediaControlsOrientationLockDelegate.h" |
6 | 6 |
7 #include "core/events/Event.h" | 7 #include "core/events/Event.h" |
8 #include "core/frame/ScreenOrientationController.h" | 8 #include "core/frame/ScreenOrientationController.h" |
9 #include "core/html/HTMLVideoElement.h" | 9 #include "core/html/HTMLVideoElement.h" |
10 #include "core/page/ChromeClient.h" | 10 #include "core/page/ChromeClient.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 public: | 57 public: |
58 void OnSuccess() override {} | 58 void OnSuccess() override {} |
59 void OnError(WebLockOrientationError) override {} | 59 void OnError(WebLockOrientationError) override {} |
60 }; | 60 }; |
61 | 61 |
62 } // anonymous namespace | 62 } // anonymous namespace |
63 | 63 |
64 MediaControlsOrientationLockDelegate::MediaControlsOrientationLockDelegate( | 64 MediaControlsOrientationLockDelegate::MediaControlsOrientationLockDelegate( |
65 HTMLVideoElement& video) | 65 HTMLVideoElement& video) |
66 : EventListener(kCPPEventListenerType), video_element_(video) { | 66 : EventListener(kCPPEventListenerType), video_element_(video) { |
67 if (VideoElement().isConnected()) | |
68 Attach(); | |
mlamouri (slow - plz ping)
2017/04/19 17:10:46
debugging code?
johnme
2017/04/19 18:21:28
No - it turns out this is redundant, and leads to
| |
69 } | 67 } |
70 | 68 |
71 void MediaControlsOrientationLockDelegate::Attach() { | 69 void MediaControlsOrientationLockDelegate::Attach() { |
72 DCHECK(VideoElement().isConnected()); | 70 DCHECK(VideoElement().isConnected()); |
73 | 71 |
74 GetDocument().addEventListener(EventTypeNames::fullscreenchange, this, true); | 72 GetDocument().addEventListener(EventTypeNames::fullscreenchange, this, true); |
75 VideoElement().addEventListener(EventTypeNames::webkitfullscreenchange, this, | 73 VideoElement().addEventListener(EventTypeNames::webkitfullscreenchange, this, |
76 true); | 74 true); |
77 VideoElement().addEventListener(EventTypeNames::loadedmetadata, this, true); | 75 VideoElement().addEventListener(EventTypeNames::loadedmetadata, this, true); |
78 } | 76 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 NOTREACHED(); | 209 NOTREACHED(); |
212 return kWebScreenOrientationLockLandscape; | 210 return kWebScreenOrientationLockLandscape; |
213 } | 211 } |
214 | 212 |
215 DEFINE_TRACE(MediaControlsOrientationLockDelegate) { | 213 DEFINE_TRACE(MediaControlsOrientationLockDelegate) { |
216 EventListener::Trace(visitor); | 214 EventListener::Trace(visitor); |
217 visitor->Trace(video_element_); | 215 visitor->Trace(video_element_); |
218 } | 216 } |
219 | 217 |
220 } // namespace blink | 218 } // namespace blink |
OLD | NEW |