Home | History | Annotate | Download | only in media
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "content/renderer/media/webinbandtexttrack_impl.h"
      6 
      7 #include "base/logging.h"
      8 
      9 namespace content {
     10 
     11 WebInbandTextTrackImpl::WebInbandTextTrackImpl(
     12     Kind kind,
     13     const WebKit::WebString& label,
     14     const WebKit::WebString& language,
     15     int index)
     16     : client_(NULL),
     17       mode_(ModeDisabled),
     18       kind_(kind),
     19       label_(label),
     20       language_(language),
     21       index_(index) {
     22 }
     23 
     24 WebInbandTextTrackImpl::~WebInbandTextTrackImpl() {
     25   DCHECK(!client_);
     26 }
     27 
     28 void WebInbandTextTrackImpl::setClient(
     29     WebKit::WebInbandTextTrackClient* client) {
     30   client_ = client;
     31 }
     32 
     33 WebKit::WebInbandTextTrackClient* WebInbandTextTrackImpl::client() {
     34   return client_;
     35 }
     36 
     37 void WebInbandTextTrackImpl::setMode(Mode mode) {
     38   mode_ = mode;
     39 }
     40 
     41 WebInbandTextTrackImpl::Mode WebInbandTextTrackImpl::mode() const {
     42   return mode_;
     43 }
     44 
     45 WebInbandTextTrackImpl::Kind WebInbandTextTrackImpl::kind() const {
     46   return kind_;
     47 }
     48 
     49 bool WebInbandTextTrackImpl::isClosedCaptions() const {
     50   switch (kind_) {
     51   case KindCaptions:
     52   case KindSubtitles:
     53     return true;
     54 
     55   default:
     56     return false;
     57   }
     58 }
     59 
     60 WebKit::WebString WebInbandTextTrackImpl::label() const {
     61   return label_;
     62 }
     63 
     64 WebKit::WebString WebInbandTextTrackImpl::language() const {
     65   return language_;
     66 }
     67 
     68 bool WebInbandTextTrackImpl::isDefault() const {
     69   return false;
     70 }
     71 
     72 int WebInbandTextTrackImpl::textTrackIndex() const {
     73   return index_;
     74 }
     75 
     76 }  // namespace content
     77