Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: Source/core/html/HTMLMediaElement.h

Issue 59233014: Setting HTMLMediaElement.controller does not properly remove the 'mediagroup' content attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix bug found by Philipj Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 #if ENABLE(WEB_AUDIO) 268 #if ENABLE(WEB_AUDIO)
269 MediaElementAudioSourceNode* audioSourceNode() { return m_audioSourceNode; } 269 MediaElementAudioSourceNode* audioSourceNode() { return m_audioSourceNode; }
270 void setAudioSourceNode(MediaElementAudioSourceNode*); 270 void setAudioSourceNode(MediaElementAudioSourceNode*);
271 271
272 AudioSourceProvider* audioSourceProvider(); 272 AudioSourceProvider* audioSourceProvider();
273 #endif 273 #endif
274 274
275 enum InvalidURLAction { DoNothing, Complain }; 275 enum InvalidURLAction { DoNothing, Complain };
276 bool isSafeToLoadURL(const KURL&, InvalidURLAction); 276 bool isSafeToLoadURL(const KURL&, InvalidURLAction);
277 277
278 const String& mediaGroup() const;
279 void setMediaGroup(const String&);
280
281 MediaController* controller() const; 278 MediaController* controller() const;
282 void setController(PassRefPtr<MediaController>); 279 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an d sets the MediaController.
283 280
284 protected: 281 protected:
285 HTMLMediaElement(const QualifiedName&, Document&, bool); 282 HTMLMediaElement(const QualifiedName&, Document&, bool);
286 virtual ~HTMLMediaElement(); 283 virtual ~HTMLMediaElement();
287 284
288 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 285 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
289 virtual void finishParsingChildren() OVERRIDE; 286 virtual void finishParsingChildren() OVERRIDE;
290 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 287 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
291 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 288 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
292 289
293 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 290 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
294 291
295 enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video }; 292 enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video };
296 DisplayMode displayMode() const { return m_displayMode; } 293 DisplayMode displayMode() const { return m_displayMode; }
297 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 294 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
298 295
299 virtual bool isMediaElement() const OVERRIDE { return true; } 296 virtual bool isMediaElement() const OVERRIDE { return true; }
300 297
298 void setControllerInternal(PassRefPtr<MediaController>);
299
301 // Restrictions to change default behaviors. 300 // Restrictions to change default behaviors.
302 enum BehaviorRestrictionFlags { 301 enum BehaviorRestrictionFlags {
303 NoRestrictions = 0, 302 NoRestrictions = 0,
304 RequireUserGestureForLoadRestriction = 1 << 0, 303 RequireUserGestureForLoadRestriction = 1 << 0,
305 RequireUserGestureForRateChangeRestriction = 1 << 1, 304 RequireUserGestureForRateChangeRestriction = 1 << 1,
306 RequireUserGestureForFullscreenRestriction = 1 << 2, 305 RequireUserGestureForFullscreenRestriction = 1 << 2,
307 RequirePageConsentToLoadMediaRestriction = 1 << 3, 306 RequirePageConsentToLoadMediaRestriction = 1 << 3,
308 }; 307 };
309 typedef unsigned BehaviorRestrictions; 308 typedef unsigned BehaviorRestrictions;
310 309
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 443
445 void prepareMediaFragmentURI(); 444 void prepareMediaFragmentURI();
446 void applyMediaFragmentURI(); 445 void applyMediaFragmentURI();
447 446
448 virtual void* preDispatchEventHandler(Event*) OVERRIDE; 447 virtual void* preDispatchEventHandler(Event*) OVERRIDE;
449 448
450 void changeNetworkStateFromLoadingToIdle(); 449 void changeNetworkStateFromLoadingToIdle();
451 450
452 void removeBehaviorsRestrictionsAfterFirstUserGesture(); 451 void removeBehaviorsRestrictionsAfterFirstUserGesture();
453 452
453 const AtomicString& mediaGroup() const;
454 void setMediaGroup(const AtomicString&);
454 void updateMediaController(); 455 void updateMediaController();
455 bool isBlocked() const; 456 bool isBlocked() const;
456 bool isBlockedOnMediaController() const; 457 bool isBlockedOnMediaController() const;
457 bool hasCurrentSrc() const { return !m_currentSrc.isEmpty(); } 458 bool hasCurrentSrc() const { return !m_currentSrc.isEmpty(); }
458 bool isAutoplaying() const { return m_autoplaying; } 459 bool isAutoplaying() const { return m_autoplaying; }
459 460
460 Timer<HTMLMediaElement> m_loadTimer; 461 Timer<HTMLMediaElement> m_loadTimer;
461 Timer<HTMLMediaElement> m_progressEventTimer; 462 Timer<HTMLMediaElement> m_progressEventTimer;
462 Timer<HTMLMediaElement> m_playbackProgressTimer; 463 Timer<HTMLMediaElement> m_playbackProgressTimer;
463 RefPtr<TimeRanges> m_playedTimeRanges; 464 RefPtr<TimeRanges> m_playedTimeRanges;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 CueList m_currentlyActiveCues; 552 CueList m_currentlyActiveCues;
552 int m_ignoreTrackDisplayUpdate; 553 int m_ignoreTrackDisplayUpdate;
553 554
554 #if ENABLE(WEB_AUDIO) 555 #if ENABLE(WEB_AUDIO)
555 // This is a weak reference, since m_audioSourceNode holds a reference to us . 556 // This is a weak reference, since m_audioSourceNode holds a reference to us .
556 // The value is set just after the MediaElementAudioSourceNode is created. 557 // The value is set just after the MediaElementAudioSourceNode is created.
557 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode(). 558 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode().
558 MediaElementAudioSourceNode* m_audioSourceNode; 559 MediaElementAudioSourceNode* m_audioSourceNode;
559 #endif 560 #endif
560 561
561 String m_mediaGroup;
562 friend class MediaController; 562 friend class MediaController;
563 RefPtr<MediaController> m_mediaController; 563 RefPtr<MediaController> m_mediaController;
564 564
565 friend class TrackDisplayUpdateScope; 565 friend class TrackDisplayUpdateScope;
566 566
567 #if ENABLE(ENCRYPTED_MEDIA_V2) 567 #if ENABLE(ENCRYPTED_MEDIA_V2)
568 RefPtr<MediaKeys> m_mediaKeys; 568 RefPtr<MediaKeys> m_mediaKeys;
569 #endif 569 #endif
570 }; 570 };
571 571
(...skipping 24 matching lines...) Expand all
596 inline bool isHTMLMediaElement(const Node& node) 596 inline bool isHTMLMediaElement(const Node& node)
597 { 597 {
598 return node.isElementNode() && toElement(node).isMediaElement(); 598 return node.isElementNode() && toElement(node).isMediaElement();
599 } 599 }
600 600
601 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 601 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
602 602
603 } //namespace 603 } //namespace
604 604
605 #endif 605 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698