| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
| 7 | 7 |
| 8 #include "MediaSourcePrivateImpl.h" | |
| 9 #include "WebDocument.h" | 8 #include "WebDocument.h" |
| 10 #include "WebFrameClient.h" | 9 #include "WebFrameClient.h" |
| 11 #include "WebFrameImpl.h" | 10 #include "WebFrameImpl.h" |
| 12 #include "WebHelperPluginImpl.h" | 11 #include "WebHelperPluginImpl.h" |
| 13 #include "WebInbandTextTrack.h" | 12 #include "WebInbandTextTrack.h" |
| 14 #include "WebMediaPlayer.h" | 13 #include "WebMediaPlayer.h" |
| 15 #include "WebViewImpl.h" | 14 #include "WebViewImpl.h" |
| 16 #include "core/html/HTMLMediaElement.h" | 15 #include "core/html/HTMLMediaElement.h" |
| 17 #include "core/html/HTMLMediaSource.h" | 16 #include "core/html/HTMLMediaSource.h" |
| 18 #include "core/html/TimeRanges.h" | 17 #include "core/html/TimeRanges.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 197 } |
| 199 | 198 |
| 200 void WebMediaPlayerClientImpl::removeTextTrack(WebInbandTextTrack* textTrack) | 199 void WebMediaPlayerClientImpl::removeTextTrack(WebInbandTextTrack* textTrack) |
| 201 { | 200 { |
| 202 m_client->mediaPlayerDidRemoveTrack(textTrack); | 201 m_client->mediaPlayerDidRemoveTrack(textTrack); |
| 203 } | 202 } |
| 204 | 203 |
| 205 void WebMediaPlayerClientImpl::mediaSourceOpened(WebMediaSource* webMediaSource) | 204 void WebMediaPlayerClientImpl::mediaSourceOpened(WebMediaSource* webMediaSource) |
| 206 { | 205 { |
| 207 ASSERT(webMediaSource); | 206 ASSERT(webMediaSource); |
| 208 m_mediaSource->setPrivateAndOpen(adoptPtr(new MediaSourcePrivateImpl(adoptPt
r(webMediaSource)))); | 207 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
| 209 } | 208 } |
| 210 | 209 |
| 211 void WebMediaPlayerClientImpl::requestFullscreen() | 210 void WebMediaPlayerClientImpl::requestFullscreen() |
| 212 { | 211 { |
| 213 m_client->mediaPlayerRequestFullscreen(); | 212 m_client->mediaPlayerRequestFullscreen(); |
| 214 } | 213 } |
| 215 | 214 |
| 216 void WebMediaPlayerClientImpl::requestSeek(double time) | 215 void WebMediaPlayerClientImpl::requestSeek(double time) |
| 217 { | 216 { |
| 218 m_client->mediaPlayerRequestSeek(time); | 217 m_client->mediaPlayerRequestSeek(time); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 459 |
| 461 double WebMediaPlayerClientImpl::maxTimeSeekable() const | 460 double WebMediaPlayerClientImpl::maxTimeSeekable() const |
| 462 { | 461 { |
| 463 if (m_webMediaPlayer) | 462 if (m_webMediaPlayer) |
| 464 return m_webMediaPlayer->maxTimeSeekable(); | 463 return m_webMediaPlayer->maxTimeSeekable(); |
| 465 return 0.0; | 464 return 0.0; |
| 466 } | 465 } |
| 467 | 466 |
| 468 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const | 467 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const |
| 469 { | 468 { |
| 470 if (m_webMediaPlayer) { | 469 if (m_webMediaPlayer) |
| 471 const WebTimeRanges& webRanges = m_webMediaPlayer->buffered(); | 470 return TimeRanges::create(m_webMediaPlayer->buffered()); |
| 472 | |
| 473 // FIXME: Save the time ranges in a member variable and update it when n
eeded. | |
| 474 RefPtr<TimeRanges> ranges = TimeRanges::create(); | |
| 475 for (size_t i = 0; i < webRanges.size(); ++i) | |
| 476 ranges->add(webRanges[i].start, webRanges[i].end); | |
| 477 return ranges.release(); | |
| 478 } | |
| 479 return TimeRanges::create(); | 471 return TimeRanges::create(); |
| 480 } | 472 } |
| 481 | 473 |
| 482 bool WebMediaPlayerClientImpl::didLoadingProgress() const | 474 bool WebMediaPlayerClientImpl::didLoadingProgress() const |
| 483 { | 475 { |
| 484 return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress(); | 476 return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress(); |
| 485 } | 477 } |
| 486 | 478 |
| 487 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
ct) | 479 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
ct) |
| 488 { | 480 { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 739 |
| 748 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 740 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
| 749 { | 741 { |
| 750 if (m_client) | 742 if (m_client) |
| 751 m_client->setFormat(numberOfChannels, sampleRate); | 743 m_client->setFormat(numberOfChannels, sampleRate); |
| 752 } | 744 } |
| 753 | 745 |
| 754 #endif | 746 #endif |
| 755 | 747 |
| 756 } // namespace blink | 748 } // namespace blink |
| OLD | NEW |