Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef MediaControlElements_h | 30 #ifndef MediaControlElements_h |
| 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 #include <set> | |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 class TextTrack; | 38 class TextTrack; |
| 38 | 39 |
| 39 // ---------------------------- | 40 // ---------------------------- |
| 40 | 41 |
| 41 class MediaControlPanelElement final : public MediaControlDivElement { | 42 class MediaControlPanelElement final : public MediaControlDivElement { |
| 42 public: | 43 public: |
| 43 static MediaControlPanelElement* create(MediaControls&); | 44 static MediaControlPanelElement* create(MediaControls&); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 | 88 |
| 88 // ---------------------------- | 89 // ---------------------------- |
| 89 | 90 |
| 90 class MediaControlMuteButtonElement final : public MediaControlInputElement { | 91 class MediaControlMuteButtonElement final : public MediaControlInputElement { |
| 91 public: | 92 public: |
| 92 static MediaControlMuteButtonElement* create(MediaControls&); | 93 static MediaControlMuteButtonElement* create(MediaControls&); |
| 93 | 94 |
| 94 bool willRespondToMouseClickEvents() override { return true; } | 95 bool willRespondToMouseClickEvents() override { return true; } |
| 95 void updateDisplayType() override; | 96 void updateDisplayType() override; |
| 96 | 97 |
| 98 String getText() override; | |
| 99 | |
| 97 private: | 100 private: |
| 98 explicit MediaControlMuteButtonElement(MediaControls&); | 101 explicit MediaControlMuteButtonElement(MediaControls&); |
| 99 | 102 |
| 100 void defaultEventHandler(Event*) override; | 103 void defaultEventHandler(Event*) override; |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 // ---------------------------- | 106 // ---------------------------- |
| 104 | 107 |
| 105 class MediaControlPlayButtonElement final : public MediaControlInputElement { | 108 class MediaControlPlayButtonElement final : public MediaControlInputElement { |
| 106 public: | 109 public: |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 133 // ---------------------------- | 136 // ---------------------------- |
| 134 | 137 |
| 135 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement { | 138 class MediaControlToggleClosedCaptionsButtonElement final : public MediaControlI nputElement { |
| 136 public: | 139 public: |
| 137 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ; | 140 static MediaControlToggleClosedCaptionsButtonElement* create(MediaControls&) ; |
| 138 | 141 |
| 139 bool willRespondToMouseClickEvents() override { return true; } | 142 bool willRespondToMouseClickEvents() override { return true; } |
| 140 | 143 |
| 141 void updateDisplayType() override; | 144 void updateDisplayType() override; |
| 142 | 145 |
| 146 String getText() override; | |
| 147 | |
| 143 private: | 148 private: |
| 144 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); | 149 explicit MediaControlToggleClosedCaptionsButtonElement(MediaControls&); |
| 145 | 150 |
| 146 void defaultEventHandler(Event*) override; | 151 void defaultEventHandler(Event*) override; |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 // ---------------------------- | 154 // ---------------------------- |
| 150 | 155 |
| 151 class MediaControlTextTrackListElement final : public MediaControlDivElement { | 156 class MediaControlTextTrackListElement final : public MediaControlDivElement { |
| 152 public: | 157 public: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 166 // Returns the label for the track when a valid track is passed in and "Off" when the parameter is null. | 171 // Returns the label for the track when a valid track is passed in and "Off" when the parameter is null. |
| 167 String getTextTrackLabel(TextTrack*); | 172 String getTextTrackLabel(TextTrack*); |
| 168 // Creates the track element in the list when a valid track is passed in and the "Off" item when the parameter is null. | 173 // Creates the track element in the list when a valid track is passed in and the "Off" item when the parameter is null. |
| 169 Element* createTextTrackListItem(TextTrack*); | 174 Element* createTextTrackListItem(TextTrack*); |
| 170 | 175 |
| 171 void showTextTrackAtIndex(unsigned); | 176 void showTextTrackAtIndex(unsigned); |
| 172 void disableShowingTextTracks(); | 177 void disableShowingTextTracks(); |
| 173 }; | 178 }; |
| 174 | 179 |
| 175 // ---------------------------- | 180 // ---------------------------- |
| 181 // Represents the overflow menu which is displayed when the width of the media | |
| 182 // player is small enough that at least two buttons are no longer visible. | |
| 183 class MediaControlOverflowMenu final : public MediaControlInputElement { | |
|
liberato (no reviews please)
2016/08/24 16:44:22
might want to include "Button" in the class name.
kdsilva
2016/08/26 18:11:03
Done.
| |
| 184 public: | |
| 185 static MediaControlOverflowMenu* create(MediaControls&); | |
| 186 | |
| 187 // The overflow button should respond to mouse clicks since we want a click | |
| 188 // to open up the menu. | |
| 189 bool willRespondToMouseClickEvents() override { return true; } | |
| 190 | |
| 191 private: | |
| 192 explicit MediaControlOverflowMenu(MediaControls&); | |
| 193 | |
| 194 void defaultEventHandler(Event*) override; | |
| 195 }; | |
| 196 | |
| 197 // ---------------------------- | |
| 198 // Holds a list of elements within the overflow menu. | |
| 199 class MediaControlOverflowMenuListElement final : public MediaControlDivElement { | |
| 200 public: | |
| 201 static MediaControlOverflowMenuListElement* create(MediaControls&); | |
| 202 | |
| 203 // A set of the MediaControlElementTypes that should appear in the | |
| 204 // overflow menu. | |
| 205 void setOverflowMenuControls(const std::set<MediaControlElementType>*); | |
| 206 | |
| 207 // True to display overflow menu, false to hide. | |
| 208 void showOverflowMenu(bool); | |
| 209 | |
| 210 private: | |
| 211 explicit MediaControlOverflowMenuListElement(MediaControls&); | |
| 212 | |
| 213 void defaultEventHandler(Event*) override; | |
| 214 }; | |
| 215 | |
| 216 // ---------------------------- | |
| 176 | 217 |
| 177 class MediaControlTimelineElement final : public MediaControlInputElement { | 218 class MediaControlTimelineElement final : public MediaControlInputElement { |
| 178 public: | 219 public: |
| 179 static MediaControlTimelineElement* create(MediaControls&); | 220 static MediaControlTimelineElement* create(MediaControls&); |
| 180 | 221 |
| 181 bool willRespondToMouseClickEvents() override; | 222 bool willRespondToMouseClickEvents() override; |
| 182 | 223 |
| 183 // FIXME: An "earliest possible position" will be needed once that concept | 224 // FIXME: An "earliest possible position" will be needed once that concept |
| 184 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 225 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
| 185 void setPosition(double); | 226 void setPosition(double); |
| 186 void setDuration(double); | 227 void setDuration(double); |
| 187 | |
| 188 private: | 228 private: |
| 189 explicit MediaControlTimelineElement(MediaControls&); | 229 explicit MediaControlTimelineElement(MediaControls&); |
| 190 | 230 |
| 191 void defaultEventHandler(Event*) override; | 231 void defaultEventHandler(Event*) override; |
| 192 bool keepEventInNode(Event*) override; | 232 bool keepEventInNode(Event*) override; |
| 193 }; | 233 }; |
| 194 | 234 |
| 195 // ---------------------------- | 235 // ---------------------------- |
| 196 | 236 |
| 197 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { | 237 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { |
| 198 public: | 238 public: |
| 199 static MediaControlFullscreenButtonElement* create(MediaControls&); | 239 static MediaControlFullscreenButtonElement* create(MediaControls&); |
| 200 | 240 |
| 201 bool willRespondToMouseClickEvents() override { return true; } | 241 bool willRespondToMouseClickEvents() override { return true; } |
| 202 | 242 |
| 203 void setIsFullscreen(bool); | 243 void setIsFullscreen(bool); |
| 204 | 244 |
| 245 String getText() override; | |
| 246 | |
| 205 private: | 247 private: |
| 206 explicit MediaControlFullscreenButtonElement(MediaControls&); | 248 explicit MediaControlFullscreenButtonElement(MediaControls&); |
| 207 | 249 |
| 208 void defaultEventHandler(Event*) override; | 250 void defaultEventHandler(Event*) override; |
| 209 }; | 251 }; |
| 210 | 252 |
| 211 // ---------------------------- | 253 // ---------------------------- |
| 212 | 254 |
| 213 class MediaControlCastButtonElement final : public MediaControlInputElement { | 255 class MediaControlCastButtonElement final : public MediaControlInputElement { |
| 214 public: | 256 public: |
| 215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); | 257 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); |
| 216 | 258 |
| 217 bool willRespondToMouseClickEvents() override { return true; } | 259 bool willRespondToMouseClickEvents() override { return true; } |
| 218 | 260 |
| 219 void setIsPlayingRemotely(bool); | 261 void setIsPlayingRemotely(bool); |
| 220 | 262 |
| 263 String getText() override; | |
| 264 | |
| 221 // This will show a cast button if it is not covered by another element. | 265 // This will show a cast button if it is not covered by another element. |
| 222 // This MUST be called for cast button elements that are overlay elements. | 266 // This MUST be called for cast button elements that are overlay elements. |
| 223 void tryShowOverlay(); | 267 void tryShowOverlay(); |
| 224 | 268 |
| 225 private: | 269 private: |
| 226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; | 270 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; |
| 227 | 271 |
| 228 const AtomicString& shadowPseudoId() const override; | 272 const AtomicString& shadowPseudoId() const override; |
| 229 void defaultEventHandler(Event*) override; | 273 void defaultEventHandler(Event*) override; |
| 230 bool keepEventInNode(Event*) override; | 274 bool keepEventInNode(Event*) override; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 public: | 324 public: |
| 281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); | 325 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); |
| 282 | 326 |
| 283 private: | 327 private: |
| 284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 328 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
| 285 }; | 329 }; |
| 286 | 330 |
| 287 } // namespace blink | 331 } // namespace blink |
| 288 | 332 |
| 289 #endif // MediaControlElements_h | 333 #endif // MediaControlElements_h |
| OLD | NEW |