| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 20 matching lines...) Expand all Loading... |
| 31 #define MediaControlElements_h | 31 #define MediaControlElements_h |
| 32 | 32 |
| 33 #include "core/html/shadow/MediaControlElementTypes.h" | 33 #include "core/html/shadow/MediaControlElementTypes.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 // ---------------------------- | 37 // ---------------------------- |
| 38 | 38 |
| 39 class MediaControlPanelElement final : public MediaControlDivElement { | 39 class MediaControlPanelElement final : public MediaControlDivElement { |
| 40 public: | 40 public: |
| 41 static PassRefPtrWillBeRawPtr<MediaControlPanelElement> create(MediaControls
&); | 41 static RawPtr<MediaControlPanelElement> create(MediaControls&); |
| 42 | 42 |
| 43 void setIsDisplayed(bool); | 43 void setIsDisplayed(bool); |
| 44 | 44 |
| 45 void makeOpaque(); | 45 void makeOpaque(); |
| 46 void makeTransparent(); | 46 void makeTransparent(); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 explicit MediaControlPanelElement(MediaControls&); | 49 explicit MediaControlPanelElement(MediaControls&); |
| 50 | 50 |
| 51 void defaultEventHandler(Event*) override; | 51 void defaultEventHandler(Event*) override; |
| 52 bool keepEventInNode(Event*) override; | 52 bool keepEventInNode(Event*) override; |
| 53 | 53 |
| 54 void startTimer(); | 54 void startTimer(); |
| 55 void stopTimer(); | 55 void stopTimer(); |
| 56 void transitionTimerFired(Timer<MediaControlPanelElement>*); | 56 void transitionTimerFired(Timer<MediaControlPanelElement>*); |
| 57 void didBecomeVisible(); | 57 void didBecomeVisible(); |
| 58 | 58 |
| 59 bool m_isDisplayed; | 59 bool m_isDisplayed; |
| 60 bool m_opaque; | 60 bool m_opaque; |
| 61 | 61 |
| 62 Timer<MediaControlPanelElement> m_transitionTimer; | 62 Timer<MediaControlPanelElement> m_transitionTimer; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // ---------------------------- | 65 // ---------------------------- |
| 66 | 66 |
| 67 class MediaControlPanelEnclosureElement final : public MediaControlDivElement { | 67 class MediaControlPanelEnclosureElement final : public MediaControlDivElement { |
| 68 public: | 68 public: |
| 69 static PassRefPtrWillBeRawPtr<MediaControlPanelEnclosureElement> create(Medi
aControls&); | 69 static RawPtr<MediaControlPanelEnclosureElement> create(MediaControls&); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 explicit MediaControlPanelEnclosureElement(MediaControls&); | 72 explicit MediaControlPanelEnclosureElement(MediaControls&); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // ---------------------------- | 75 // ---------------------------- |
| 76 | 76 |
| 77 class MediaControlOverlayEnclosureElement final : public MediaControlDivElement
{ | 77 class MediaControlOverlayEnclosureElement final : public MediaControlDivElement
{ |
| 78 public: | 78 public: |
| 79 static PassRefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> create(Me
diaControls&); | 79 static RawPtr<MediaControlOverlayEnclosureElement> create(MediaControls&); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 explicit MediaControlOverlayEnclosureElement(MediaControls&); | 82 explicit MediaControlOverlayEnclosureElement(MediaControls&); |
| 83 void* preDispatchEventHandler(Event*) override; | 83 void* preDispatchEventHandler(Event*) override; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // ---------------------------- | 86 // ---------------------------- |
| 87 | 87 |
| 88 class MediaControlMuteButtonElement final : public MediaControlInputElement { | 88 class MediaControlMuteButtonElement final : public MediaControlInputElement { |
| 89 public: | 89 public: |
| 90 static PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> create(MediaCon
trols&); | 90 static RawPtr<MediaControlMuteButtonElement> create(MediaControls&); |
| 91 | 91 |
| 92 bool willRespondToMouseClickEvents() override { return true; } | 92 bool willRespondToMouseClickEvents() override { return true; } |
| 93 void updateDisplayType() override; | 93 void updateDisplayType() override; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 explicit MediaControlMuteButtonElement(MediaControls&); | 96 explicit MediaControlMuteButtonElement(MediaControls&); |
| 97 | 97 |
| 98 void defaultEventHandler(Event*) override; | 98 void defaultEventHandler(Event*) override; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // ---------------------------- | 101 // ---------------------------- |
| 102 | 102 |
| 103 class MediaControlPlayButtonElement final : public MediaControlInputElement { | 103 class MediaControlPlayButtonElement final : public MediaControlInputElement { |
| 104 public: | 104 public: |
| 105 static PassRefPtrWillBeRawPtr<MediaControlPlayButtonElement> create(MediaCon
trols&); | 105 static RawPtr<MediaControlPlayButtonElement> create(MediaControls&); |
| 106 | 106 |
| 107 bool willRespondToMouseClickEvents() override { return true; } | 107 bool willRespondToMouseClickEvents() override { return true; } |
| 108 void updateDisplayType() override; | 108 void updateDisplayType() override; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 explicit MediaControlPlayButtonElement(MediaControls&); | 111 explicit MediaControlPlayButtonElement(MediaControls&); |
| 112 | 112 |
| 113 void defaultEventHandler(Event*) override; | 113 void defaultEventHandler(Event*) override; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 // ---------------------------- | 116 // ---------------------------- |
| 117 | 117 |
| 118 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme
nt { | 118 class MediaControlOverlayPlayButtonElement final : public MediaControlInputEleme
nt { |
| 119 public: | 119 public: |
| 120 static PassRefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> create(M
ediaControls&); | 120 static RawPtr<MediaControlOverlayPlayButtonElement> create(MediaControls&); |
| 121 | 121 |
| 122 void updateDisplayType() override; | 122 void updateDisplayType() override; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 explicit MediaControlOverlayPlayButtonElement(MediaControls&); | 125 explicit MediaControlOverlayPlayButtonElement(MediaControls&); |
| 126 | 126 |
| 127 void defaultEventHandler(Event*) override; | 127 void defaultEventHandler(Event*) override; |
| 128 bool keepEventInNode(Event*) override; | 128 bool keepEventInNode(Event*) override; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // ---------------------------- | 131 // ---------------------------- |
| 132 | 132 |
| 133 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI
nputElement { | 133 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI
nputElement { |
| 134 public: | 134 public: |
| 135 static PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement>
create(MediaControls&); | 135 static RawPtr<MediaControlToggleClosedCaptionsButtonElement> create(MediaCon
trols&); |
| 136 | 136 |
| 137 bool willRespondToMouseClickEvents() override { return true; } | 137 bool willRespondToMouseClickEvents() override { return true; } |
| 138 | 138 |
| 139 void updateDisplayType() override; | 139 void updateDisplayType() override; |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); | 142 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); |
| 143 | 143 |
| 144 void defaultEventHandler(Event*) override; | 144 void defaultEventHandler(Event*) override; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 // ---------------------------- | 147 // ---------------------------- |
| 148 | 148 |
| 149 class MediaControlTimelineElement final : public MediaControlInputElement { | 149 class MediaControlTimelineElement final : public MediaControlInputElement { |
| 150 public: | 150 public: |
| 151 static PassRefPtrWillBeRawPtr<MediaControlTimelineElement> create(MediaContr
ols&); | 151 static RawPtr<MediaControlTimelineElement> create(MediaControls&); |
| 152 | 152 |
| 153 bool willRespondToMouseClickEvents() override; | 153 bool willRespondToMouseClickEvents() override; |
| 154 | 154 |
| 155 // FIXME: An "earliest possible position" will be needed once that concept | 155 // FIXME: An "earliest possible position" will be needed once that concept |
| 156 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 156 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
| 157 void setPosition(double); | 157 void setPosition(double); |
| 158 void setDuration(double); | 158 void setDuration(double); |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 explicit MediaControlTimelineElement(MediaControls&); | 161 explicit MediaControlTimelineElement(MediaControls&); |
| 162 | 162 |
| 163 void defaultEventHandler(Event*) override; | 163 void defaultEventHandler(Event*) override; |
| 164 bool keepEventInNode(Event*) override; | 164 bool keepEventInNode(Event*) override; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 // ---------------------------- | 167 // ---------------------------- |
| 168 | 168 |
| 169 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen
t { | 169 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen
t { |
| 170 public: | 170 public: |
| 171 static PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> create(Me
diaControls&); | 171 static RawPtr<MediaControlFullscreenButtonElement> create(MediaControls&); |
| 172 | 172 |
| 173 bool willRespondToMouseClickEvents() override { return true; } | 173 bool willRespondToMouseClickEvents() override { return true; } |
| 174 | 174 |
| 175 void setIsFullscreen(bool); | 175 void setIsFullscreen(bool); |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 explicit MediaControlFullscreenButtonElement(MediaControls&); | 178 explicit MediaControlFullscreenButtonElement(MediaControls&); |
| 179 | 179 |
| 180 void defaultEventHandler(Event*) override; | 180 void defaultEventHandler(Event*) override; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // ---------------------------- | 183 // ---------------------------- |
| 184 | 184 |
| 185 class MediaControlCastButtonElement final : public MediaControlInputElement { | 185 class MediaControlCastButtonElement final : public MediaControlInputElement { |
| 186 public: | 186 public: |
| 187 static PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> create(MediaCon
trols&, bool isOverlayButton); | 187 static RawPtr<MediaControlCastButtonElement> create(MediaControls&, bool isO
verlayButton); |
| 188 | 188 |
| 189 bool willRespondToMouseClickEvents() override { return true; } | 189 bool willRespondToMouseClickEvents() override { return true; } |
| 190 | 190 |
| 191 void setIsPlayingRemotely(bool); | 191 void setIsPlayingRemotely(bool); |
| 192 | 192 |
| 193 // This will show a cast button if it is not covered by another element. | 193 // This will show a cast button if it is not covered by another element. |
| 194 // This MUST be called for cast button elements that are overlay elements. | 194 // This MUST be called for cast button elements that are overlay elements. |
| 195 void tryShowOverlay(); | 195 void tryShowOverlay(); |
| 196 | 196 |
| 197 private: | 197 private: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 216 // UMA related boolean. They are used to prevent counting something twice | 216 // UMA related boolean. They are used to prevent counting something twice |
| 217 // for the same media element. | 217 // for the same media element. |
| 218 bool m_clickUseCounted = false; | 218 bool m_clickUseCounted = false; |
| 219 bool m_showUseCounted = false; | 219 bool m_showUseCounted = false; |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 // ---------------------------- | 222 // ---------------------------- |
| 223 | 223 |
| 224 class MediaControlVolumeSliderElement final : public MediaControlInputElement { | 224 class MediaControlVolumeSliderElement final : public MediaControlInputElement { |
| 225 public: | 225 public: |
| 226 static PassRefPtrWillBeRawPtr<MediaControlVolumeSliderElement> create(MediaC
ontrols&); | 226 static RawPtr<MediaControlVolumeSliderElement> create(MediaControls&); |
| 227 | 227 |
| 228 bool willRespondToMouseMoveEvents() override; | 228 bool willRespondToMouseMoveEvents() override; |
| 229 bool willRespondToMouseClickEvents() override; | 229 bool willRespondToMouseClickEvents() override; |
| 230 void setVolume(double); | 230 void setVolume(double); |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 explicit MediaControlVolumeSliderElement(MediaControls&); | 233 explicit MediaControlVolumeSliderElement(MediaControls&); |
| 234 | 234 |
| 235 void defaultEventHandler(Event*) override; | 235 void defaultEventHandler(Event*) override; |
| 236 bool keepEventInNode(Event*) override; | 236 bool keepEventInNode(Event*) override; |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 // ---------------------------- | 239 // ---------------------------- |
| 240 | 240 |
| 241 class MediaControlTimeRemainingDisplayElement final : public MediaControlTimeDis
playElement { | 241 class MediaControlTimeRemainingDisplayElement final : public MediaControlTimeDis
playElement { |
| 242 public: | 242 public: |
| 243 static PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> creat
e(MediaControls&); | 243 static RawPtr<MediaControlTimeRemainingDisplayElement> create(MediaControls&
); |
| 244 | 244 |
| 245 private: | 245 private: |
| 246 explicit MediaControlTimeRemainingDisplayElement(MediaControls&); | 246 explicit MediaControlTimeRemainingDisplayElement(MediaControls&); |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 // ---------------------------- | 249 // ---------------------------- |
| 250 | 250 |
| 251 class MediaControlCurrentTimeDisplayElement final : public MediaControlTimeDispl
ayElement { | 251 class MediaControlCurrentTimeDisplayElement final : public MediaControlTimeDispl
ayElement { |
| 252 public: | 252 public: |
| 253 static PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> create(
MediaControls&); | 253 static RawPtr<MediaControlCurrentTimeDisplayElement> create(MediaControls&); |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 256 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 } // namespace blink | 259 } // namespace blink |
| 260 | 260 |
| 261 #endif // MediaControlElements_h | 261 #endif // MediaControlElements_h |
| OLD | NEW |