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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 if (!webkit_preferences_.accelerated_compositing_enabled) { | 2076 if (!webkit_preferences_.accelerated_compositing_enabled) { |
2077 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2077 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2078 if (!command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) | 2078 if (!command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) |
2079 transferred_preferences.accelerated_compositing_enabled = true; | 2079 transferred_preferences.accelerated_compositing_enabled = true; |
2080 } | 2080 } |
2081 | 2081 |
2082 RenderViewImpl* view = RenderViewImpl::Create( | 2082 RenderViewImpl* view = RenderViewImpl::Create( |
2083 routing_id_, | 2083 routing_id_, |
2084 renderer_preferences_, | 2084 renderer_preferences_, |
2085 transferred_preferences, | 2085 transferred_preferences, |
2086 shared_popup_counter_, | 2086 shared_popup_counter_.get(), |
2087 routing_id, | 2087 routing_id, |
2088 main_frame_routing_id, | 2088 main_frame_routing_id, |
2089 surface_id, | 2089 surface_id, |
2090 cloned_session_storage_namespace_id, | 2090 cloned_session_storage_namespace_id, |
2091 string16(), // WebCore will take care of setting the correct name. | 2091 string16(), // WebCore will take care of setting the correct name. |
2092 true, | 2092 true, |
2093 false, | 2093 false, |
2094 1, | 2094 1, |
2095 screen_info_, | 2095 screen_info_, |
2096 accessibility_mode_, | 2096 accessibility_mode_, |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 media_player_proxy_, | 2820 media_player_proxy_, |
2821 new StreamTextureFactoryImpl( | 2821 new StreamTextureFactoryImpl( |
2822 context_provider->Context3d(), gpu_channel_host, routing_id_), | 2822 context_provider->Context3d(), gpu_channel_host, routing_id_), |
2823 new RenderMediaLog()); | 2823 new RenderMediaLog()); |
2824 #endif | 2824 #endif |
2825 | 2825 |
2826 scoped_refptr<media::AudioRendererSink> sink; | 2826 scoped_refptr<media::AudioRendererSink> sink; |
2827 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2827 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
2828 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 2828 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
2829 CreateInput(routing_id_); | 2829 CreateInput(routing_id_); |
2830 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; | 2830 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink.get(); |
2831 } | 2831 } |
2832 | 2832 |
2833 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; | 2833 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; |
2834 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; | 2834 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; |
2835 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 2835 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
2836 context3d = RenderThreadImpl::current()->GetGpuVDAContext3D(); | 2836 context3d = RenderThreadImpl::current()->GetGpuVDAContext3D(); |
2837 if (context3d) { | 2837 if (context3d) { |
2838 scoped_refptr<base::MessageLoopProxy> factories_loop = | 2838 scoped_refptr<base::MessageLoopProxy> factories_loop = |
2839 RenderThreadImpl::current()->compositor_message_loop_proxy(); | 2839 RenderThreadImpl::current()->compositor_message_loop_proxy(); |
2840 if (!factories_loop) | 2840 if (!factories_loop.get()) |
2841 factories_loop = base::MessageLoopProxy::current(); | 2841 factories_loop = base::MessageLoopProxy::current(); |
2842 GpuChannelHost* gpu_channel_host = | 2842 GpuChannelHost* gpu_channel_host = |
2843 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2843 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2844 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 2844 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
2845 gpu_factories = new RendererGpuVideoDecoderFactories( | 2845 gpu_factories = new RendererGpuVideoDecoderFactories( |
2846 gpu_channel_host, factories_loop, context3d); | 2846 gpu_channel_host, factories_loop, context3d); |
2847 } | 2847 } |
2848 | 2848 |
2849 webkit_media::WebMediaPlayerParams params( | 2849 webkit_media::WebMediaPlayerParams params( |
2850 sink, gpu_factories, new RenderMediaLog()); | 2850 sink, gpu_factories, new RenderMediaLog()); |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4141 | 4141 |
4142 if (size == preferred_size_) | 4142 if (size == preferred_size_) |
4143 return; | 4143 return; |
4144 | 4144 |
4145 preferred_size_ = size; | 4145 preferred_size_ = size; |
4146 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 4146 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
4147 preferred_size_)); | 4147 preferred_size_)); |
4148 } | 4148 } |
4149 | 4149 |
4150 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { | 4150 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { |
4151 if (!browser_plugin_manager_) | 4151 if (!browser_plugin_manager_.get()) |
4152 browser_plugin_manager_ = BrowserPluginManager::Create(this); | 4152 browser_plugin_manager_ = BrowserPluginManager::Create(this); |
4153 return browser_plugin_manager_; | 4153 return browser_plugin_manager_.get(); |
4154 } | 4154 } |
4155 | 4155 |
4156 void RenderViewImpl::EnsureMediaStreamImpl() { | 4156 void RenderViewImpl::EnsureMediaStreamImpl() { |
4157 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. | 4157 if (!RenderThreadImpl::current()) // Will be NULL during unit tests. |
4158 return; | 4158 return; |
4159 | 4159 |
4160 #if defined(OS_ANDROID) | 4160 #if defined(OS_ANDROID) |
4161 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) | 4161 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableWebRTC)) |
4162 return; | 4162 return; |
4163 #endif | 4163 #endif |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5979 // activation state to change just like a call to setIsActive. | 5979 // activation state to change just like a call to setIsActive. |
5980 if (enable) | 5980 if (enable) |
5981 (*plugin_it)->SetWindowFocus(true); | 5981 (*plugin_it)->SetWindowFocus(true); |
5982 #endif | 5982 #endif |
5983 (*plugin_it)->SetContentAreaFocus(enable); | 5983 (*plugin_it)->SetContentAreaFocus(enable); |
5984 } | 5984 } |
5985 } | 5985 } |
5986 // Notify all Pepper plugins. | 5986 // Notify all Pepper plugins. |
5987 pepper_helper_->OnSetFocus(enable); | 5987 pepper_helper_->OnSetFocus(enable); |
5988 // Notify all BrowserPlugins of the RenderView's focus state. | 5988 // Notify all BrowserPlugins of the RenderView's focus state. |
5989 if (browser_plugin_manager_) | 5989 if (browser_plugin_manager_.get()) |
5990 browser_plugin_manager_->UpdateFocusState(); | 5990 browser_plugin_manager_->UpdateFocusState(); |
5991 } | 5991 } |
5992 | 5992 |
5993 void RenderViewImpl::PpapiPluginFocusChanged() { | 5993 void RenderViewImpl::PpapiPluginFocusChanged() { |
5994 UpdateTextInputState(DO_NOT_SHOW_IME); | 5994 UpdateTextInputState(DO_NOT_SHOW_IME); |
5995 UpdateSelectionBounds(); | 5995 UpdateSelectionBounds(); |
5996 } | 5996 } |
5997 | 5997 |
5998 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { | 5998 void RenderViewImpl::PpapiPluginTextInputTypeChanged() { |
5999 UpdateTextInputState(DO_NOT_SHOW_IME); | 5999 UpdateTextInputState(DO_NOT_SHOW_IME); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6126 if (webview()) { | 6126 if (webview()) { |
6127 webview()->setDeviceScaleFactor(device_scale_factor); | 6127 webview()->setDeviceScaleFactor(device_scale_factor); |
6128 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 6128 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
6129 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 6129 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
6130 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 6130 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
6131 ShouldUseTransitionCompositing(device_scale_factor_)); | 6131 ShouldUseTransitionCompositing(device_scale_factor_)); |
6132 } | 6132 } |
6133 if (auto_resize_mode_) | 6133 if (auto_resize_mode_) |
6134 AutoResizeCompositor(); | 6134 AutoResizeCompositor(); |
6135 | 6135 |
6136 if (browser_plugin_manager_) | 6136 if (browser_plugin_manager_.get()) |
6137 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); | 6137 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); |
6138 } | 6138 } |
6139 | 6139 |
6140 ui::TextInputType RenderViewImpl::GetTextInputType() { | 6140 ui::TextInputType RenderViewImpl::GetTextInputType() { |
6141 return pepper_helper_->IsPluginFocused() ? | 6141 return pepper_helper_->IsPluginFocused() ? |
6142 pepper_helper_->GetTextInputType() : RenderWidget::GetTextInputType(); | 6142 pepper_helper_->GetTextInputType() : RenderWidget::GetTextInputType(); |
6143 } | 6143 } |
6144 | 6144 |
6145 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { | 6145 void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) { |
6146 if (pepper_helper_->IsPluginFocused()) { | 6146 if (pepper_helper_->IsPluginFocused()) { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6648 WebURL url = icon_urls[i].iconURL(); | 6648 WebURL url = icon_urls[i].iconURL(); |
6649 if (!url.isEmpty()) | 6649 if (!url.isEmpty()) |
6650 urls.push_back(FaviconURL(url, | 6650 urls.push_back(FaviconURL(url, |
6651 ToFaviconType(icon_urls[i].iconType()))); | 6651 ToFaviconType(icon_urls[i].iconType()))); |
6652 } | 6652 } |
6653 SendUpdateFaviconURL(urls); | 6653 SendUpdateFaviconURL(urls); |
6654 } | 6654 } |
6655 | 6655 |
6656 | 6656 |
6657 } // namespace content | 6657 } // namespace content |
OLD | NEW |