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> | |
|
whywhat
2016/08/19 23:56:55
nit: empty line between system and project include
kdsilva
2016/08/24 05:33:26
If I change the ordering, I get a presubmit error.
whywhat
2016/08/26 20:57:26
Ok, presubmit check is the ultimate source of trut
| |
| 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; | |
|
whywhat
2016/08/19 23:56:55
This returns the user visible text, right? If so,
kdsilva
2016/08/24 05:33:26
Done, I think...
I followed what closed captions
whywhat
2016/08/26 20:57:26
looks good
| |
| 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 { return "Captions"; } | |
|
whywhat
2016/08/19 23:56:55
I don't think we should inline string literals in
kdsilva
2016/08/24 05:33:26
Done.
| |
| 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 14 matching lines...) Expand all Loading... | |
| 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 // ---------------------------- |
| 176 | 181 |
| 182 class MediaControlOverflowMenu final : public MediaControlInputElement { | |
|
whywhat
2016/08/19 23:56:55
nit: please add some comments to the new classes a
kdsilva
2016/08/24 05:33:26
Done.
| |
| 183 public: | |
| 184 static MediaControlOverflowMenu* create(MediaControls&); | |
| 185 | |
| 186 bool willRespondToMouseClickEvents() override { return true; } | |
| 187 | |
| 188 private: | |
| 189 explicit MediaControlOverflowMenu(MediaControls&); | |
| 190 | |
| 191 void defaultEventHandler(Event*) override; | |
| 192 }; | |
| 193 | |
| 194 // ---------------------------- | |
| 195 | |
| 196 class MediaControlOverflowMenuListElement final : public MediaControlDivElement { | |
| 197 public: | |
| 198 static MediaControlOverflowMenuListElement* create(MediaControls&); | |
| 199 | |
| 200 // A set of the MediaControlElementTypes that should appear in the | |
| 201 // overflow menu. | |
| 202 void setOverflowMenuControls(std::set<MediaControlElementType>); | |
|
whywhat
2016/08/19 23:56:55
can you pass the set by (const) reference?
kdsilva
2016/08/24 05:33:26
Done.
| |
| 203 | |
| 204 void setVisible(bool); | |
| 205 | |
| 206 private: | |
| 207 explicit MediaControlOverflowMenuListElement(MediaControls&); | |
| 208 | |
| 209 void defaultEventHandler(Event*) override; | |
| 210 }; | |
| 211 | |
| 212 // ---------------------------- | |
| 213 | |
| 177 class MediaControlTimelineElement final : public MediaControlInputElement { | 214 class MediaControlTimelineElement final : public MediaControlInputElement { |
| 178 public: | 215 public: |
| 179 static MediaControlTimelineElement* create(MediaControls&); | 216 static MediaControlTimelineElement* create(MediaControls&); |
| 180 | 217 |
| 181 bool willRespondToMouseClickEvents() override; | 218 bool willRespondToMouseClickEvents() override; |
| 182 | 219 |
| 183 // FIXME: An "earliest possible position" will be needed once that concept | 220 // FIXME: An "earliest possible position" will be needed once that concept |
| 184 // is supported by HTMLMediaElement, see https://crbug.com/137275 | 221 // is supported by HTMLMediaElement, see https://crbug.com/137275 |
| 185 void setPosition(double); | 222 void setPosition(double); |
| 186 void setDuration(double); | 223 void setDuration(double); |
| 187 | |
| 188 private: | 224 private: |
| 189 explicit MediaControlTimelineElement(MediaControls&); | 225 explicit MediaControlTimelineElement(MediaControls&); |
| 190 | 226 |
| 191 void defaultEventHandler(Event*) override; | 227 void defaultEventHandler(Event*) override; |
| 192 bool keepEventInNode(Event*) override; | 228 bool keepEventInNode(Event*) override; |
| 193 }; | 229 }; |
| 194 | 230 |
| 195 // ---------------------------- | 231 // ---------------------------- |
| 196 | 232 |
| 197 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { | 233 class MediaControlFullscreenButtonElement final : public MediaControlInputElemen t { |
| 198 public: | 234 public: |
| 199 static MediaControlFullscreenButtonElement* create(MediaControls&); | 235 static MediaControlFullscreenButtonElement* create(MediaControls&); |
| 200 | 236 |
| 201 bool willRespondToMouseClickEvents() override { return true; } | 237 bool willRespondToMouseClickEvents() override { return true; } |
| 202 | 238 |
| 203 void setIsFullscreen(bool); | 239 void setIsFullscreen(bool); |
| 204 | 240 |
| 241 String getText() override { return "Full Screen"; } | |
|
whywhat
2016/08/19 23:56:55
nit: I believe Fullscreen is one word?
kdsilva
2016/08/24 05:33:26
Done.
| |
| 242 | |
| 205 private: | 243 private: |
| 206 explicit MediaControlFullscreenButtonElement(MediaControls&); | 244 explicit MediaControlFullscreenButtonElement(MediaControls&); |
| 207 | 245 |
| 208 void defaultEventHandler(Event*) override; | 246 void defaultEventHandler(Event*) override; |
| 209 }; | 247 }; |
| 210 | 248 |
| 211 // ---------------------------- | 249 // ---------------------------- |
| 212 | 250 |
| 213 class MediaControlCastButtonElement final : public MediaControlInputElement { | 251 class MediaControlCastButtonElement final : public MediaControlInputElement { |
| 214 public: | 252 public: |
| 215 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); | 253 static MediaControlCastButtonElement* create(MediaControls&, bool isOverlayB utton); |
| 216 | 254 |
| 217 bool willRespondToMouseClickEvents() override { return true; } | 255 bool willRespondToMouseClickEvents() override { return true; } |
| 218 | 256 |
| 219 void setIsPlayingRemotely(bool); | 257 void setIsPlayingRemotely(bool); |
| 220 | 258 |
| 259 String getText() override; | |
| 260 | |
| 221 // This will show a cast button if it is not covered by another element. | 261 // 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. | 262 // This MUST be called for cast button elements that are overlay elements. |
| 223 void tryShowOverlay(); | 263 void tryShowOverlay(); |
| 224 | 264 |
| 225 private: | 265 private: |
| 226 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; | 266 explicit MediaControlCastButtonElement(MediaControls&, bool isOverlayButton) ; |
| 227 | 267 |
| 228 const AtomicString& shadowPseudoId() const override; | 268 const AtomicString& shadowPseudoId() const override; |
| 229 void defaultEventHandler(Event*) override; | 269 void defaultEventHandler(Event*) override; |
| 230 bool keepEventInNode(Event*) override; | 270 bool keepEventInNode(Event*) override; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 public: | 320 public: |
| 281 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); | 321 static MediaControlCurrentTimeDisplayElement* create(MediaControls&); |
| 282 | 322 |
| 283 private: | 323 private: |
| 284 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); | 324 explicit MediaControlCurrentTimeDisplayElement(MediaControls&); |
| 285 }; | 325 }; |
| 286 | 326 |
| 287 } // namespace blink | 327 } // namespace blink |
| 288 | 328 |
| 289 #endif // MediaControlElements_h | 329 #endif // MediaControlElements_h |
| OLD | NEW |