OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 166 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
167 #include "webkit/glue/dom_operations.h" | 167 #include "webkit/glue/dom_operations.h" |
168 #include "webkit/glue/glue_serialize.h" | 168 #include "webkit/glue/glue_serialize.h" |
169 #include "webkit/glue/webdropdata.h" | 169 #include "webkit/glue/webdropdata.h" |
170 #include "webkit/glue/webkit_constants.h" | 170 #include "webkit/glue/webkit_constants.h" |
171 #include "webkit/glue/webkit_glue.h" | 171 #include "webkit/glue/webkit_glue.h" |
172 #include "webkit/glue/weburlloader_impl.h" | 172 #include "webkit/glue/weburlloader_impl.h" |
173 #include "webkit/glue/weburlresponse_extradata_impl.h" | 173 #include "webkit/glue/weburlresponse_extradata_impl.h" |
174 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 174 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
175 #include "webkit/media/webmediaplayer_impl.h" | 175 #include "webkit/media/webmediaplayer_impl.h" |
| 176 #include "webkit/media/webmediaplayer_ms.h" |
176 #include "webkit/plugins/npapi/plugin_list.h" | 177 #include "webkit/plugins/npapi/plugin_list.h" |
177 #include "webkit/plugins/npapi/webplugin_delegate.h" | 178 #include "webkit/plugins/npapi/webplugin_delegate.h" |
178 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 179 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
179 #include "webkit/plugins/npapi/webplugin_impl.h" | 180 #include "webkit/plugins/npapi/webplugin_impl.h" |
180 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 181 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
181 | 182 |
182 #if defined(OS_ANDROID) | 183 #if defined(OS_ANDROID) |
183 #include "webkit/media/android/webmediaplayer_android.h" | 184 #include "webkit/media/android/webmediaplayer_android.h" |
184 #elif defined(OS_WIN) | 185 #elif defined(OS_WIN) |
185 // TODO(port): these files are currently Windows only because they concern: | 186 // TODO(port): these files are currently Windows only because they concern: |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 } else { | 2193 } else { |
2193 return new WebSharedWorkerProxy(RenderThreadImpl::current(), | 2194 return new WebSharedWorkerProxy(RenderThreadImpl::current(), |
2194 document_id, | 2195 document_id, |
2195 exists, | 2196 exists, |
2196 route_id, | 2197 route_id, |
2197 routing_id_); | 2198 routing_id_); |
2198 } | 2199 } |
2199 } | 2200 } |
2200 | 2201 |
2201 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2202 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2202 WebFrame* frame, WebMediaPlayerClient* client) { | 2203 WebFrame* frame, WebMediaPlayerClient* client, const WebURL& url) { |
2203 FOR_EACH_OBSERVER( | 2204 FOR_EACH_OBSERVER( |
2204 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2205 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2205 | 2206 |
2206 #if defined(OS_ANDROID) | 2207 #if defined(OS_ANDROID) |
2207 return new webkit_media::WebMediaPlayerAndroid( | 2208 return new webkit_media::WebMediaPlayerAndroid( |
2208 client, cookieJar(frame)); | 2209 client, cookieJar(frame)); |
2209 #endif | 2210 #endif |
2210 | 2211 |
2211 media::MessageLoopFactory* message_loop_factory = | 2212 media::MessageLoopFactory* message_loop_factory = |
2212 new media::MessageLoopFactory(); | 2213 new media::MessageLoopFactory(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2250 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2250 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 2251 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
2251 collection->AddVideoDecoder(new media::GpuVideoDecoder( | 2252 collection->AddVideoDecoder(new media::GpuVideoDecoder( |
2252 message_loop_factory->GetMessageLoop("GpuVideoDecoder"), | 2253 message_loop_factory->GetMessageLoop("GpuVideoDecoder"), |
2253 factories_loop, | 2254 factories_loop, |
2254 new RendererGpuVideoDecoderFactories( | 2255 new RendererGpuVideoDecoderFactories( |
2255 gpu_channel_host, factories_loop, context3d))); | 2256 gpu_channel_host, factories_loop, context3d))); |
2256 } | 2257 } |
2257 #endif | 2258 #endif |
2258 | 2259 |
2259 webkit_media::WebMediaPlayerImpl* media_player = | 2260 WebMediaPlayer* media_player = |
2260 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( | 2261 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( |
2261 this, frame, client, AsWeakPtr(), collection, audio_source_provider, | 2262 this, frame, client, AsWeakPtr(), collection, audio_source_provider, |
2262 message_loop_factory, media_stream_impl_, render_media_log); | 2263 message_loop_factory, media_stream_impl_, render_media_log); |
2263 if (!media_player) { | 2264 if (!media_player) { |
2264 media_player = new webkit_media::WebMediaPlayerImpl( | 2265 if (media_stream_impl_ && media_stream_impl_->IsMediaStream(url)) { |
2265 frame, client, AsWeakPtr(), collection, audio_source_provider, | 2266 media_player = new webkit_media::WebMediaPlayerMS( |
2266 message_loop_factory, media_stream_impl_, render_media_log); | 2267 frame, client, AsWeakPtr(), |
| 2268 message_loop_factory, media_stream_impl_, render_media_log); |
| 2269 } else { |
| 2270 media_player = new webkit_media::WebMediaPlayerImpl( |
| 2271 frame, client, AsWeakPtr(), collection, audio_source_provider, |
| 2272 message_loop_factory, media_stream_impl_, render_media_log); |
| 2273 } |
2267 } | 2274 } |
2268 return media_player; | 2275 return media_player; |
2269 } | 2276 } |
2270 | 2277 |
2271 WebApplicationCacheHost* RenderViewImpl::createApplicationCacheHost( | 2278 WebApplicationCacheHost* RenderViewImpl::createApplicationCacheHost( |
2272 WebFrame* frame, WebApplicationCacheHostClient* client) { | 2279 WebFrame* frame, WebApplicationCacheHostClient* client) { |
2273 if (!frame || !frame->view()) | 2280 if (!frame || !frame->view()) |
2274 return NULL; | 2281 return NULL; |
2275 return new RendererWebApplicationCacheHostImpl( | 2282 return new RendererWebApplicationCacheHostImpl( |
2276 FromWebView(frame->view()), client, | 2283 FromWebView(frame->view()), client, |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 | 3748 |
3742 void RenderViewImpl::DidStopLoadingForPlugin() { | 3749 void RenderViewImpl::DidStopLoadingForPlugin() { |
3743 // TODO(darin): Make is_loading_ be a counter! | 3750 // TODO(darin): Make is_loading_ be a counter! |
3744 didStopLoading(); | 3751 didStopLoading(); |
3745 } | 3752 } |
3746 | 3753 |
3747 WebCookieJar* RenderViewImpl::GetCookieJar() { | 3754 WebCookieJar* RenderViewImpl::GetCookieJar() { |
3748 return &cookie_jar_; | 3755 return &cookie_jar_; |
3749 } | 3756 } |
3750 | 3757 |
3751 void RenderViewImpl::DidPlay(webkit_media::WebMediaPlayerImpl* player) { | 3758 void RenderViewImpl::DidPlay(WebKit::WebMediaPlayer* player) { |
3752 Send(new ViewHostMsg_MediaNotification(routing_id_, | 3759 Send(new ViewHostMsg_MediaNotification(routing_id_, |
3753 reinterpret_cast<int64>(player), | 3760 reinterpret_cast<int64>(player), |
3754 player->hasVideo(), | 3761 player->hasVideo(), |
3755 player->hasAudio(), | 3762 player->hasAudio(), |
3756 true)); | 3763 true)); |
3757 } | 3764 } |
3758 | 3765 |
3759 void RenderViewImpl::DidPause(webkit_media::WebMediaPlayerImpl* player) { | 3766 void RenderViewImpl::DidPause(WebKit::WebMediaPlayer* player) { |
3760 Send(new ViewHostMsg_MediaNotification(routing_id_, | 3767 Send(new ViewHostMsg_MediaNotification(routing_id_, |
3761 reinterpret_cast<int64>(player), | 3768 reinterpret_cast<int64>(player), |
3762 player->hasVideo(), | 3769 player->hasVideo(), |
3763 player->hasAudio(), | 3770 player->hasAudio(), |
3764 false)); | 3771 false)); |
3765 } | 3772 } |
3766 | 3773 |
3767 void RenderViewImpl::PlayerGone(webkit_media::WebMediaPlayerImpl* player) { | 3774 void RenderViewImpl::PlayerGone(WebKit::WebMediaPlayer* player) { |
3768 DidPause(player); | 3775 DidPause(player); |
3769 } | 3776 } |
3770 | 3777 |
3771 void RenderViewImpl::SyncNavigationState() { | 3778 void RenderViewImpl::SyncNavigationState() { |
3772 if (!webview()) | 3779 if (!webview()) |
3773 return; | 3780 return; |
3774 | 3781 |
3775 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); | 3782 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); |
3776 SendUpdateState(item); | 3783 SendUpdateState(item); |
3777 } | 3784 } |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5306 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5313 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5307 return !!RenderThreadImpl::current()->compositor_thread(); | 5314 return !!RenderThreadImpl::current()->compositor_thread(); |
5308 } | 5315 } |
5309 | 5316 |
5310 void RenderViewImpl::OnJavaBridgeInit() { | 5317 void RenderViewImpl::OnJavaBridgeInit() { |
5311 DCHECK(!java_bridge_dispatcher_.get()); | 5318 DCHECK(!java_bridge_dispatcher_.get()); |
5312 #if defined(ENABLE_JAVA_BRIDGE) | 5319 #if defined(ENABLE_JAVA_BRIDGE) |
5313 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5320 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
5314 #endif | 5321 #endif |
5315 } | 5322 } |
OLD | NEW |