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

Side by Side Diff: sky/engine/web/WebMediaPlayerClientImpl.cpp

Issue 689373003: Remove most of the media stack. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « sky/engine/web/WebMediaPlayerClientImpl.h ('k') | sky/engine/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "web/WebMediaPlayerClientImpl.h"
7
8 #include "core/frame/LocalFrame.h"
9 #include "core/html/HTMLMediaElement.h"
10 #include "core/html/TimeRanges.h"
11 #include "core/rendering/RenderView.h"
12 #include "core/rendering/compositing/RenderLayerCompositor.h"
13 #include "platform/geometry/IntSize.h"
14 #include "platform/graphics/GraphicsContext.h"
15 #include "platform/graphics/GraphicsLayer.h"
16 #include "platform/graphics/gpu/Extensions3DUtil.h"
17 #include "platform/graphics/media/MediaPlayer.h"
18 #include "platform/graphics/skia/GaneshUtils.h"
19 #include "public/platform/Platform.h"
20 #include "public/platform/WebCString.h"
21 #include "public/platform/WebCanvas.h"
22 #include "public/platform/WebCompositorSupport.h"
23 #include "public/platform/WebGraphicsContext3DProvider.h"
24 #include "public/platform/WebMediaPlayer.h"
25 #include "public/platform/WebRect.h"
26 #include "public/platform/WebString.h"
27 #include "public/platform/WebURL.h"
28 #include "public/web/WebDocument.h"
29 #include "public/web/WebFrameClient.h"
30 #include "web/WebLocalFrameImpl.h"
31 #include "web/WebViewImpl.h"
32
33 #if OS(ANDROID)
34 #include "GrContext.h"
35 #include "GrTypes.h"
36 #include "SkCanvas.h"
37 #include "SkGrPixelRef.h"
38 #endif
39
40
41 #include "wtf/Assertions.h"
42 #include "wtf/text/CString.h"
43
44 namespace blink {
45
46 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli ent, const WebURL& url, LocalFrame* frame)
47 {
48 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
49
50 if (!webFrame || !webFrame->client())
51 return nullptr;
52 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client) );
53 }
54
55 WebMediaPlayer* WebMediaPlayerClientImpl::webMediaPlayer() const
56 {
57 return m_webMediaPlayer.get();
58 }
59
60 // WebMediaPlayerClient --------------------------------------------------------
61
62 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl()
63 {
64 // Explicitly destroy the WebMediaPlayer to allow verification of tear down.
65 m_webMediaPlayer.clear();
66 }
67
68 void WebMediaPlayerClientImpl::networkStateChanged()
69 {
70 m_client->mediaPlayerNetworkStateChanged();
71 }
72
73 void WebMediaPlayerClientImpl::readyStateChanged()
74 {
75 m_client->mediaPlayerReadyStateChanged();
76 }
77
78 void WebMediaPlayerClientImpl::timeChanged()
79 {
80 m_client->mediaPlayerTimeChanged();
81 }
82
83 void WebMediaPlayerClientImpl::repaint()
84 {
85 m_client->mediaPlayerRepaint();
86 }
87
88 void WebMediaPlayerClientImpl::durationChanged()
89 {
90 m_client->mediaPlayerDurationChanged();
91 }
92
93 void WebMediaPlayerClientImpl::sizeChanged()
94 {
95 m_client->mediaPlayerSizeChanged();
96 }
97
98 void WebMediaPlayerClientImpl::playbackStateChanged()
99 {
100 m_client->mediaPlayerPlaybackStateChanged();
101 }
102
103 void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebStr ing& sessionId)
104 {
105 }
106
107 void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebStr ing& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode)
108 {
109 }
110
111 void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebS tring& sessionId, const unsigned char* message, unsigned messageLength, const We bURL& defaultURL)
112 {
113 }
114
115 void WebMediaPlayerClientImpl::keyNeeded(const WebString& contentType, const uns igned char* initData, unsigned initDataLength)
116 {
117 }
118
119 void WebMediaPlayerClientImpl::setWebLayer(WebLayer* layer)
120 {
121 m_client->mediaPlayerSetWebLayer(layer);
122 }
123
124 void WebMediaPlayerClientImpl::mediaSourceOpened(WebMediaSource* webMediaSource)
125 {
126 ASSERT(webMediaSource);
127 m_client->mediaPlayerMediaSourceOpened(webMediaSource);
128 }
129
130 void WebMediaPlayerClientImpl::requestFullscreen()
131 {
132 m_client->mediaPlayerRequestFullscreen();
133 }
134
135 void WebMediaPlayerClientImpl::requestSeek(double time)
136 {
137 m_client->mediaPlayerRequestSeek(time);
138 }
139
140 // MediaPlayer -------------------------------------------------
141 void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF ::String& url, WebMediaPlayer::CORSMode corsMode)
142 {
143 ASSERT(!m_webMediaPlayer);
144
145 // FIXME: Remove this cast
146 LocalFrame* frame = mediaElement().document().frame();
147
148 WebURL poster = m_client->mediaPlayerPosterURL();
149
150 KURL kurl(ParsedURLString, url);
151 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame);
152 if (!m_webMediaPlayer)
153 return;
154
155 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume());
156
157 m_webMediaPlayer->setPoster(poster);
158
159 // Tell WebMediaPlayer about any connected CDM (may be null).
160 m_webMediaPlayer->load(loadType, kurl, corsMode);
161 }
162
163 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload)
164 {
165 if (m_webMediaPlayer)
166 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa d));
167 }
168
169 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie nt)
170 {
171 return adoptPtr(new WebMediaPlayerClientImpl(client));
172 }
173
174 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client)
175 : m_client(client)
176 {
177 ASSERT(m_client);
178 }
179
180 HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const
181 {
182 return *static_cast<HTMLMediaElement*>(m_client);
183 }
184
185 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/WebMediaPlayerClientImpl.h ('k') | sky/engine/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698