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

Side by Side Diff: webkit/api/src/WebMediaPlayerClientImpl.cpp

Issue 350003: Flesh out more of ChromiumBridge.cpp eliminating all but two methods on... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « webkit/api/src/TemporaryGlue.h ('k') | webkit/api/src/WebPluginContainerImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if ENABLE(VIDEO) 8 #if ENABLE(VIDEO)
9 9
10 #include "TimeRanges.h"
11 #include "WebCanvas.h" 10 #include "WebCanvas.h"
12 #include "WebCString.h" 11 #include "WebCString.h"
12 #include "WebFrameClient.h"
13 #include "WebFrameImpl.h"
13 #include "WebKit.h" 14 #include "WebKit.h"
14 #include "WebKitClient.h" 15 #include "WebKitClient.h"
15 #include "WebMediaPlayer.h" 16 #include "WebMediaPlayer.h"
16 #include "WebMimeRegistry.h" 17 #include "WebMimeRegistry.h"
17 #include "WebRect.h" 18 #include "WebRect.h"
18 #include "WebSize.h" 19 #include "WebSize.h"
19 #include "WebString.h" 20 #include "WebString.h"
20 #include "WebURL.h" 21 #include "WebURL.h"
21 22
22 #include "CString.h" 23 #include "CString.h"
23 #include "Frame.h" 24 #include "Frame.h"
24 #include "GraphicsContext.h" 25 #include "GraphicsContext.h"
25 #include "HTMLMediaElement.h" 26 #include "HTMLMediaElement.h"
26 #include "IntSize.h" 27 #include "IntSize.h"
27 #include "KURL.h" 28 #include "KURL.h"
28 #include "MediaPlayer.h" 29 #include "MediaPlayer.h"
29 #include "NotImplemented.h" 30 #include "NotImplemented.h"
31 #include "TimeRanges.h"
30 #include <wtf/Assertions.h> 32 #include <wtf/Assertions.h>
31 33
32 #if WEBKIT_USING_SKIA 34 #if WEBKIT_USING_SKIA
33 #include "PlatformContextSkia.h" 35 #include "PlatformContextSkia.h"
34 #endif 36 #endif
35 37
36 using namespace WebCore; 38 using namespace WebCore;
37 39
38 namespace WebKit { 40 namespace WebKit {
39 41
42 static WebMediaPlayer* createWebMediaPlayer(
43 WebMediaPlayerClient* client, Frame* frame)
44 {
45 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
46 if (!webFrame->client())
47 return 0;
48 return webFrame->client()->createMediaPlayer(webFrame, client);
49 }
50
40 bool WebMediaPlayerClientImpl::m_isEnabled = false; 51 bool WebMediaPlayerClientImpl::m_isEnabled = false;
41 52
42 bool WebMediaPlayerClientImpl::isEnabled() 53 bool WebMediaPlayerClientImpl::isEnabled()
43 { 54 {
44 return m_isEnabled; 55 return m_isEnabled;
45 } 56 }
46 57
47 void WebMediaPlayerClientImpl::setIsEnabled(bool isEnabled) 58 void WebMediaPlayerClientImpl::setIsEnabled(bool isEnabled)
48 { 59 {
49 m_isEnabled = isEnabled; 60 m_isEnabled = isEnabled;
50 } 61 }
51 62
52 void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar) 63 void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar)
53 { 64 {
54 if (m_isEnabled) { 65 if (m_isEnabled) {
55 registrar(WebMediaPlayerClientImpl::create, 66 registrar(WebMediaPlayerClientImpl::create,
56 WebMediaPlayerClientImpl::getSupportedTypes, 67 WebMediaPlayerClientImpl::getSupportedTypes,
57 WebMediaPlayerClientImpl::supportsType); 68 WebMediaPlayerClientImpl::supportsType);
58 } 69 }
59 } 70 }
60 71
61
62 // WebMediaPlayerClient -------------------------------------------------------- 72 // WebMediaPlayerClient --------------------------------------------------------
63 73
64 void WebMediaPlayerClientImpl::networkStateChanged() 74 void WebMediaPlayerClientImpl::networkStateChanged()
65 { 75 {
66 ASSERT(m_mediaPlayer); 76 ASSERT(m_mediaPlayer);
67 m_mediaPlayer->networkStateChanged(); 77 m_mediaPlayer->networkStateChanged();
68 } 78 }
69 79
70 void WebMediaPlayerClientImpl::readyStateChanged() 80 void WebMediaPlayerClientImpl::readyStateChanged()
71 { 81 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ASSERT(m_mediaPlayer); 124 ASSERT(m_mediaPlayer);
115 m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer); 125 m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer);
116 } 126 }
117 127
118 // MediaPlayerPrivateInterface ------------------------------------------------- 128 // MediaPlayerPrivateInterface -------------------------------------------------
119 129
120 void WebMediaPlayerClientImpl::load(const String& url) 130 void WebMediaPlayerClientImpl::load(const String& url)
121 { 131 {
122 Frame* frame = static_cast<HTMLMediaElement*>( 132 Frame* frame = static_cast<HTMLMediaElement*>(
123 m_mediaPlayer->mediaPlayerClient())->document()->frame(); 133 m_mediaPlayer->mediaPlayerClient())->document()->frame();
124 m_webMediaPlayer.set(webKitClient()->createWebMediaPlayer(this, frame)); 134 m_webMediaPlayer.set(createWebMediaPlayer(this, frame));
125 if (m_webMediaPlayer.get()) 135 if (m_webMediaPlayer.get())
126 m_webMediaPlayer->load(KURL(ParsedURLString, url)); 136 m_webMediaPlayer->load(KURL(ParsedURLString, url));
127 } 137 }
128 138
129 void WebMediaPlayerClientImpl::cancelLoad() 139 void WebMediaPlayerClientImpl::cancelLoad()
130 { 140 {
131 if (m_webMediaPlayer.get()) 141 if (m_webMediaPlayer.get())
132 m_webMediaPlayer->cancelLoad(); 142 m_webMediaPlayer->cancelLoad();
133 } 143 }
134 144
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return MediaPlayer::HaveNothing; 261 return MediaPlayer::HaveNothing;
252 } 262 }
253 263
254 float WebMediaPlayerClientImpl::maxTimeSeekable() const 264 float WebMediaPlayerClientImpl::maxTimeSeekable() const
255 { 265 {
256 if (m_webMediaPlayer.get()) 266 if (m_webMediaPlayer.get())
257 return m_webMediaPlayer->maxTimeSeekable(); 267 return m_webMediaPlayer->maxTimeSeekable();
258 return 0.0f; 268 return 0.0f;
259 } 269 }
260 270
261 WTF::PassRefPtr<WebCore::TimeRanges> WebMediaPlayerClientImpl::buffered() const 271 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const
262 { 272 {
263 if (m_webMediaPlayer.get()) { 273 if (m_webMediaPlayer.get()) {
264 const WebTimeRanges& webRanges = m_webMediaPlayer->buffered(); 274 const WebTimeRanges& webRanges = m_webMediaPlayer->buffered();
265 275
266 // FIXME: Save the time ranges in a member variable and update it when needed. 276 // FIXME: Save the time ranges in a member variable and update it when needed.
267 WTF::RefPtr<TimeRanges> ranges = TimeRanges::create(); 277 RefPtr<TimeRanges> ranges = TimeRanges::create();
268 for (size_t i = 0; i < webRanges.size(); ++i) 278 for (size_t i = 0; i < webRanges.size(); ++i)
269 ranges->add(webRanges[i].start, webRanges[i].end); 279 ranges->add(webRanges[i].start, webRanges[i].end);
270 return ranges.release(); 280 return ranges.release();
271 } 281 }
272 return TimeRanges::create(); 282 return TimeRanges::create();
273 } 283 }
274 284
275 int WebMediaPlayerClientImpl::dataRate() const 285 int WebMediaPlayerClientImpl::dataRate() const
276 { 286 {
277 if (m_webMediaPlayer.get()) 287 if (m_webMediaPlayer.get())
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 386 }
377 387
378 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() 388 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
379 : m_mediaPlayer(0) 389 : m_mediaPlayer(0)
380 { 390 {
381 } 391 }
382 392
383 } // namespace WebKit 393 } // namespace WebKit
384 394
385 #endif // ENABLE(VIDEO) 395 #endif // ENABLE(VIDEO)
OLDNEW
« no previous file with comments | « webkit/api/src/TemporaryGlue.h ('k') | webkit/api/src/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698