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

Side by Side Diff: Source/core/html/MediaController.cpp

Issue 214793005: Use HTMLMediaElement::togglePlayState() where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: documentation Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/MediaControllerInterface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 bool MediaController::hasAudio() const 590 bool MediaController::hasAudio() const
591 { 591 {
592 for (size_t index = 0; index < m_mediaElements.size(); ++index) { 592 for (size_t index = 0; index < m_mediaElements.size(); ++index) {
593 if (m_mediaElements[index]->hasAudio()) 593 if (m_mediaElements[index]->hasAudio())
594 return true; 594 return true;
595 } 595 }
596 return false; 596 return false;
597 } 597 }
598 598
599 bool MediaController::canPlay() const
600 {
601 if (m_paused)
602 return true;
603
604 for (size_t index = 0; index < m_mediaElements.size(); ++index) {
605 if (!m_mediaElements[index]->canPlay())
606 return false;
607 }
608 return true;
609 }
610
611 const AtomicString& MediaController::interfaceName() const 599 const AtomicString& MediaController::interfaceName() const
612 { 600 {
613 return EventTargetNames::MediaController; 601 return EventTargetNames::MediaController;
614 } 602 }
615 603
616 // The spec says to fire periodic timeupdate events (those sent while playing) e very 604 // The spec says to fire periodic timeupdate events (those sent while playing) e very
617 // "15 to 250ms", we choose the slowest frequency 605 // "15 to 250ms", we choose the slowest frequency
618 static const double maxTimeupdateEventFrequency = 0.25; 606 static const double maxTimeupdateEventFrequency = 0.25;
619 607
620 void MediaController::startTimeupdateTimer() 608 void MediaController::startTimeupdateTimer()
(...skipping 13 matching lines...) Expand all
634 { 622 {
635 double now = WTF::currentTime(); 623 double now = WTF::currentTime();
636 double timedelta = now - m_previousTimeupdateTime; 624 double timedelta = now - m_previousTimeupdateTime;
637 625
638 if (timedelta < maxTimeupdateEventFrequency) 626 if (timedelta < maxTimeupdateEventFrequency)
639 return; 627 return;
640 628
641 scheduleEvent(EventTypeNames::timeupdate); 629 scheduleEvent(EventTypeNames::timeupdate);
642 m_previousTimeupdateTime = now; 630 m_previousTimeupdateTime = now;
643 } 631 }
OLDNEW
« no previous file with comments | « Source/core/html/MediaController.h ('k') | Source/core/html/MediaControllerInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698