| 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 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2811 | 2811 |
| 2812 // Add the hardware video decoder factory. | 2812 // Add the hardware video decoder factory. |
| 2813 // TODO(hclam): This will cause the renderer process to crash on context | 2813 // TODO(hclam): This will cause the renderer process to crash on context |
| 2814 // lost. | 2814 // lost. |
| 2815 bool ret = context->makeContextCurrent(); | 2815 bool ret = context->makeContextCurrent(); |
| 2816 CHECK(ret) << "Failed to switch context"; | 2816 CHECK(ret) << "Failed to switch context"; |
| 2817 collection->AddVideoDecoder(new IpcVideoDecoder( | 2817 collection->AddVideoDecoder(new IpcVideoDecoder( |
| 2818 MessageLoop::current(), context->context())); | 2818 MessageLoop::current(), context->context())); |
| 2819 } | 2819 } |
| 2820 | 2820 |
| 2821 // TODO(annacc): do we still need appcache_host? http://crbug.com/65135 | 2821 WebApplicationCacheHostImpl* appcache_host = |
| 2822 // WebApplicationCacheHostImpl* appcache_host = | 2822 WebApplicationCacheHostImpl::FromFrame(frame); |
| 2823 // WebApplicationCacheHostImpl::FromFrame(frame); | 2823 |
| 2824 // TODO(hclam): obtain the following parameters from |client|. |
| 2825 // Create two bridge factory for two data sources. |
| 2826 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_simple = |
| 2827 new webkit_glue::MediaResourceLoaderBridgeFactory( |
| 2828 GURL(frame->url()), // referrer |
| 2829 "null", // frame origin |
| 2830 "null", // main_frame_origin |
| 2831 base::GetCurrentProcId(), |
| 2832 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, |
| 2833 routing_id()); |
| 2834 |
| 2835 webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_buffered = |
| 2836 new webkit_glue::MediaResourceLoaderBridgeFactory( |
| 2837 GURL(frame->url()), // referrer |
| 2838 "null", // frame origin |
| 2839 "null", // main_frame_origin |
| 2840 base::GetCurrentProcId(), |
| 2841 appcache_host ? appcache_host->host_id() : appcache::kNoHostId, |
| 2842 routing_id()); |
| 2824 | 2843 |
| 2825 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; | 2844 scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; |
| 2826 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); | 2845 bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); |
| 2827 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( | 2846 scoped_refptr<webkit_glue::VideoRendererImpl> renderer( |
| 2828 new webkit_glue::VideoRendererImpl(pts_logging)); | 2847 new webkit_glue::VideoRendererImpl(pts_logging)); |
| 2829 collection->AddVideoRenderer(renderer); | 2848 collection->AddVideoRenderer(renderer); |
| 2830 video_renderer = renderer; | 2849 video_renderer = renderer; |
| 2831 | 2850 |
| 2832 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( | 2851 scoped_ptr<webkit_glue::WebMediaPlayerImpl> result( |
| 2833 new webkit_glue::WebMediaPlayerImpl(client, collection.release())); | 2852 new webkit_glue::WebMediaPlayerImpl(client, collection.release())); |
| 2834 if (!result->Initialize(frame, | 2853 if (!result->Initialize(bridge_factory_simple, |
| 2854 bridge_factory_buffered, |
| 2835 cmd_line->HasSwitch(switches::kSimpleDataSource), | 2855 cmd_line->HasSwitch(switches::kSimpleDataSource), |
| 2836 video_renderer)) { | 2856 video_renderer)) { |
| 2837 return NULL; | 2857 return NULL; |
| 2838 } | 2858 } |
| 2839 return result.release(); | 2859 return result.release(); |
| 2840 } | 2860 } |
| 2841 | 2861 |
| 2842 WebApplicationCacheHost* RenderView::createApplicationCacheHost( | 2862 WebApplicationCacheHost* RenderView::createApplicationCacheHost( |
| 2843 WebFrame* frame, WebApplicationCacheHostClient* client) { | 2863 WebFrame* frame, WebApplicationCacheHostClient* client) { |
| 2844 return new RendererWebApplicationCacheHostImpl( | 2864 return new RendererWebApplicationCacheHostImpl( |
| (...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5667 external_popup_menu_.reset(); | 5687 external_popup_menu_.reset(); |
| 5668 } | 5688 } |
| 5669 #endif | 5689 #endif |
| 5670 | 5690 |
| 5671 void RenderView::AddErrorToRootConsole(const string16& message) { | 5691 void RenderView::AddErrorToRootConsole(const string16& message) { |
| 5672 if (webview() && webview()->mainFrame()) { | 5692 if (webview() && webview()->mainFrame()) { |
| 5673 webview()->mainFrame()->addMessageToConsole( | 5693 webview()->mainFrame()->addMessageToConsole( |
| 5674 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5694 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
| 5675 } | 5695 } |
| 5676 } | 5696 } |
| OLD | NEW |