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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 #include "media/base/media_switches.h" | 95 #include "media/base/media_switches.h" |
96 #include "media/base/message_loop_factory.h" | 96 #include "media/base/message_loop_factory.h" |
97 #include "media/filters/audio_renderer_impl.h" | 97 #include "media/filters/audio_renderer_impl.h" |
98 #include "media/filters/gpu_video_decoder.h" | 98 #include "media/filters/gpu_video_decoder.h" |
99 #include "net/base/escape.h" | 99 #include "net/base/escape.h" |
100 #include "net/base/net_errors.h" | 100 #include "net/base/net_errors.h" |
101 #include "net/http/http_util.h" | 101 #include "net/http/http_util.h" |
102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" | 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" |
103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" | |
106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" | |
105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" | 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" |
107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h" | 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h" |
108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" | 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" |
110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" | 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" |
116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" | 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h" |
117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo. h" | 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo. h" |
118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" | 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction. h" |
119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" | 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" |
120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" | 122 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" |
121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
122 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" | 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginAction.h" |
123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" | 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" |
125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData .h" | 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData .h" |
129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
133 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" | |
131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" | 134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" |
132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba cks.h" | 135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba cks.h" |
133 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" | 136 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" |
134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 137 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 138 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
136 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " | 139 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " |
137 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData. h" | 140 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData. h" |
138 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC ontext3D.h" | 141 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC ontext3D.h" |
139 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" | 142 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" |
140 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h" | 143 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00Handler.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 using WebKit::WebApplicationCacheHostClient; | 200 using WebKit::WebApplicationCacheHostClient; |
198 using WebKit::WebCString; | 201 using WebKit::WebCString; |
199 using WebKit::WebColor; | 202 using WebKit::WebColor; |
200 using WebKit::WebColorName; | 203 using WebKit::WebColorName; |
201 using WebKit::WebConsoleMessage; | 204 using WebKit::WebConsoleMessage; |
202 using WebKit::WebContextMenuData; | 205 using WebKit::WebContextMenuData; |
203 using WebKit::WebCookieJar; | 206 using WebKit::WebCookieJar; |
204 using WebKit::WebData; | 207 using WebKit::WebData; |
205 using WebKit::WebDataSource; | 208 using WebKit::WebDataSource; |
206 using WebKit::WebDocument; | 209 using WebKit::WebDocument; |
210 using WebKit::WebDOMEvent; | |
211 using WebKit::WebDOMMessageEvent; | |
207 using WebKit::WebDragData; | 212 using WebKit::WebDragData; |
208 using WebKit::WebDragOperation; | 213 using WebKit::WebDragOperation; |
209 using WebKit::WebDragOperationsMask; | 214 using WebKit::WebDragOperationsMask; |
210 using WebKit::WebEditingAction; | 215 using WebKit::WebEditingAction; |
211 using WebKit::WebElement; | 216 using WebKit::WebElement; |
212 using WebKit::WebExternalPopupMenu; | 217 using WebKit::WebExternalPopupMenu; |
213 using WebKit::WebExternalPopupMenuClient; | 218 using WebKit::WebExternalPopupMenuClient; |
214 using WebKit::WebFileChooserCompletion; | 219 using WebKit::WebFileChooserCompletion; |
215 using WebKit::WebFileSystem; | 220 using WebKit::WebFileSystem; |
216 using WebKit::WebFileSystemCallbacks; | 221 using WebKit::WebFileSystemCallbacks; |
(...skipping 28 matching lines...) Expand all Loading... | |
245 using WebKit::WebPluginParams; | 250 using WebKit::WebPluginParams; |
246 using WebKit::WebPoint; | 251 using WebKit::WebPoint; |
247 using WebKit::WebPopupMenuInfo; | 252 using WebKit::WebPopupMenuInfo; |
248 using WebKit::WebRange; | 253 using WebKit::WebRange; |
249 using WebKit::WebRect; | 254 using WebKit::WebRect; |
250 using WebKit::WebReferrerPolicy; | 255 using WebKit::WebReferrerPolicy; |
251 using WebKit::WebScriptSource; | 256 using WebKit::WebScriptSource; |
252 using WebKit::WebSearchableFormData; | 257 using WebKit::WebSearchableFormData; |
253 using WebKit::WebSecurityOrigin; | 258 using WebKit::WebSecurityOrigin; |
254 using WebKit::WebSecurityPolicy; | 259 using WebKit::WebSecurityPolicy; |
260 using WebKit::WebSerializedScriptValue; | |
255 using WebKit::WebSettings; | 261 using WebKit::WebSettings; |
256 using WebKit::WebSharedWorker; | 262 using WebKit::WebSharedWorker; |
257 using WebKit::WebSize; | 263 using WebKit::WebSize; |
258 using WebKit::WebSocketStreamHandle; | 264 using WebKit::WebSocketStreamHandle; |
259 using WebKit::WebStorageNamespace; | 265 using WebKit::WebStorageNamespace; |
260 using WebKit::WebStorageQuotaCallbacks; | 266 using WebKit::WebStorageQuotaCallbacks; |
261 using WebKit::WebStorageQuotaError; | 267 using WebKit::WebStorageQuotaError; |
262 using WebKit::WebStorageQuotaType; | 268 using WebKit::WebStorageQuotaType; |
263 using WebKit::WebString; | 269 using WebKit::WebString; |
264 using WebKit::WebTextAffinity; | 270 using WebKit::WebTextAffinity; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 ProcessViewLayoutFlags(command_line); | 573 ProcessViewLayoutFlags(command_line); |
568 | 574 |
569 content::GetContentClient()->renderer()->RenderViewCreated(this); | 575 content::GetContentClient()->renderer()->RenderViewCreated(this); |
570 | 576 |
571 // If we have an opener_id but we weren't created by a renderer, then | 577 // If we have an opener_id but we weren't created by a renderer, then |
572 // it's the browser asking us to set our opener to another RenderView. | 578 // it's the browser asking us to set our opener to another RenderView. |
573 // TODO(creis): This doesn't yet handle openers that are subframes. | 579 // TODO(creis): This doesn't yet handle openers that are subframes. |
574 if (opener_id != MSG_ROUTING_NONE && !is_renderer_created) { | 580 if (opener_id != MSG_ROUTING_NONE && !is_renderer_created) { |
575 RenderViewImpl* opener_view = static_cast<RenderViewImpl*>( | 581 RenderViewImpl* opener_view = static_cast<RenderViewImpl*>( |
576 ChildThread::current()->ResolveRoute(opener_id)); | 582 ChildThread::current()->ResolveRoute(opener_id)); |
577 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | 583 if (opener_view) |
584 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | |
578 } | 585 } |
579 | 586 |
580 // If we are initially swapped out, navigate to kSwappedOutURL. | 587 // If we are initially swapped out, navigate to kSwappedOutURL. |
581 // This ensures we are in a unique origin that others cannot script. | 588 // This ensures we are in a unique origin that others cannot script. |
582 if (is_swapped_out_) | 589 if (is_swapped_out_) |
583 NavigateToSwappedOutURL(); | 590 NavigateToSwappedOutURL(); |
584 } | 591 } |
585 | 592 |
586 RenderViewImpl::~RenderViewImpl() { | 593 RenderViewImpl::~RenderViewImpl() { |
587 history_page_ids_.clear(); | 594 history_page_ids_.clear(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 802 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
796 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 803 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
797 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 804 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
798 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) | 805 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) |
799 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 806 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
800 OnSetZoomLevelForLoadingURL) | 807 OnSetZoomLevelForLoadingURL) |
801 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 808 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
802 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 809 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
803 OnResetPageEncodingToDefault) | 810 OnResetPageEncodingToDefault) |
804 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 811 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
812 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) | |
805 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 813 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
806 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 814 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
807 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 815 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
808 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 816 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
809 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 817 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
810 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) | 818 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) |
811 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 819 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
812 OnDragSourceSystemDragEnded) | 820 OnDragSourceSystemDragEnded) |
813 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 821 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
814 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 822 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3513 } | 3521 } |
3514 | 3522 |
3515 void RenderViewImpl::dispatchIntent( | 3523 void RenderViewImpl::dispatchIntent( |
3516 WebFrame* frame, const WebIntentRequest& intentRequest) { | 3524 WebFrame* frame, const WebIntentRequest& intentRequest) { |
3517 webkit_glue::WebIntentData intent_data(intentRequest.intent()); | 3525 webkit_glue::WebIntentData intent_data(intentRequest.intent()); |
3518 int id = intents_host_->RegisterWebIntent(intentRequest); | 3526 int id = intents_host_->RegisterWebIntent(intentRequest); |
3519 Send(new IntentsHostMsg_WebIntentDispatch( | 3527 Send(new IntentsHostMsg_WebIntentDispatch( |
3520 routing_id_, intent_data, id)); | 3528 routing_id_, intent_data, id)); |
3521 } | 3529 } |
3522 | 3530 |
3531 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | |
3532 WebKit::WebFrame* source, | |
3533 WebKit::WebSecurityOrigin target_origin, | |
3534 WebKit::WebDOMMessageEvent event) { | |
3535 if (!is_swapped_out_) | |
3536 return false; | |
3537 | |
3538 ViewHostMsg_PostMessage_Params params; | |
3539 params.data = event.data().toString(); | |
3540 params.source_origin = event.origin(); | |
3541 if (!target_origin.isNull()) | |
3542 params.target_origin = target_origin.toString(); | |
3543 | |
3544 // Include the routing ID for the source frame, which the browser process | |
3545 // will translate into the routing ID for the equivalent frame in the target | |
3546 // process. | |
3547 // TODO(creis): Support source subframes. | |
3548 params.source_routing_id = MSG_ROUTING_NONE; | |
3549 RenderViewImpl* source_view = FromWebView(source->view()); | |
3550 if (source_view) | |
3551 params.source_routing_id = source_view->routing_id(); | |
3552 | |
3553 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | |
3554 return true; | |
3555 } | |
3556 | |
3523 void RenderViewImpl::willOpenSocketStream( | 3557 void RenderViewImpl::willOpenSocketStream( |
3524 WebSocketStreamHandle* handle) { | 3558 WebSocketStreamHandle* handle) { |
3525 SocketStreamHandleData::AddToHandle(handle, routing_id_); | 3559 SocketStreamHandleData::AddToHandle(handle, routing_id_); |
3526 } | 3560 } |
3527 | 3561 |
3528 // WebKit::WebPageSerializerClient implementation ------------------------------ | 3562 // WebKit::WebPageSerializerClient implementation ------------------------------ |
3529 | 3563 |
3530 void RenderViewImpl::didSerializeDataForFrame( | 3564 void RenderViewImpl::didSerializeDataForFrame( |
3531 const WebURL& frame_url, | 3565 const WebURL& frame_url, |
3532 const WebCString& data, | 3566 const WebCString& data, |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4185 return frame; | 4219 return frame; |
4186 } | 4220 } |
4187 | 4221 |
4188 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath, | 4222 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath, |
4189 const string16& jscript, | 4223 const string16& jscript, |
4190 int id, | 4224 int id, |
4191 bool notify_result) { | 4225 bool notify_result) { |
4192 EvaluateScript(frame_xpath, jscript, id, notify_result); | 4226 EvaluateScript(frame_xpath, jscript, id, notify_result); |
4193 } | 4227 } |
4194 | 4228 |
4229 void RenderViewImpl::OnPostMessageEvent( | |
4230 const ViewHostMsg_PostMessage_Params& params) { | |
4231 // TODO(creis): Support sending to subframes. | |
4232 WebFrame *frame = webview()->mainFrame(); | |
4233 | |
4234 // Find the source frame if it exists. | |
4235 // TODO(creis): Support source subframes. | |
4236 WebFrame* source_frame = NULL; | |
4237 if (params.source_routing_id != MSG_ROUTING_NONE) { | |
4238 RenderViewImpl* source_view = static_cast<RenderViewImpl*>( | |
4239 ChildThread::current()->ResolveRoute(params.source_routing_id)); | |
Matt Perry
2012/05/11 21:59:34
Maybe move this to a RenderViewImpl::FromRoutingID
Charlie Reis
2012/05/11 22:36:02
Done.
| |
4240 if (source_view) | |
4241 source_frame = source_view->webview()->mainFrame(); | |
4242 } | |
4243 | |
4244 // Create an event with the message. The final parameter to initMessageEvent | |
4245 // is the last event ID, which is not used with postMessage. | |
4246 WebDOMEvent event = frame->document().createEvent("MessageEvent"); | |
4247 WebDOMMessageEvent msg_event = event.to<WebDOMMessageEvent>(); | |
4248 msg_event.initMessageEvent("message", | |
4249 // |canBubble| and |cancellable| are always false | |
4250 false, false, | |
4251 WebSerializedScriptValue::fromString(params.data), | |
4252 params.source_origin, source_frame, ""); | |
4253 | |
4254 // We must pass in the target_origin to do the security check on this side, | |
4255 // since it may have changed since the original postMessage call was made. | |
4256 WebSecurityOrigin target_origin; | |
4257 if (!params.target_origin.empty()) { | |
4258 target_origin = | |
4259 WebSecurityOrigin::createFromString(WebString(params.target_origin)); | |
4260 } | |
4261 frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event); | |
4262 } | |
4263 | |
4195 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath, | 4264 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath, |
4196 const std::string& css) { | 4265 const std::string& css) { |
4197 WebFrame* frame = GetChildFrame(frame_xpath); | 4266 WebFrame* frame = GetChildFrame(frame_xpath); |
4198 if (!frame) | 4267 if (!frame) |
4199 return; | 4268 return; |
4200 | 4269 |
4201 frame->document().insertUserStyleSheet( | 4270 frame->document().insertUserStyleSheet( |
4202 WebString::fromUTF8(css), | 4271 WebString::fromUTF8(css), |
4203 WebDocument::UserStyleAuthorLevel); | 4272 WebDocument::UserStyleAuthorLevel); |
4204 } | 4273 } |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5306 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5375 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5307 return !!RenderThreadImpl::current()->compositor_thread(); | 5376 return !!RenderThreadImpl::current()->compositor_thread(); |
5308 } | 5377 } |
5309 | 5378 |
5310 void RenderViewImpl::OnJavaBridgeInit() { | 5379 void RenderViewImpl::OnJavaBridgeInit() { |
5311 DCHECK(!java_bridge_dispatcher_.get()); | 5380 DCHECK(!java_bridge_dispatcher_.get()); |
5312 #if defined(ENABLE_JAVA_BRIDGE) | 5381 #if defined(ENABLE_JAVA_BRIDGE) |
5313 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5382 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
5314 #endif | 5383 #endif |
5315 } | 5384 } |
OLD | NEW |