1/* 2 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Cable Television Labs, Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#ifndef TrackPrivateBase_h 29#define TrackPrivateBase_h 30 31#include <wtf/Forward.h> 32#include <wtf/Noncopyable.h> 33#include <wtf/RefCounted.h> 34#include <wtf/text/AtomicString.h> 35 36#if ENABLE(VIDEO_TRACK) 37 38namespace WebCore { 39 40class TrackPrivateBase; 41 42class TrackPrivateBaseClient { 43public: 44 virtual ~TrackPrivateBaseClient() { } 45 virtual void idChanged(TrackPrivateBase*, const AtomicString&) = 0; 46 virtual void labelChanged(TrackPrivateBase*, const AtomicString&) = 0; 47 virtual void languageChanged(TrackPrivateBase*, const AtomicString&) = 0; 48 virtual void willRemove(TrackPrivateBase*) = 0; 49}; 50 51class TrackPrivateBase : public RefCounted<TrackPrivateBase> { 52 WTF_MAKE_NONCOPYABLE(TrackPrivateBase); WTF_MAKE_FAST_ALLOCATED; 53public: 54 virtual ~TrackPrivateBase() { } 55 56 virtual TrackPrivateBaseClient* client() const = 0; 57 58 virtual AtomicString id() const { return emptyAtom; } 59 virtual AtomicString label() const { return emptyAtom; } 60 virtual AtomicString language() const { return emptyAtom; } 61 62 virtual int trackIndex() const { return 0; } 63 64 virtual double startTimeVariance() const { return 0; } 65 66 void willBeRemoved() 67 { 68 if (TrackPrivateBaseClient* client = this->client()) 69 client->willRemove(this); 70 } 71 72protected: 73 TrackPrivateBase() { } 74}; 75 76} // namespace WebCore 77 78#endif 79#endif 80