OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google 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 | 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 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/html/shadow/MediaControls.h" | 28 #include "core/html/shadow/MediaControls.h" |
29 | 29 |
30 #include "bindings/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/v8/ExceptionStatePlaceholder.h" |
31 #include "core/events/MouseEvent.h" | 31 #include "core/events/MouseEvent.h" |
| 32 #include "core/frame/Settings.h" |
32 #include "core/html/HTMLMediaElement.h" | 33 #include "core/html/HTMLMediaElement.h" |
33 #include "core/html/MediaController.h" | 34 #include "core/html/MediaController.h" |
34 #include "core/rendering/RenderTheme.h" | 35 #include "core/rendering/RenderTheme.h" |
35 | 36 |
36 namespace WebCore { | 37 namespace WebCore { |
37 | 38 |
38 #if OS(ANDROID) | |
39 static const bool needOverlayPlayButton = true; | |
40 #else | |
41 static const bool needOverlayPlayButton = false; | |
42 #endif | |
43 | |
44 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; | 39 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; |
45 | 40 |
46 MediaControls::MediaControls(HTMLMediaElement& mediaElement) | 41 MediaControls::MediaControls(HTMLMediaElement& mediaElement) |
47 : HTMLDivElement(mediaElement.document()) | 42 : HTMLDivElement(mediaElement.document()) |
48 , m_mediaElement(mediaElement) | 43 , m_mediaElement(mediaElement) |
49 , m_panel(0) | 44 , m_panel(0) |
50 , m_textDisplayContainer(0) | 45 , m_textDisplayContainer(0) |
51 , m_overlayPlayButton(0) | 46 , m_overlayPlayButton(0) |
52 , m_overlayEnclosure(0) | 47 , m_overlayEnclosure(0) |
53 , m_playButton(0) | 48 , m_playButton(0) |
(...skipping 18 matching lines...) Expand all Loading... |
72 if (controls->initializeControls()) | 67 if (controls->initializeControls()) |
73 return controls.release(); | 68 return controls.release(); |
74 | 69 |
75 return nullptr; | 70 return nullptr; |
76 } | 71 } |
77 | 72 |
78 bool MediaControls::initializeControls() | 73 bool MediaControls::initializeControls() |
79 { | 74 { |
80 TrackExceptionState exceptionState; | 75 TrackExceptionState exceptionState; |
81 | 76 |
82 if (needOverlayPlayButton) { | 77 if (document().settings() && document().settings()->mediaControlsOverlayPlay
ButtonEnabled()) { |
83 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaCont
rolOverlayEnclosureElement::create(*this); | 78 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaCont
rolOverlayEnclosureElement::create(*this); |
84 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(*this); | 79 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(*this); |
85 m_overlayPlayButton = overlayPlayButton.get(); | 80 m_overlayPlayButton = overlayPlayButton.get(); |
86 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); | 81 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); |
87 if (exceptionState.hadException()) | 82 if (exceptionState.hadException()) |
88 return false; | 83 return false; |
89 | 84 |
90 m_overlayEnclosure = overlayEnclosure.get(); | 85 m_overlayEnclosure = overlayEnclosure.get(); |
91 appendChild(overlayEnclosure.release(), exceptionState); | 86 appendChild(overlayEnclosure.release(), exceptionState); |
92 if (exceptionState.hadException()) | 87 if (exceptionState.hadException()) |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 432 |
438 void MediaControls::updateTextTrackDisplay() | 433 void MediaControls::updateTextTrackDisplay() |
439 { | 434 { |
440 if (!m_textDisplayContainer) | 435 if (!m_textDisplayContainer) |
441 createTextTrackDisplay(); | 436 createTextTrackDisplay(); |
442 | 437 |
443 m_textDisplayContainer->updateDisplay(); | 438 m_textDisplayContainer->updateDisplay(); |
444 } | 439 } |
445 | 440 |
446 } | 441 } |
OLD | NEW |