| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "core/html/shadow/MediaControlElementTypes.h" | 33 #include "core/html/shadow/MediaControlElementTypes.h" |
| 34 #include "public/platform/WebLocalizedString.h" | 34 #include "public/platform/WebLocalizedString.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class TextTrack; | 38 class TextTrack; |
| 39 | 39 |
| 40 // ---------------------------- | 40 // ---------------------------- |
| 41 | 41 |
| 42 class MediaControlPanelElement final : public MediaControlDivElement { | 42 class CORE_EXPORT MediaControlPanelElement final |
| 43 : public MediaControlDivElement { |
| 43 public: | 44 public: |
| 44 static MediaControlPanelElement* create(MediaControls&); | 45 static MediaControlPanelElement* create(MediaControls&); |
| 45 | 46 |
| 46 void setIsDisplayed(bool); | 47 void setIsDisplayed(bool); |
| 47 | 48 |
| 48 bool isOpaque() const; | 49 bool isOpaque() const; |
| 49 void makeOpaque(); | 50 void makeOpaque(); |
| 50 void makeTransparent(); | 51 void makeTransparent(); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 explicit MediaControlPanelElement(MediaControls&); | 54 explicit MediaControlPanelElement(MediaControls&); |
| 54 | 55 |
| 55 void defaultEventHandler(Event*) override; | 56 void defaultEventHandler(Event*) override; |
| 56 bool keepEventInNode(Event*) override; | 57 bool keepEventInNode(Event*) override; |
| 57 | 58 |
| 58 void startTimer(); | 59 void startTimer(); |
| 59 void stopTimer(); | 60 void stopTimer(); |
| 60 void transitionTimerFired(TimerBase*); | 61 void transitionTimerFired(TimerBase*); |
| 61 void didBecomeVisible(); | 62 void didBecomeVisible(); |
| 62 | 63 |
| 63 bool m_isDisplayed; | 64 bool m_isDisplayed; |
| 64 bool m_opaque; | 65 bool m_opaque; |
| 65 | 66 |
| 66 TaskRunnerTimer<MediaControlPanelElement> m_transitionTimer; | 67 TaskRunnerTimer<MediaControlPanelElement> m_transitionTimer; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // ---------------------------- | 70 // ---------------------------- |
| 70 | 71 |
| 71 class MediaControlPanelEnclosureElement final : public MediaControlDivElement { | 72 class CORE_EXPORT MediaControlPanelEnclosureElement final |
| 73 : public MediaControlDivElement { |
| 72 public: | 74 public: |
| 73 static MediaControlPanelEnclosureElement* create(MediaControls&); | 75 static MediaControlPanelEnclosureElement* create(MediaControls&); |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 explicit MediaControlPanelEnclosureElement(MediaControls&); | 78 explicit MediaControlPanelEnclosureElement(MediaControls&); |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 // ---------------------------- | 81 // ---------------------------- |
| 80 | 82 |
| 81 class MediaControlOverlayEnclosureElement final | 83 class CORE_EXPORT MediaControlOverlayEnclosureElement final |
| 82 : public MediaControlDivElement { | 84 : public MediaControlDivElement { |
| 83 public: | 85 public: |
| 84 static MediaControlOverlayEnclosureElement* create(MediaControls&); | 86 static MediaControlOverlayEnclosureElement* create(MediaControls&); |
| 85 | 87 |
| 86 private: | 88 private: |
| 87 explicit MediaControlOverlayEnclosureElement(MediaControls&); | 89 explicit MediaControlOverlayEnclosureElement(MediaControls&); |
| 88 EventDispatchHandlingState* preDispatchEventHandler(Event*) override; | 90 EventDispatchHandlingState* preDispatchEventHandler(Event*) override; |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 // ---------------------------- | 93 // ---------------------------- |
| 92 | 94 |
| 93 class MediaControlMuteButtonElement final : public MediaControlInputElement { | 95 class CORE_EXPORT MediaControlMuteButtonElement final |
| 96 : public MediaControlInputElement { |
| 94 public: | 97 public: |
| 95 static MediaControlMuteButtonElement* create(MediaControls&); | 98 static MediaControlMuteButtonElement* create(MediaControls&); |
| 96 | 99 |
| 97 bool willRespondToMouseClickEvents() override { return true; } | 100 bool willRespondToMouseClickEvents() override { return true; } |
| 98 void updateDisplayType() override; | 101 void updateDisplayType() override; |
| 99 | 102 |
| 100 WebLocalizedString::Name getOverflowStringName() override; | 103 WebLocalizedString::Name getOverflowStringName() override; |
| 101 | 104 |
| 102 bool hasOverflowButton() override { return true; } | 105 bool hasOverflowButton() override { return true; } |
| 103 | 106 |
| 104 private: | 107 private: |
| 105 explicit MediaControlMuteButtonElement(MediaControls&); | 108 explicit MediaControlMuteButtonElement(MediaControls&); |
| 106 | 109 |
| 107 void defaultEventHandler(Event*) override; | 110 void defaultEventHandler(Event*) override; |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 // ---------------------------- | 113 // ---------------------------- |
| 111 | 114 |
| 112 class MediaControlPlayButtonElement final : public MediaControlInputElement { | 115 class CORE_EXPORT MediaControlPlayButtonElement final |
| 116 : public MediaControlInputElement { |
| 113 public: | 117 public: |
| 114 static MediaControlPlayButtonElement* create(MediaControls&); | 118 static MediaControlPlayButtonElement* create(MediaControls&); |
| 115 | 119 |
| 116 bool willRespondToMouseClickEvents() override { return true; } | 120 bool willRespondToMouseClickEvents() override { return true; } |
| 117 void updateDisplayType() override; | 121 void updateDisplayType() override; |
| 118 | 122 |
| 119 WebLocalizedString::Name getOverflowStringName() override; | 123 WebLocalizedString::Name getOverflowStringName() override; |
| 120 | 124 |
| 121 bool hasOverflowButton() override { return true; } | 125 bool hasOverflowButton() override { return true; } |
| 122 | 126 |
| 123 private: | 127 private: |
| 124 explicit MediaControlPlayButtonElement(MediaControls&); | 128 explicit MediaControlPlayButtonElement(MediaControls&); |
| 125 | 129 |
| 126 void defaultEventHandler(Event*) override; | 130 void defaultEventHandler(Event*) override; |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 // ---------------------------- | 133 // ---------------------------- |
| 130 | 134 |
| 131 class MediaControlOverlayPlayButtonElement final | 135 class CORE_EXPORT MediaControlOverlayPlayButtonElement final |
| 132 : public MediaControlInputElement { | 136 : public MediaControlInputElement { |
| 133 public: | 137 public: |
| 134 static MediaControlOverlayPlayButtonElement* create(MediaControls&); | 138 static MediaControlOverlayPlayButtonElement* create(MediaControls&); |
| 135 | 139 |
| 136 void updateDisplayType() override; | 140 void updateDisplayType() override; |
| 137 | 141 |
| 138 private: | 142 private: |
| 139 explicit MediaControlOverlayPlayButtonElement(MediaControls&); | 143 explicit MediaControlOverlayPlayButtonElement(MediaControls&); |
| 140 | 144 |
| 141 void defaultEventHandler(Event*) override; | 145 void defaultEventHandler(Event*) override; |
| 142 bool keepEventInNode(Event*) override; | 146 bool keepEventInNode(Event*) override; |
| 143 }; | 147 }; |
| 144 | 148 |
| 145 // ---------------------------- | 149 // ---------------------------- |
| 146 | 150 |
| 147 class MediaControlToggleClosedCaptionsButtonElement final | 151 class CORE_EXPORT MediaControlToggleClosedCaptionsButtonElement final |
| 148 : public MediaControlInputElement { | 152 : public MediaControlInputElement { |
| 149 public: | 153 public: |
| 150 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&); | 154 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&); |
| 151 | 155 |
| 152 bool willRespondToMouseClickEvents() override { return true; } | 156 bool willRespondToMouseClickEvents() override { return true; } |
| 153 | 157 |
| 154 void updateDisplayType() override; | 158 void updateDisplayType() override; |
| 155 | 159 |
| 156 WebLocalizedString::Name getOverflowStringName() override; | 160 WebLocalizedString::Name getOverflowStringName() override; |
| 157 | 161 |
| 158 bool hasOverflowButton() override { return true; } | 162 bool hasOverflowButton() override { return true; } |
| 159 | 163 |
| 160 private: | 164 private: |
| 161 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); | 165 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); |
| 162 | 166 |
| 163 void defaultEventHandler(Event*) override; | 167 void defaultEventHandler(Event*) override; |
| 164 }; | 168 }; |
| 165 | 169 |
| 166 // ---------------------------- | 170 // ---------------------------- |
| 167 | 171 |
| 168 class MediaControlTextTrackListElement final : public MediaControlDivElement { | 172 class CORE_EXPORT MediaControlTextTrackListElement final |
| 173 : public MediaControlDivElement { |
| 169 public: | 174 public: |
| 170 static MediaControlTextTrackListElement* create(MediaControls&); | 175 static MediaControlTextTrackListElement* create(MediaControls&); |
| 171 | 176 |
| 172 bool willRespondToMouseClickEvents() override { return true; } | 177 bool willRespondToMouseClickEvents() override { return true; } |
| 173 | 178 |
| 174 void setVisible(bool); | 179 void setVisible(bool); |
| 175 | 180 |
| 176 private: | 181 private: |
| 177 explicit MediaControlTextTrackListElement(MediaControls&); | 182 explicit MediaControlTextTrackListElement(MediaControls&); |
| 178 | 183 |
| 179 void defaultEventHandler(Event*) override; | 184 void defaultEventHandler(Event*) override; |
| 180 | 185 |
| 181 void refreshTextTrackListMenu(); | 186 void refreshTextTrackListMenu(); |
| 182 | 187 |
| 183 // Returns the label for the track when a valid track is passed in and "Off" | 188 // Returns the label for the track when a valid track is passed in and "Off" |
| 184 // when the parameter is null. | 189 // when the parameter is null. |
| 185 String getTextTrackLabel(TextTrack*); | 190 String getTextTrackLabel(TextTrack*); |
| 186 // Creates the track element in the list when a valid track is passed in and | 191 // Creates the track element in the list when a valid track is passed in and |
| 187 // the "Off" item when the parameter is null. | 192 // the "Off" item when the parameter is null. |
| 188 Element* createTextTrackListItem(TextTrack*); | 193 Element* createTextTrackListItem(TextTrack*); |
| 189 }; | 194 }; |
| 190 | 195 |
| 191 // ---------------------------- | 196 // ---------------------------- |
| 192 // Represents the overflow menu which is displayed when the width of the media | 197 // Represents the overflow menu which is displayed when the width of the media |
| 193 // player is small enough that at least two buttons are no longer visible. | 198 // player is small enough that at least two buttons are no longer visible. |
| 194 class MediaControlOverflowMenuButtonElement final | 199 class CORE_EXPORT MediaControlOverflowMenuButtonElement final |
| 195 : public MediaControlInputElement { | 200 : public MediaControlInputElement { |
| 196 public: | 201 public: |
| 197 static MediaControlOverflowMenuButtonElement* create(MediaControls&); | 202 static MediaControlOverflowMenuButtonElement* create(MediaControls&); |
| 198 | 203 |
| 199 // The overflow button should respond to mouse clicks since we want a click | 204 // The overflow button should respond to mouse clicks since we want a click |
| 200 // to open up the menu. | 205 // to open up the menu. |
| 201 bool willRespondToMouseClickEvents() override { return true; } | 206 bool willRespondToMouseClickEvents() override { return true; } |
| 202 | 207 |
| 203 private: | 208 private: |
| 204 explicit MediaControlOverflowMenuButtonElement(MediaControls&); | 209 explicit MediaControlOverflowMenuButtonElement(MediaControls&); |
| 205 | 210 |
| 206 void defaultEventHandler(Event*) override; | 211 void defaultEventHandler(Event*) override; |
| 207 }; | 212 }; |
| 208 | 213 |
| 209 // ---------------------------- | 214 // ---------------------------- |
| 210 // Holds a list of elements within the overflow menu. | 215 // Holds a list of elements within the overflow menu. |
| 211 class MediaControlOverflowMenuListElement final | 216 class CORE_EXPORT MediaControlOverflowMenuListElement final |
| 212 : public MediaControlDivElement { | 217 : public MediaControlDivElement { |
| 213 public: | 218 public: |
| 214 static MediaControlOverflowMenuListElement* create(MediaControls&); | 219 static MediaControlOverflowMenuListElement* create(MediaControls&); |
| 215 | 220 |
| 216 private: | 221 private: |
| 217 explicit MediaControlOverflowMenuListElement(MediaControls&); | 222 explicit MediaControlOverflowMenuListElement(MediaControls&); |
| 218 | 223 |
| 219 void defaultEventHandler(Event*) override; | 224 void defaultEventHandler(Event*) override; |
| 220 }; | 225 }; |
| 221 | 226 |
| 222 // ---------------------------- | 227 // ---------------------------- |
| 223 // Represents a button that allows users to download media if the file is | 228 // Represents a button that allows users to download media if the file is |
| 224 // downloadable. | 229 // downloadable. |
| 225 class MediaControlDownloadButtonElement final | 230 class CORE_EXPORT MediaControlDownloadButtonElement final |
| 226 : public MediaControlInputElement { | 231 : public MediaControlInputElement { |
| 227 public: | 232 public: |
| 228 static MediaControlDownloadButtonElement* create(MediaControls&); | 233 static MediaControlDownloadButtonElement* create(MediaControls&); |
| 229 | 234 |
| 230 WebLocalizedString::Name getOverflowStringName() override; | 235 WebLocalizedString::Name getOverflowStringName() override; |
| 231 | 236 |
| 232 bool hasOverflowButton() override { return true; } | 237 bool hasOverflowButton() override { return true; } |
| 233 | 238 |
| 234 // Returns true if the download button should be shown. We should | 239 // Returns true if the download button should be shown. We should |
| 235 // show the button for only non-MSE, non-EME, and non-MediaStream content. | 240 // show the button for only non-MSE, non-EME, and non-MediaStream content. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 255 Count // Keep last. | 260 Count // Keep last. |
| 256 }; | 261 }; |
| 257 void recordMetrics(DownloadActionMetrics); | 262 void recordMetrics(DownloadActionMetrics); |
| 258 | 263 |
| 259 // UMA related boolean. They are used to prevent counting something twice | 264 // UMA related boolean. They are used to prevent counting something twice |
| 260 // for the same media element. | 265 // for the same media element. |
| 261 bool m_clickUseCounted = false; | 266 bool m_clickUseCounted = false; |
| 262 bool m_showUseCounted = false; | 267 bool m_showUseCounted = false; |
| 263 }; | 268 }; |
| 264 | 269 |
| 265 class MediaControlTimelineElement final : public MediaControlInputElement { | 270 class CORE_EXPORT MediaControlTimelineElement final |
| 271 : public MediaControlInputElement { |
| 266 public: | 272 public: |
| 267 static MediaControlTimelineElement* create(MediaControls&); | 273 static MediaControlTimelineElement* create(MediaControls&); |
| 268 | 274 |
| 269 bool willRespondToMouseClickEvents() override; | 275 bool willRespondToMouseClickEvents() override; |
| 270 | 276 |
| 271 // FIXME: An "earliest possible position" will be needed once that concept | 277 // FIXME: An "earliest possible position" will be needed once that concept |
| 272 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 278 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
| 273 void setPosition(double); | 279 void setPosition(double); |
| 274 void setDuration(double); | 280 void setDuration(double); |
| 275 | 281 |
| 276 private: | 282 private: |
| 277 explicit MediaControlTimelineElement(MediaControls&); | 283 explicit MediaControlTimelineElement(MediaControls&); |
| 278 | 284 |
| 279 void defaultEventHandler(Event*) override; | 285 void defaultEventHandler(Event*) override; |
| 280 bool keepEventInNode(Event*) override; | 286 bool keepEventInNode(Event*) override; |
| 281 }; | 287 }; |
| 282 | 288 |
| 283 // ---------------------------- | 289 // ---------------------------- |
| 284 | 290 |
| 285 class MediaControlFullscreenButtonElement final | 291 class CORE_EXPORT MediaControlFullscreenButtonElement final |
| 286 : public MediaControlInputElement { | 292 : public MediaControlInputElement { |
| 287 public: | 293 public: |
| 288 static MediaControlFullscreenButtonElement* create(MediaControls&); | 294 static MediaControlFullscreenButtonElement* create(MediaControls&); |
| 289 | 295 |
| 290 bool willRespondToMouseClickEvents() override { return true; } | 296 bool willRespondToMouseClickEvents() override { return true; } |
| 291 | 297 |
| 292 void setIsFullscreen(bool); | 298 void setIsFullscreen(bool); |
| 293 | 299 |
| 294 WebLocalizedString::Name getOverflowStringName() override; | 300 WebLocalizedString::Name getOverflowStringName() override; |
| 295 | 301 |
| 296 bool hasOverflowButton() override { return true; } | 302 bool hasOverflowButton() override { return true; } |
| 297 | 303 |
| 298 private: | 304 private: |
| 299 explicit MediaControlFullscreenButtonElement(MediaControls&); | 305 explicit MediaControlFullscreenButtonElement(MediaControls&); |
| 300 | 306 |
| 301 void defaultEventHandler(Event*) override; | 307 void defaultEventHandler(Event*) override; |
| 302 }; | 308 }; |
| 303 | 309 |
| 304 // ---------------------------- | 310 // ---------------------------- |
| 305 | 311 |
| 306 class MediaControlCastButtonElement final : public MediaControlInputElement { | 312 class CORE_EXPORT MediaControlCastButtonElement final |
| 313 : public MediaControlInputElement { |
| 307 public: | 314 public: |
| 308 static MediaControlCastButtonElement* create(MediaControls&, | 315 static MediaControlCastButtonElement* create(MediaControls&, |
| 309 bool isOverlayButton); | 316 bool isOverlayButton); |
| 310 | 317 |
| 311 bool willRespondToMouseClickEvents() override { return true; } | 318 bool willRespondToMouseClickEvents() override { return true; } |
| 312 | 319 |
| 313 void setIsPlayingRemotely(bool); | 320 void setIsPlayingRemotely(bool); |
| 314 | 321 |
| 315 WebLocalizedString::Name getOverflowStringName() override; | 322 WebLocalizedString::Name getOverflowStringName() override; |
| 316 | 323 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 339 void recordMetrics(CastOverlayMetrics); | 346 void recordMetrics(CastOverlayMetrics); |
| 340 | 347 |
| 341 // UMA related boolean. They are used to prevent counting something twice | 348 // UMA related boolean. They are used to prevent counting something twice |
| 342 // for the same media element. | 349 // for the same media element. |
| 343 bool m_clickUseCounted = false; | 350 bool m_clickUseCounted = false; |
| 344 bool m_showUseCounted = false; | 351 bool m_showUseCounted = false; |
| 345 }; | 352 }; |
| 346 | 353 |
| 347 // ---------------------------- | 354 // ---------------------------- |
| 348 | 355 |
| 349 class MediaControlVolumeSliderElement final : public MediaControlInputElement { | 356 class CORE_EXPORT MediaControlVolumeSliderElement final |
| 357 : public MediaControlInputElement { |
| 350 public: | 358 public: |
| 351 static MediaControlVolumeSliderElement* create(MediaControls&); | 359 static MediaControlVolumeSliderElement* create(MediaControls&); |
| 352 | 360 |
| 353 bool willRespondToMouseMoveEvents() override; | 361 bool willRespondToMouseMoveEvents() override; |
| 354 bool willRespondToMouseClickEvents() override; | 362 bool willRespondToMouseClickEvents() override; |
| 355 void setVolume(double); | 363 void setVolume(double); |
| 356 | 364 |
| 357 private: | 365 private: |
| 358 explicit MediaControlVolumeSliderElement(MediaControls&); | 366 explicit MediaControlVolumeSliderElement(MediaControls&); |
| 359 | 367 |
| 360 void defaultEventHandler(Event*) override; | 368 void defaultEventHandler(Event*) override; |
| 361 bool keepEventInNode(Event*) override; | 369 bool keepEventInNode(Event*) override; |
| 362 }; | 370 }; |
| 363 | 371 |
| 364 // ---------------------------- | 372 // ---------------------------- |
| 365 | 373 |
| 366 class MediaControlTimeRemainingDisplayElement final | 374 class CORE_EXPORT MediaControlTimeRemainingDisplayElement final |
| 367 : public MediaControlTimeDisplayElement { | 375 : public MediaControlTimeDisplayElement { |
| 368 public: | 376 public: |
| 369 static MediaControlTimeRemainingDisplayElement* create(MediaControls&); | 377 static MediaControlTimeRemainingDisplayElement* create(MediaControls&); |
| 370 | 378 |
| 371 private: | 379 private: |
| 372 explicit MediaControlTimeRemainingDisplayElement(MediaControls&); | 380 explicit MediaControlTimeRemainingDisplayElement(MediaControls&); |
| 373 }; | 381 }; |
| 374 | 382 |
| 375 // ---------------------------- | 383 // ---------------------------- |
| 376 | 384 |
| 377 class MediaControlCurrentTimeDisplayElement final | 385 class CORE_EXPORT MediaControlCurrentTimeDisplayElement final |
| 378 : public MediaControlTimeDisplayElement { | 386 : public MediaControlTimeDisplayElement { |
| 379 public: | 387 public: |
| 380 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); | 388 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); |
| 381 | 389 |
| 382 private: | 390 private: |
| 383 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 391 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
| 384 }; | 392 }; |
| 385 | 393 |
| 386 } // namespace blink | 394 } // namespace blink |
| 387 | 395 |
| 388 #endif // MediaControlElements_h | 396 #endif // MediaControlElements_h |
| OLD | NEW |