| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.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 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2629 | 2629 |
| 2630 WebMediaPlayer* RenderView::createMediaPlayer( | 2630 WebMediaPlayer* RenderView::createMediaPlayer( |
| 2631 WebFrame* frame, WebMediaPlayerClient* client) { | 2631 WebFrame* frame, WebMediaPlayerClient* client) { |
| 2632 scoped_ptr<media::MediaFilterCollection> collection( | 2632 scoped_ptr<media::MediaFilterCollection> collection( |
| 2633 new media::MediaFilterCollection()); | 2633 new media::MediaFilterCollection()); |
| 2634 | 2634 |
| 2635 // Add in any custom filter factories first. | 2635 // Add in any custom filter factories first. |
| 2636 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2636 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 2637 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2637 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 2638 // Add the chrome specific audio renderer. | 2638 // Add the chrome specific audio renderer. |
| 2639 collection->AddFilter(new AudioRendererImpl(audio_message_filter())); | 2639 collection->AddAudioRenderer(new AudioRendererImpl(audio_message_filter())); |
| 2640 } | 2640 } |
| 2641 | 2641 |
| 2642 if (cmd_line->HasSwitch(switches::kEnableAcceleratedDecoding) && | 2642 if (cmd_line->HasSwitch(switches::kEnableAcceleratedDecoding) && |
| 2643 !cmd_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 2643 !cmd_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
| 2644 WebGraphicsContext3DCommandBufferImpl* context = | 2644 WebGraphicsContext3DCommandBufferImpl* context = |
| 2645 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 2645 static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 2646 frame->view()->graphicsContext3D()); | 2646 frame->view()->graphicsContext3D()); |
| 2647 if (!context) | 2647 if (!context) |
| 2648 return NULL; | 2648 return NULL; |
| 2649 | 2649 |
| 2650 // Add the hardware video decoder factory. | 2650 // Add the hardware video decoder factory. |
| 2651 // TODO(hclam): This will cause the renderer process to crash on context | 2651 // TODO(hclam): This will cause the renderer process to crash on context |
| 2652 // lost. | 2652 // lost. |
| 2653 bool ret = context->makeContextCurrent(); | 2653 bool ret = context->makeContextCurrent(); |
| 2654 CHECK(ret) << "Failed to switch context"; | 2654 CHECK(ret) << "Failed to switch context"; |
| 2655 collection->AddFilter(new IpcVideoDecoder( | 2655 collection->AddVideoDecoder(new IpcVideoDecoder( |
| 2656 MessageLoop::current(), context->context())); | 2656 MessageLoop::current(), context->context())); |
| 2657 } | 2657 } |
| 2658 | 2658 |
| 2659 WebApplicationCacheHostImpl* appcache_host = | 2659 WebApplicationCacheHostImpl* appcache_host = |
| 2660 WebApplicationCacheHostImpl::FromFrame(frame); | 2660 WebApplicationCacheHostImpl::FromFrame(frame); |
| 2661 | 2661 |
| 2662 // TODO(hclam): obtain the following parameters from |client|. | 2662 // TODO(hclam): obtain the following parameters from |client|. |
| 2663 // Create two bridge factory for two data sources. | 2663 // Create two bridge factory for two data sources. |
| 2664 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_simple = | 2664 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_simple = |
| 2665 new webkit_glue::MediaResourceLoaderBridgeFactory( | 2665 new webkit_glue::MediaResourceLoaderBridgeFactory( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2676 "null", // frame origin | 2676 "null", // frame origin |
| 2677 "null", // main_frame_origin | 2677 "null", // main_frame_origin |
| 2678 base::GetCurrentProcId(), | 2678 base::GetCurrentProcId(), |
| 2679 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, | 2679 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, |
| 2680 routing_id()); | 2680 routing_id()); |
| 2681 | 2681 |
| 2682 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; | 2682 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; |
| 2683 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); | 2683 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); |
| 2684 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( | 2684 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( |
| 2685 new webkit_glue::VideoRendererImpl(pts_logging)); | 2685 new webkit_glue::VideoRendererImpl(pts_logging)); |
| 2686 collection->AddFilter(renderer); | 2686 collection->AddVideoRenderer(renderer); |
| 2687 video_renderer = renderer; | 2687 video_renderer = renderer; |
| 2688 | 2688 |
| 2689 return new webkit_glue::WebMediaPlayerImpl( | 2689 return new webkit_glue::WebMediaPlayerImpl( |
| 2690 client, collection.release(), bridge_factory_simple, | 2690 client, collection.release(), bridge_factory_simple, |
| 2691 bridge_factory_buffered, | 2691 bridge_factory_buffered, |
| 2692 cmd_line->HasSwitch(switches::kSimpleDataSource),video_renderer); | 2692 cmd_line->HasSwitch(switches::kSimpleDataSource),video_renderer); |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 WebApplicationCacheHost* RenderView::createApplicationCacheHost( | 2695 WebApplicationCacheHost* RenderView::createApplicationCacheHost( |
| 2696 WebFrame* frame, WebApplicationCacheHostClient* client) { | 2696 WebFrame* frame, WebApplicationCacheHostClient* client) { |
| (...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5488 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 5488 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 5489 message_id); | 5489 message_id); |
| 5490 } | 5490 } |
| 5491 | 5491 |
| 5492 #if defined(OS_MACOSX) | 5492 #if defined(OS_MACOSX) |
| 5493 void RenderView::OnSelectPopupMenuItem(int selected_index) { | 5493 void RenderView::OnSelectPopupMenuItem(int selected_index) { |
| 5494 external_popup_menu_->DidSelectItem(selected_index); | 5494 external_popup_menu_->DidSelectItem(selected_index); |
| 5495 external_popup_menu_.reset(); | 5495 external_popup_menu_.reset(); |
| 5496 } | 5496 } |
| 5497 #endif | 5497 #endif |
| OLD | NEW |