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/bind.h" | 10 #include "base/bind.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "cc/switches.h" | 31 #include "cc/switches.h" |
32 #include "content/common/appcache/appcache_dispatcher.h" | 32 #include "content/common/appcache/appcache_dispatcher.h" |
33 #include "content/common/child_thread.h" | 33 #include "content/common/child_thread.h" |
34 #include "content/common/clipboard_messages.h" | 34 #include "content/common/clipboard_messages.h" |
35 #include "content/common/content_constants_internal.h" | 35 #include "content/common/content_constants_internal.h" |
36 #include "content/common/database_messages.h" | 36 #include "content/common/database_messages.h" |
37 #include "content/common/drag_messages.h" | 37 #include "content/common/drag_messages.h" |
38 #include "content/common/fileapi/file_system_dispatcher.h" | 38 #include "content/common/fileapi/file_system_dispatcher.h" |
39 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h" | 39 #include "content/common/fileapi/webfilesystem_callback_dispatcher.h" |
40 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 40 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
41 #include "content/common/intents_messages.h" | |
42 #include "content/common/java_bridge_messages.h" | 41 #include "content/common/java_bridge_messages.h" |
43 #include "content/common/pepper_messages.h" | 42 #include "content/common/pepper_messages.h" |
44 #include "content/common/pepper_plugin_registry.h" | 43 #include "content/common/pepper_plugin_registry.h" |
45 #include "content/common/quota_dispatcher.h" | 44 #include "content/common/quota_dispatcher.h" |
46 #include "content/common/request_extra_data.h" | 45 #include "content/common/request_extra_data.h" |
47 #include "content/common/socket_stream_handle_data.h" | 46 #include "content/common/socket_stream_handle_data.h" |
48 #include "content/common/ssl_status_serialization.h" | 47 #include "content/common/ssl_status_serialization.h" |
49 #include "content/common/view_messages.h" | 48 #include "content/common/view_messages.h" |
50 #include "content/common/webmessageportchannel_impl.h" | 49 #include "content/common/webmessageportchannel_impl.h" |
51 #include "content/public/common/bindings_policy.h" | 50 #include "content/public/common/bindings_policy.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #include "content/renderer/render_thread_impl.h" | 103 #include "content/renderer/render_thread_impl.h" |
105 #include "content/renderer/render_view_impl_params.h" | 104 #include "content/renderer/render_view_impl_params.h" |
106 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 105 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
107 #include "content/renderer/render_widget_fullscreen_pepper.h" | 106 #include "content/renderer/render_widget_fullscreen_pepper.h" |
108 #include "content/renderer/renderer_date_time_picker.h" | 107 #include "content/renderer/renderer_date_time_picker.h" |
109 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 108 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
110 #include "content/renderer/renderer_webcolorchooser_impl.h" | 109 #include "content/renderer/renderer_webcolorchooser_impl.h" |
111 #include "content/renderer/speech_recognition_dispatcher.h" | 110 #include "content/renderer/speech_recognition_dispatcher.h" |
112 #include "content/renderer/text_input_client_observer.h" | 111 #include "content/renderer/text_input_client_observer.h" |
113 #include "content/renderer/v8_value_converter_impl.h" | 112 #include "content/renderer/v8_value_converter_impl.h" |
114 #include "content/renderer/web_intents_host.h" | |
115 #include "content/renderer/web_ui_extension.h" | 113 #include "content/renderer/web_ui_extension.h" |
116 #include "content/renderer/web_ui_extension_data.h" | 114 #include "content/renderer/web_ui_extension_data.h" |
117 #include "content/renderer/webplugin_delegate_proxy.h" | 115 #include "content/renderer/webplugin_delegate_proxy.h" |
118 #include "content/renderer/websharedworker_proxy.h" | 116 #include "content/renderer/websharedworker_proxy.h" |
119 #include "media/base/audio_renderer_mixer_input.h" | 117 #include "media/base/audio_renderer_mixer_input.h" |
120 #include "media/base/filter_collection.h" | 118 #include "media/base/filter_collection.h" |
121 #include "media/base/media_switches.h" | 119 #include "media/base/media_switches.h" |
122 #include "media/filters/audio_renderer_impl.h" | 120 #include "media/filters/audio_renderer_impl.h" |
123 #include "media/filters/gpu_video_decoder.h" | 121 #include "media/filters/gpu_video_decoder.h" |
124 #include "net/base/data_url.h" | 122 #include "net/base/data_url.h" |
(...skipping 28 matching lines...) Expand all Loading... |
153 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 151 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
154 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 152 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
155 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 153 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
156 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 154 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
157 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 155 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
158 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 156 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
159 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" | 157 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" |
160 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 158 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
161 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 159 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
162 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 160 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
163 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" | |
164 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" | |
165 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" | |
166 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 161 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
167 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel
.h" | 162 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel
.h" |
168 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h
" | 163 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h
" |
169 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" | 164 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" |
170 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" | 165 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" |
171 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 166 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
172 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" | 167 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" |
173 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 168 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
174 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" | 169 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" |
175 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 170 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
(...skipping 17 matching lines...) Expand all Loading... |
193 #include "ui/gfx/rect_conversions.h" | 188 #include "ui/gfx/rect_conversions.h" |
194 #include "ui/gfx/size_conversions.h" | 189 #include "ui/gfx/size_conversions.h" |
195 #include "ui/shell_dialogs/selected_file_info.h" | 190 #include "ui/shell_dialogs/selected_file_info.h" |
196 #include "v8/include/v8.h" | 191 #include "v8/include/v8.h" |
197 #include "webkit/appcache/web_application_cache_host_impl.h" | 192 #include "webkit/appcache/web_application_cache_host_impl.h" |
198 #include "webkit/base/file_path_string_conversions.h" | 193 #include "webkit/base/file_path_string_conversions.h" |
199 #include "webkit/dom_storage/dom_storage_types.h" | 194 #include "webkit/dom_storage/dom_storage_types.h" |
200 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 195 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
201 #include "webkit/glue/dom_operations.h" | 196 #include "webkit/glue/dom_operations.h" |
202 #include "webkit/glue/glue_serialize.h" | 197 #include "webkit/glue/glue_serialize.h" |
203 #include "webkit/glue/web_intent_service_data.h" | |
204 #include "webkit/glue/webdropdata.h" | 198 #include "webkit/glue/webdropdata.h" |
205 #include "webkit/glue/webkit_constants.h" | 199 #include "webkit/glue/webkit_constants.h" |
206 #include "webkit/glue/webkit_glue.h" | 200 #include "webkit/glue/webkit_glue.h" |
207 #include "webkit/glue/weburlresponse_extradata_impl.h" | 201 #include "webkit/glue/weburlresponse_extradata_impl.h" |
208 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 202 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
209 #include "webkit/media/webmediaplayer_impl.h" | 203 #include "webkit/media/webmediaplayer_impl.h" |
210 #include "webkit/media/webmediaplayer_ms.h" | 204 #include "webkit/media/webmediaplayer_ms.h" |
211 #include "webkit/media/webmediaplayer_params.h" | 205 #include "webkit/media/webmediaplayer_params.h" |
212 #include "webkit/plugins/npapi/plugin_list.h" | 206 #include "webkit/plugins/npapi/plugin_list.h" |
213 #include "webkit/plugins/npapi/plugin_utils.h" | 207 #include "webkit/plugins/npapi/plugin_utils.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 using WebKit::WebFormElement; | 266 using WebKit::WebFormElement; |
273 using WebKit::WebFrame; | 267 using WebKit::WebFrame; |
274 using WebKit::WebGestureEvent; | 268 using WebKit::WebGestureEvent; |
275 using WebKit::WebGraphicsContext3D; | 269 using WebKit::WebGraphicsContext3D; |
276 using WebKit::WebHistoryItem; | 270 using WebKit::WebHistoryItem; |
277 using WebKit::WebHTTPBody; | 271 using WebKit::WebHTTPBody; |
278 using WebKit::WebIconURL; | 272 using WebKit::WebIconURL; |
279 using WebKit::WebImage; | 273 using WebKit::WebImage; |
280 using WebKit::WebInputElement; | 274 using WebKit::WebInputElement; |
281 using WebKit::WebInputEvent; | 275 using WebKit::WebInputEvent; |
282 using WebKit::WebIntentRequest; | |
283 using WebKit::WebIntentServiceInfo; | |
284 using WebKit::WebMediaPlayer; | 276 using WebKit::WebMediaPlayer; |
285 using WebKit::WebMediaPlayerAction; | 277 using WebKit::WebMediaPlayerAction; |
286 using WebKit::WebMediaPlayerClient; | 278 using WebKit::WebMediaPlayerClient; |
287 using WebKit::WebMouseEvent; | 279 using WebKit::WebMouseEvent; |
288 using WebKit::WebNavigationPolicy; | 280 using WebKit::WebNavigationPolicy; |
289 using WebKit::WebNavigationType; | 281 using WebKit::WebNavigationType; |
290 using WebKit::WebNode; | 282 using WebKit::WebNode; |
291 using WebKit::WebPageSerializer; | 283 using WebKit::WebPageSerializer; |
292 using WebKit::WebPageSerializerClient; | 284 using WebKit::WebPageSerializerClient; |
293 using WebKit::WebPeerConnection00Handler; | 285 using WebKit::WebPeerConnection00Handler; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 748 |
757 #if defined(OS_ANDROID) | 749 #if defined(OS_ANDROID) |
758 media_player_manager_.reset( | 750 media_player_manager_.reset( |
759 new webkit_media::WebMediaPlayerManagerAndroid()); | 751 new webkit_media::WebMediaPlayerManagerAndroid()); |
760 #endif | 752 #endif |
761 | 753 |
762 // The next group of objects all implement RenderViewObserver, so are deleted | 754 // The next group of objects all implement RenderViewObserver, so are deleted |
763 // along with the RenderView automatically. | 755 // along with the RenderView automatically. |
764 devtools_agent_ = new DevToolsAgent(this); | 756 devtools_agent_ = new DevToolsAgent(this); |
765 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); | 757 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); |
766 #if defined(ENABLE_WEB_INTENTS) | |
767 intents_host_ = new WebIntentsHost(this); | |
768 #else | |
769 intents_host_ = NULL; | |
770 #endif | |
771 favicon_helper_ = new FaviconHelper(this); | 758 favicon_helper_ = new FaviconHelper(this); |
772 | 759 |
773 // Create renderer_accessibility_ if needed. | 760 // Create renderer_accessibility_ if needed. |
774 OnSetAccessibilityMode(params->accessibility_mode); | 761 OnSetAccessibilityMode(params->accessibility_mode); |
775 | 762 |
776 new IdleUserDetector(this); | 763 new IdleUserDetector(this); |
777 | 764 |
778 if (command_line.HasSwitch(switches::kDomAutomationController)) | 765 if (command_line.HasSwitch(switches::kDomAutomationController)) |
779 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 766 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
780 | 767 |
(...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3955 void RenderViewImpl::didExhaustMemoryAvailableForScript(WebFrame* frame) { | 3942 void RenderViewImpl::didExhaustMemoryAvailableForScript(WebFrame* frame) { |
3956 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 3943 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |
3957 } | 3944 } |
3958 | 3945 |
3959 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | 3946 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, |
3960 v8::Handle<v8::Context> context, | 3947 v8::Handle<v8::Context> context, |
3961 int extension_group, | 3948 int extension_group, |
3962 int world_id) { | 3949 int world_id) { |
3963 GetContentClient()->renderer()->DidCreateScriptContext( | 3950 GetContentClient()->renderer()->DidCreateScriptContext( |
3964 frame, context, extension_group, world_id); | 3951 frame, context, extension_group, world_id); |
3965 | |
3966 #if defined(ENABLE_WEB_INTENTS) | |
3967 intents_host_->DidCreateScriptContext( | |
3968 frame, context, extension_group, world_id); | |
3969 #endif | |
3970 } | 3952 } |
3971 | 3953 |
3972 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, | 3954 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, |
3973 v8::Handle<v8::Context> context, | 3955 v8::Handle<v8::Context> context, |
3974 int world_id) { | 3956 int world_id) { |
3975 GetContentClient()->renderer()->WillReleaseScriptContext( | 3957 GetContentClient()->renderer()->WillReleaseScriptContext( |
3976 frame, context, world_id); | 3958 frame, context, world_id); |
3977 } | 3959 } |
3978 | 3960 |
3979 void RenderViewImpl::CheckPreferredSize() { | 3961 void RenderViewImpl::CheckPreferredSize() { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 // Unique origins cannot store persistent state. | 4313 // Unique origins cannot store persistent state. |
4332 callbacks->didFail(WebKit::WebStorageQuotaErrorAbort); | 4314 callbacks->didFail(WebKit::WebStorageQuotaErrorAbort); |
4333 return; | 4315 return; |
4334 } | 4316 } |
4335 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( | 4317 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( |
4336 routing_id(), GURL(origin.toString()), | 4318 routing_id(), GURL(origin.toString()), |
4337 static_cast<quota::StorageType>(type), requested_size, | 4319 static_cast<quota::StorageType>(type), requested_size, |
4338 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 4320 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
4339 } | 4321 } |
4340 | 4322 |
4341 void RenderViewImpl::registerIntentService( | |
4342 WebFrame* frame, const WebIntentServiceInfo& service) { | |
4343 #if defined(ENABLE_WEB_INTENTS) | |
4344 webkit_glue::WebIntentServiceData data(service); | |
4345 if (data.title.empty()) | |
4346 data.title = webview()->mainFrame()->document().title(); | |
4347 bool user_gesture = frame->isProcessingUserGesture(); | |
4348 Send(new IntentsHostMsg_RegisterIntentService(routing_id_, | |
4349 data, | |
4350 user_gesture)); | |
4351 #endif | |
4352 } | |
4353 | |
4354 void RenderViewImpl::dispatchIntent( | |
4355 WebFrame* frame, const WebIntentRequest& intentRequest) { | |
4356 #if defined(ENABLE_WEB_INTENTS) | |
4357 webkit_glue::WebIntentData intent_data(intentRequest.intent()); | |
4358 | |
4359 // See WebMessagePortChannelImpl::postMessage() and ::OnMessagedQueued() | |
4360 WebKit::WebMessagePortChannelArray* channels = | |
4361 intentRequest.intent().messagePortChannelsRelease(); | |
4362 if (channels) { | |
4363 for (size_t i = 0; i < channels->size(); ++i) { | |
4364 WebMessagePortChannelImpl* webchannel = | |
4365 static_cast<WebMessagePortChannelImpl*>((*channels)[i]); | |
4366 intent_data.message_port_ids.push_back(webchannel->message_port_id()); | |
4367 DCHECK(intent_data.message_port_ids[i] != MSG_ROUTING_NONE); | |
4368 } | |
4369 delete channels; | |
4370 } | |
4371 | |
4372 int id = intents_host_->RegisterWebIntent(intentRequest); | |
4373 Send(new IntentsHostMsg_WebIntentDispatch( | |
4374 routing_id_, intent_data, id)); | |
4375 #endif | |
4376 } | |
4377 | |
4378 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 4323 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
4379 WebKit::WebFrame* sourceFrame, | 4324 WebKit::WebFrame* sourceFrame, |
4380 WebKit::WebFrame* targetFrame, | 4325 WebKit::WebFrame* targetFrame, |
4381 WebKit::WebSecurityOrigin target_origin, | 4326 WebKit::WebSecurityOrigin target_origin, |
4382 WebKit::WebDOMMessageEvent event) { | 4327 WebKit::WebDOMMessageEvent event) { |
4383 if (!is_swapped_out_) | 4328 if (!is_swapped_out_) |
4384 return false; | 4329 return false; |
4385 | 4330 |
4386 ViewMsg_PostMessage_Params params; | 4331 ViewMsg_PostMessage_Params params; |
4387 params.data = event.data().toString(); | 4332 params.data = event.data().toString(); |
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6661 } | 6606 } |
6662 #endif | 6607 #endif |
6663 | 6608 |
6664 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6609 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6665 TransportDIB::Handle dib_handle) { | 6610 TransportDIB::Handle dib_handle) { |
6666 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6611 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6667 RenderProcess::current()->ReleaseTransportDIB(dib); | 6612 RenderProcess::current()->ReleaseTransportDIB(dib); |
6668 } | 6613 } |
6669 | 6614 |
6670 } // namespace content | 6615 } // namespace content |
OLD | NEW |