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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 176 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
177 #include "webkit/media/webmediaplayer_impl.h" | 177 #include "webkit/media/webmediaplayer_impl.h" |
178 #include "webkit/plugins/npapi/plugin_list.h" | 178 #include "webkit/plugins/npapi/plugin_list.h" |
179 #include "webkit/plugins/npapi/webplugin_delegate.h" | 179 #include "webkit/plugins/npapi/webplugin_delegate.h" |
180 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 180 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
181 #include "webkit/plugins/npapi/webplugin_impl.h" | 181 #include "webkit/plugins/npapi/webplugin_impl.h" |
182 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 182 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
183 | 183 |
184 #if defined(OS_ANDROID) | 184 #if defined(OS_ANDROID) |
185 #include "webkit/media/android/webmediaplayer_android.h" | 185 #include "webkit/media/android/webmediaplayer_android.h" |
186 #include "webkit/media/android/webmediaplayer_manager_android.h" | |
186 #elif defined(OS_WIN) | 187 #elif defined(OS_WIN) |
187 // TODO(port): these files are currently Windows only because they concern: | 188 // TODO(port): these files are currently Windows only because they concern: |
188 // * theming | 189 // * theming |
189 #include "ui/base/native_theme/native_theme_win.h" | 190 #include "ui/base/native_theme/native_theme_win.h" |
190 #elif defined(USE_X11) | 191 #elif defined(USE_X11) |
191 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h" | 192 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme. h" |
192 #include "ui/base/native_theme/native_theme.h" | 193 #include "ui/base/native_theme/native_theme.h" |
193 #elif defined(OS_MACOSX) | 194 #elif defined(OS_MACOSX) |
194 #include "skia/ext/skia_utils_mac.h" | 195 #include "skia/ext/skia_utils_mac.h" |
195 #endif | 196 #endif |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 #if defined(ENABLE_WEBRTC) | 559 #if defined(ENABLE_WEBRTC) |
559 if (!media_stream_dispatcher_) | 560 if (!media_stream_dispatcher_) |
560 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | 561 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
561 #endif | 562 #endif |
562 | 563 |
563 new MHTMLGenerator(this); | 564 new MHTMLGenerator(this); |
564 #if defined(OS_MACOSX) | 565 #if defined(OS_MACOSX) |
565 new TextInputClientObserver(this); | 566 new TextInputClientObserver(this); |
566 #endif // defined(OS_MACOSX) | 567 #endif // defined(OS_MACOSX) |
567 | 568 |
569 #if defined(OS_ANDROID) | |
570 media_player_manager_.reset( | |
571 new webkit_media::WebMediaPlayerManagerAndroid(routing_id_)); | |
572 #endif | |
573 | |
568 // The next group of objects all implement RenderViewObserver, so are deleted | 574 // The next group of objects all implement RenderViewObserver, so are deleted |
569 // along with the RenderView automatically. | 575 // along with the RenderView automatically. |
570 devtools_agent_ = new DevToolsAgent(this); | 576 devtools_agent_ = new DevToolsAgent(this); |
571 renderer_accessibility_ = new RendererAccessibility(this, accessibility_mode); | 577 renderer_accessibility_ = new RendererAccessibility(this, accessibility_mode); |
572 mouse_lock_dispatcher_ = new MouseLockDispatcher(this); | 578 mouse_lock_dispatcher_ = new MouseLockDispatcher(this); |
573 intents_host_ = new WebIntentsHost(this); | 579 intents_host_ = new WebIntentsHost(this); |
574 | 580 |
575 new IdleUserDetector(this); | 581 new IdleUserDetector(this); |
576 | 582 |
577 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 583 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2200 routing_id_); | 2206 routing_id_); |
2201 } | 2207 } |
2202 } | 2208 } |
2203 | 2209 |
2204 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2210 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2205 WebFrame* frame, WebMediaPlayerClient* client) { | 2211 WebFrame* frame, WebMediaPlayerClient* client) { |
2206 FOR_EACH_OBSERVER( | 2212 FOR_EACH_OBSERVER( |
2207 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2213 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2208 | 2214 |
2209 #if defined(OS_ANDROID) | 2215 #if defined(OS_ANDROID) |
2216 // TODO(qinmin): upstream the implementation of StreamTextureFactoryImpl | |
2217 // to replace the NULL param here. | |
2210 return new webkit_media::WebMediaPlayerAndroid( | 2218 return new webkit_media::WebMediaPlayerAndroid( |
2211 client, cookieJar(frame)); | 2219 client, cookieJar(frame), media_player_manager_.get(), NULL); |
2212 #endif | 2220 #endif |
2213 | 2221 |
2214 media::MessageLoopFactory* message_loop_factory = | 2222 media::MessageLoopFactory* message_loop_factory = |
2215 new media::MessageLoopFactory(); | 2223 new media::MessageLoopFactory(); |
2216 media::FilterCollection* collection = new media::FilterCollection(); | 2224 media::FilterCollection* collection = new media::FilterCollection(); |
2217 RenderMediaLog* render_media_log = new RenderMediaLog(); | 2225 RenderMediaLog* render_media_log = new RenderMediaLog(); |
2218 | 2226 |
2219 RenderAudioSourceProvider* audio_source_provider = NULL; | 2227 RenderAudioSourceProvider* audio_source_provider = NULL; |
2220 | 2228 |
2221 // Add in any custom filter factories first. | 2229 // Add in any custom filter factories first. |
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4890 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); | 4898 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); |
4891 } | 4899 } |
4892 | 4900 |
4893 void RenderViewImpl::DidHandleTouchEvent(const WebTouchEvent& event) { | 4901 void RenderViewImpl::DidHandleTouchEvent(const WebTouchEvent& event) { |
4894 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleTouchEvent(event)); | 4902 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleTouchEvent(event)); |
4895 } | 4903 } |
4896 | 4904 |
4897 void RenderViewImpl::OnWasHidden() { | 4905 void RenderViewImpl::OnWasHidden() { |
4898 RenderWidget::OnWasHidden(); | 4906 RenderWidget::OnWasHidden(); |
4899 | 4907 |
4908 #if defined(OS_ANDROID) | |
4909 // Inform WebMediaPlayerManagerAndroid to release all media player resources. | |
4910 media_player_manager_->ReleaseMediaResources(); | |
scherkus (not reviewing)
2012/05/23 22:45:46
do we not want to do anything when we're restored?
qinmin
2012/05/24 20:30:28
I will address this when upstreaming the next patc
| |
4911 #endif | |
4912 | |
4900 if (webview()) { | 4913 if (webview()) { |
4901 webview()->settings()->setMinimumTimerInterval( | 4914 webview()->settings()->setMinimumTimerInterval( |
4902 webkit_glue::kBackgroundTabTimerInterval); | 4915 webkit_glue::kBackgroundTabTimerInterval); |
4903 webview()->setVisibilityState(visibilityState(), false); | 4916 webview()->setVisibilityState(visibilityState(), false); |
4904 } | 4917 } |
4905 | 4918 |
4906 // Inform PPAPI plugins that their page is no longer visible. | 4919 // Inform PPAPI plugins that their page is no longer visible. |
4907 pepper_delegate_.PageVisibilityChanged(false); | 4920 pepper_delegate_.PageVisibilityChanged(false); |
4908 | 4921 |
4909 #if defined(OS_MACOSX) | 4922 #if defined(OS_MACOSX) |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5390 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5403 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5391 return !!RenderThreadImpl::current()->compositor_thread(); | 5404 return !!RenderThreadImpl::current()->compositor_thread(); |
5392 } | 5405 } |
5393 | 5406 |
5394 void RenderViewImpl::OnJavaBridgeInit() { | 5407 void RenderViewImpl::OnJavaBridgeInit() { |
5395 DCHECK(!java_bridge_dispatcher_); | 5408 DCHECK(!java_bridge_dispatcher_); |
5396 #if defined(ENABLE_JAVA_BRIDGE) | 5409 #if defined(ENABLE_JAVA_BRIDGE) |
5397 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5410 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5398 #endif | 5411 #endif |
5399 } | 5412 } |
OLD | NEW |