Chromium Code Reviews| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 #include "webkit/plugins/npapi/webplugin_impl.h" | 198 #include "webkit/plugins/npapi/webplugin_impl.h" |
| 199 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 199 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
| 200 | 200 |
| 201 #if defined(OS_ANDROID) | 201 #if defined(OS_ANDROID) |
| 202 #include "content/common/android/device_info.h" | 202 #include "content/common/android/device_info.h" |
| 203 #include "content/renderer/android/address_detector.h" | 203 #include "content/renderer/android/address_detector.h" |
| 204 #include "content/renderer/android/content_detector.h" | 204 #include "content/renderer/android/content_detector.h" |
| 205 #include "content/renderer/android/email_detector.h" | 205 #include "content/renderer/android/email_detector.h" |
| 206 #include "content/renderer/android/phone_number_detector.h" | 206 #include "content/renderer/android/phone_number_detector.h" |
| 207 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 207 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
| 208 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | |
| 208 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 209 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
| 210 #include "webkit/media/android/media_player_bridge_manager_impl.h" | |
| 209 #include "webkit/media/android/webmediaplayer_android.h" | 211 #include "webkit/media/android/webmediaplayer_android.h" |
| 212 #include "webkit/media/android/webmediaplayer_impl_android.h" | |
| 213 #include "webkit/media/android/webmediaplayer_in_process_android.h" | |
| 210 #include "webkit/media/android/webmediaplayer_manager_android.h" | 214 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 211 #elif defined(OS_WIN) | 215 #elif defined(OS_WIN) |
| 212 // TODO(port): these files are currently Windows only because they concern: | 216 // TODO(port): these files are currently Windows only because they concern: |
| 213 // * theming | 217 // * theming |
| 214 #include "ui/base/native_theme/native_theme_win.h" | 218 #include "ui/base/native_theme/native_theme_win.h" |
| 215 #elif defined(USE_X11) | 219 #elif defined(USE_X11) |
| 216 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h" | 220 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h" |
| 217 #include "ui/base/native_theme/native_theme.h" | 221 #include "ui/base/native_theme/native_theme.h" |
| 218 #elif defined(OS_MACOSX) | 222 #elif defined(OS_MACOSX) |
| 219 #include "skia/ext/skia_utils_mac.h" | 223 #include "skia/ext/skia_utils_mac.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 media_stream_dispatcher_(NULL), | 606 media_stream_dispatcher_(NULL), |
| 603 media_stream_impl_(NULL), | 607 media_stream_impl_(NULL), |
| 604 p2p_socket_dispatcher_(NULL), | 608 p2p_socket_dispatcher_(NULL), |
| 605 devtools_agent_(NULL), | 609 devtools_agent_(NULL), |
| 606 accessibility_mode_(AccessibilityModeOff), | 610 accessibility_mode_(AccessibilityModeOff), |
| 607 renderer_accessibility_(NULL), | 611 renderer_accessibility_(NULL), |
| 608 java_bridge_dispatcher_(NULL), | 612 java_bridge_dispatcher_(NULL), |
| 609 mouse_lock_dispatcher_(NULL), | 613 mouse_lock_dispatcher_(NULL), |
| 610 #if defined(OS_ANDROID) | 614 #if defined(OS_ANDROID) |
| 611 expected_content_intent_id_(0), | 615 expected_content_intent_id_(0), |
| 616 media_player_proxy_(NULL), | |
| 612 #endif | 617 #endif |
| 613 session_storage_namespace_id_(session_storage_namespace_id), | 618 session_storage_namespace_id_(session_storage_namespace_id), |
| 614 handling_select_range_(false), | 619 handling_select_range_(false), |
| 615 #if defined(OS_WIN) | 620 #if defined(OS_WIN) |
| 616 focused_plugin_id_(-1), | 621 focused_plugin_id_(-1), |
| 617 #endif | 622 #endif |
| 618 guest_to_embedder_channel_(guest_to_embedder_channel), | 623 guest_to_embedder_channel_(guest_to_embedder_channel), |
| 619 guest_pp_instance_(0), | 624 guest_pp_instance_(0), |
| 620 guest_uninitialized_context_(NULL), | 625 guest_uninitialized_context_(NULL), |
| 621 updating_frame_tree_(false), | 626 updating_frame_tree_(false), |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2450 route_id, | 2455 route_id, |
| 2451 routing_id_); | 2456 routing_id_); |
| 2452 } | 2457 } |
| 2453 } | 2458 } |
| 2454 | 2459 |
| 2455 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2460 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| 2456 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 2461 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
| 2457 FOR_EACH_OBSERVER( | 2462 FOR_EACH_OBSERVER( |
| 2458 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2463 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 2459 | 2464 |
| 2465 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
| 2460 #if defined(OS_ANDROID) | 2466 #if defined(OS_ANDROID) |
| 2461 // TODO(qinmin): upstream the implementation of getting WebGraphicsContext3D | 2467 // TODO(qinmin): upstream the implementation of getting WebGraphicsContext3D |
| 2462 // and GpuChannelHost here to replace the NULL params. | 2468 // and GpuChannelHost here to replace the NULL params. |
| 2463 return new webkit_media::WebMediaPlayerAndroid( | 2469 if (cmd_line->HasSwitch(switches::kMediaPlayerInRenderProcess)) { |
| 2464 frame, client, cookieJar(frame), media_player_manager_.get(), | 2470 if (!media_bridge_manager_.get()) { |
| 2465 new content::StreamTextureFactoryImpl(NULL, NULL, routing_id_)); | 2471 media_bridge_manager_.reset( |
| 2472 new webkit_media::MediaPlayerBridgeManagerImpl(1)); | |
| 2473 } | |
| 2474 return new webkit_media::WebMediaPlayerInProcessAndroid( | |
| 2475 frame, | |
| 2476 client, | |
| 2477 cookieJar(frame), | |
| 2478 media_player_manager_.get(), | |
| 2479 media_bridge_manager_.get(), | |
| 2480 new content::StreamTextureFactoryImpl( | |
| 2481 NULL, NULL, routing_id_), | |
| 2482 cmd_line->HasSwitch(switches::kDisableMediaHistoryLogging)); | |
| 2483 } else { | |
|
scherkus (not reviewing)
2012/09/07 13:17:35
early return -- no need for else
qinmin
2012/09/07 22:48:27
Done.
| |
| 2484 if (!media_player_proxy_) { | |
| 2485 media_player_proxy_ = new content::WebMediaPlayerProxyImplAndroid( | |
| 2486 this, media_player_manager_.get()); | |
| 2487 } | |
| 2488 return new webkit_media::WebMediaPlayerImplAndroid( | |
| 2489 frame, | |
| 2490 client, | |
| 2491 media_player_manager_.get(), | |
| 2492 media_player_proxy_, | |
| 2493 new content::StreamTextureFactoryImpl( | |
| 2494 NULL, NULL, routing_id_)); | |
| 2495 } | |
| 2466 #endif | 2496 #endif |
| 2467 | 2497 |
| 2468 media::MessageLoopFactory* message_loop_factory = | 2498 media::MessageLoopFactory* message_loop_factory = |
| 2469 new media::MessageLoopFactory(); | 2499 new media::MessageLoopFactory(); |
| 2470 media::FilterCollection* collection = new media::FilterCollection(); | 2500 media::FilterCollection* collection = new media::FilterCollection(); |
| 2471 RenderMediaLog* render_media_log = new RenderMediaLog(); | 2501 RenderMediaLog* render_media_log = new RenderMediaLog(); |
| 2472 | 2502 |
| 2473 RenderAudioSourceProvider* audio_source_provider = NULL; | 2503 RenderAudioSourceProvider* audio_source_provider = NULL; |
| 2474 | 2504 |
| 2475 // Add in any custom filter factories first. | 2505 // Add in any custom filter factories first. |
| 2476 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | |
| 2477 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2506 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| 2478 // audio_source_provider is a "provider" to WebKit, and a sink | 2507 // audio_source_provider is a "provider" to WebKit, and a sink |
| 2479 // from the perspective of the audio renderer. | 2508 // from the perspective of the audio renderer. |
| 2480 audio_source_provider = new RenderAudioSourceProvider(); | 2509 audio_source_provider = new RenderAudioSourceProvider(); |
| 2481 | 2510 |
| 2482 // Add the chrome specific audio renderer, using audio_source_provider | 2511 // Add the chrome specific audio renderer, using audio_source_provider |
| 2483 // as the sink. | 2512 // as the sink. |
| 2484 media::AudioRendererImpl* audio_renderer = | 2513 media::AudioRendererImpl* audio_renderer = |
| 2485 new media::AudioRendererImpl(audio_source_provider); | 2514 new media::AudioRendererImpl(audio_source_provider); |
| 2486 collection->AddAudioRenderer(audio_renderer); | 2515 collection->AddAudioRenderer(audio_renderer); |
| (...skipping 3572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6059 | 6088 |
| 6060 updating_frame_tree_ = true; | 6089 updating_frame_tree_ = true; |
| 6061 active_frame_id_map_.clear(); | 6090 active_frame_id_map_.clear(); |
| 6062 | 6091 |
| 6063 target_process_id_ = process_id; | 6092 target_process_id_ = process_id; |
| 6064 target_routing_id_ = route_id; | 6093 target_routing_id_ = route_id; |
| 6065 CreateFrameTree(webview()->mainFrame(), frames); | 6094 CreateFrameTree(webview()->mainFrame(), frames); |
| 6066 | 6095 |
| 6067 updating_frame_tree_ = false; | 6096 updating_frame_tree_ = false; |
| 6068 } | 6097 } |
| OLD | NEW |