Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #define WEBKIT_IMPLEMENTATION 1 | |
| 32 #include <wtf/ExportMacros.h> | |
| 33 #include "InbandTextTrackPrivateImpl.h" | |
| 34 #include "WebInbandTextTrack.h" | |
| 35 #define WEBKIT_IMPLEMENTATION 1 | |
| 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | |
| 37 | |
| 38 namespace WebKit { | |
| 39 | |
| 40 InbandTextTrackPrivateImpl::InbandTextTrackPrivateImpl( | |
| 41 WebInbandTextTrack* track) | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
nit: Blink style doesn't require 80-col wrap for s
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 42 : m_track(track) | |
| 43 { | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
nit: Add ASSERT(!m_track); here and remove all m_t
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 44 } | |
| 45 | |
| 46 InbandTextTrackPrivateImpl::~InbandTextTrackPrivateImpl() | |
| 47 { | |
| 48 } | |
| 49 | |
| 50 void InbandTextTrackPrivateImpl::setClient( | |
| 51 WebCore::InbandTextTrackPrivateClient* client) | |
| 52 { | |
| 53 if (!m_track) | |
| 54 return; | |
| 55 | |
| 56 // TODO(matthewjheaney): not sure what to do here yet | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
At a minimum you need to store the pointer so clie
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 57 //m_track->setClient(client); | |
| 58 // For now: | |
| 59 m_track->setClient(NULL); | |
| 60 } | |
| 61 | |
| 62 WebCore::InbandTextTrackPrivateClient* InbandTextTrackPrivateImpl::client() | |
| 63 { | |
| 64 if (!m_track) | |
| 65 return NULL; // TODO(matthewjheaney): is this really correct? | |
| 66 | |
| 67 // TODO(matthewjheaney): not sure how to handle this yet | |
| 68 //return m_track->client(); | |
| 69 // For now: | |
| 70 return NULL; | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
Update to return m_client.
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 71 } | |
| 72 | |
| 73 void InbandTextTrackPrivateImpl::setMode(Mode mode) | |
| 74 { | |
| 75 if (!m_track) | |
| 76 return; | |
| 77 | |
| 78 const WebInbandTextTrack::Mode mode_map[] = | |
| 79 { | |
| 80 WebInbandTextTrack::Disabled, | |
| 81 WebInbandTextTrack::Hidden, | |
| 82 WebInbandTextTrack::Showing | |
| 83 }; | |
| 84 | |
| 85 const WebInbandTextTrack::Mode m = mode_map[mode]; | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
nit: Use a static_cast and there is no need for a
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 86 | |
| 87 m_track->setMode(m); | |
| 88 } | |
| 89 | |
| 90 WebCore::InbandTextTrackPrivate::Mode InbandTextTrackPrivateImpl::mode() const | |
| 91 { | |
| 92 typedef WebCore::InbandTextTrackPrivate T; | |
| 93 | |
| 94 if (!m_track) | |
| 95 // TODO(matthewjheaney): correct? | |
| 96 return T::Disabled; | |
| 97 | |
| 98 const T::Mode mode_map[] = | |
| 99 { | |
| 100 T::Disabled, | |
| 101 T::Hidden, | |
| 102 T::Showing | |
| 103 }; | |
| 104 | |
| 105 const T::Mode result = mode_map[m_track->mode()]; | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
ditto
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 106 return result; | |
| 107 } | |
| 108 | |
| 109 WebCore::InbandTextTrackPrivate::Kind InbandTextTrackPrivateImpl::kind() const | |
| 110 { | |
| 111 typedef WebCore::InbandTextTrackPrivate T; | |
| 112 | |
| 113 if (!m_track) | |
| 114 // TODO(matthewjheaney): correct? | |
| 115 return T::None; | |
| 116 | |
| 117 const T::Kind kind_map[] = | |
| 118 { | |
| 119 T::Subtitles, | |
| 120 T::Captions, | |
| 121 T::Descriptions, | |
| 122 T::Chapters, | |
| 123 T::Metadata, | |
| 124 T::None | |
| 125 }; | |
| 126 | |
| 127 const T::Kind result = kind_map[m_track->kind()]; | |
|
acolwell GONE FROM CHROMIUM
2013/04/17 00:13:56
ditto
Matthew Heaney (Chromium)
2013/04/18 23:15:42
Done.
| |
| 128 return result; | |
| 129 } | |
| 130 | |
| 131 bool InbandTextTrackPrivateImpl::isClosedCaptions() | |
| 132 { | |
| 133 if (!m_track) | |
| 134 return false; // TODO(matthewjheaney): correct value? | |
| 135 | |
| 136 return m_track->isClosedCaptions(); | |
| 137 } | |
| 138 | |
| 139 AtomicString InbandTextTrackPrivateImpl::label() const | |
| 140 { | |
| 141 if (!m_track) | |
| 142 return AtomicString(); // TODO(matthewjheaney): correct? | |
| 143 | |
| 144 return m_track->label(); | |
| 145 } | |
| 146 | |
| 147 AtomicString InbandTextTrackPrivateImpl::language() const | |
| 148 { | |
| 149 if (!m_track) | |
| 150 return AtomicString(); // TODO(matthewjheaney): "eng" perhaps? | |
| 151 | |
| 152 return m_track->language(); | |
| 153 } | |
| 154 | |
| 155 bool InbandTextTrackPrivateImpl::isDefault() const | |
| 156 { | |
| 157 if (!m_track) | |
| 158 return false; // TODO(matthewjheaney): correct? | |
| 159 | |
| 160 return m_track->isDefault(); | |
| 161 } | |
| 162 | |
| 163 int InbandTextTrackPrivateImpl::textTrackIndex() const | |
| 164 { | |
| 165 if (!m_track) | |
| 166 return 0; // TODO(matthewjheaney): correct? | |
| 167 | |
| 168 return m_track->textTrackIndex(); | |
| 169 } | |
| 170 | |
| 171 } // namespace WebKit | |
| OLD | NEW |