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" | |
jam
2012/05/14 06:41:45
nit: order
Charlie Reis
2012/05/14 17:38:43
Done.
| |
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
566 enabled_bindings_ |= content::BINDINGS_POLICY_DOM_AUTOMATION; | 572 enabled_bindings_ |= content::BINDINGS_POLICY_DOM_AUTOMATION; |
567 | 573 |
568 ProcessViewLayoutFlags(command_line); | 574 ProcessViewLayoutFlags(command_line); |
569 | 575 |
570 content::GetContentClient()->renderer()->RenderViewCreated(this); | 576 content::GetContentClient()->renderer()->RenderViewCreated(this); |
571 | 577 |
572 // If we have an opener_id but we weren't created by a renderer, then | 578 // If we have an opener_id but we weren't created by a renderer, then |
573 // it's the browser asking us to set our opener to another RenderView. | 579 // it's the browser asking us to set our opener to another RenderView. |
574 // TODO(creis): This doesn't yet handle openers that are subframes. | 580 // TODO(creis): This doesn't yet handle openers that are subframes. |
575 if (opener_id != MSG_ROUTING_NONE && !is_renderer_created) { | 581 if (opener_id != MSG_ROUTING_NONE && !is_renderer_created) { |
576 RenderViewImpl* opener_view = static_cast<RenderViewImpl*>( | 582 RenderViewImpl* opener_view = FromRoutingID(opener_id); |
577 ChildThread::current()->ResolveRoute(opener_id)); | 583 if (opener_view) |
578 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); | 584 webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); |
579 } | 585 } |
580 | 586 |
581 // If we are initially swapped out, navigate to kSwappedOutURL. | 587 // If we are initially swapped out, navigate to kSwappedOutURL. |
582 // 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. |
583 if (is_swapped_out_) | 589 if (is_swapped_out_) |
584 NavigateToSwappedOutURL(); | 590 NavigateToSwappedOutURL(); |
585 } | 591 } |
586 | 592 |
587 RenderViewImpl::~RenderViewImpl() { | 593 RenderViewImpl::~RenderViewImpl() { |
588 history_page_ids_.clear(); | 594 history_page_ids_.clear(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 return it == views->end() ? NULL : it->second; | 633 return it == views->end() ? NULL : it->second; |
628 } | 634 } |
629 | 635 |
630 /*static*/ | 636 /*static*/ |
631 content::RenderView* | 637 content::RenderView* |
632 content::RenderView::FromWebView(WebKit::WebView* webview) { | 638 content::RenderView::FromWebView(WebKit::WebView* webview) { |
633 return RenderViewImpl::FromWebView(webview); | 639 return RenderViewImpl::FromWebView(webview); |
634 } | 640 } |
635 | 641 |
636 /*static*/ | 642 /*static*/ |
643 RenderViewImpl* RenderViewImpl::FromRoutingID(int32 routing_id) { | |
644 return static_cast<RenderViewImpl*>( | |
645 ChildThread::current()->ResolveRoute(routing_id)); | |
646 } | |
647 | |
648 /*static*/ | |
637 void content::RenderView::ForEach(content::RenderViewVisitor* visitor) { | 649 void content::RenderView::ForEach(content::RenderViewVisitor* visitor) { |
638 ViewMap* views = g_view_map.Pointer(); | 650 ViewMap* views = g_view_map.Pointer(); |
639 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { | 651 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { |
640 if (!visitor->Visit(it->second)) | 652 if (!visitor->Visit(it->second)) |
641 return; | 653 return; |
642 } | 654 } |
643 } | 655 } |
644 | 656 |
645 /*static*/ | 657 /*static*/ |
646 RenderViewImpl* RenderViewImpl::Create( | 658 RenderViewImpl* RenderViewImpl::Create( |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
796 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 808 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
797 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 809 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
798 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 810 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
799 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) | 811 IPC_MESSAGE_HANDLER(ViewMsg_ZoomFactor, OnZoomFactor) |
800 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 812 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
801 OnSetZoomLevelForLoadingURL) | 813 OnSetZoomLevelForLoadingURL) |
802 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 814 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
803 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 815 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
804 OnResetPageEncodingToDefault) | 816 OnResetPageEncodingToDefault) |
805 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 817 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
818 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) | |
806 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 819 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
807 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 820 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
808 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 821 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
809 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 822 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
810 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 823 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
811 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) | 824 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) |
812 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 825 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
813 OnDragSourceSystemDragEnded) | 826 OnDragSourceSystemDragEnded) |
814 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 827 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
815 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 828 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
(...skipping 2702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3518 } | 3531 } |
3519 | 3532 |
3520 void RenderViewImpl::dispatchIntent( | 3533 void RenderViewImpl::dispatchIntent( |
3521 WebFrame* frame, const WebIntentRequest& intentRequest) { | 3534 WebFrame* frame, const WebIntentRequest& intentRequest) { |
3522 webkit_glue::WebIntentData intent_data(intentRequest.intent()); | 3535 webkit_glue::WebIntentData intent_data(intentRequest.intent()); |
3523 int id = intents_host_->RegisterWebIntent(intentRequest); | 3536 int id = intents_host_->RegisterWebIntent(intentRequest); |
3524 Send(new IntentsHostMsg_WebIntentDispatch( | 3537 Send(new IntentsHostMsg_WebIntentDispatch( |
3525 routing_id_, intent_data, id)); | 3538 routing_id_, intent_data, id)); |
3526 } | 3539 } |
3527 | 3540 |
3541 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | |
3542 WebKit::WebFrame* source, | |
3543 WebKit::WebSecurityOrigin target_origin, | |
3544 WebKit::WebDOMMessageEvent event) { | |
3545 if (!is_swapped_out_) | |
3546 return false; | |
3547 | |
3548 ViewHostMsg_PostMessage_Params params; | |
3549 params.data = event.data().toString(); | |
3550 params.source_origin = event.origin(); | |
3551 if (!target_origin.isNull()) | |
3552 params.target_origin = target_origin.toString(); | |
3553 | |
3554 // Include the routing ID for the source frame, which the browser process | |
3555 // will translate into the routing ID for the equivalent frame in the target | |
3556 // process. | |
3557 // TODO(creis): Support source subframes. | |
3558 params.source_routing_id = MSG_ROUTING_NONE; | |
3559 RenderViewImpl* source_view = FromWebView(source->view()); | |
3560 if (source_view) | |
3561 params.source_routing_id = source_view->routing_id(); | |
3562 | |
3563 Send(new ViewHostMsg_RouteMessageEvent(routing_id_, params)); | |
3564 return true; | |
3565 } | |
3566 | |
3528 void RenderViewImpl::willOpenSocketStream( | 3567 void RenderViewImpl::willOpenSocketStream( |
3529 WebSocketStreamHandle* handle) { | 3568 WebSocketStreamHandle* handle) { |
3530 SocketStreamHandleData::AddToHandle(handle, routing_id_); | 3569 SocketStreamHandleData::AddToHandle(handle, routing_id_); |
3531 } | 3570 } |
3532 | 3571 |
3533 // WebKit::WebPageSerializerClient implementation ------------------------------ | 3572 // WebKit::WebPageSerializerClient implementation ------------------------------ |
3534 | 3573 |
3535 void RenderViewImpl::didSerializeDataForFrame( | 3574 void RenderViewImpl::didSerializeDataForFrame( |
3536 const WebURL& frame_url, | 3575 const WebURL& frame_url, |
3537 const WebCString& data, | 3576 const WebCString& data, |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4190 return frame; | 4229 return frame; |
4191 } | 4230 } |
4192 | 4231 |
4193 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath, | 4232 void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath, |
4194 const string16& jscript, | 4233 const string16& jscript, |
4195 int id, | 4234 int id, |
4196 bool notify_result) { | 4235 bool notify_result) { |
4197 EvaluateScript(frame_xpath, jscript, id, notify_result); | 4236 EvaluateScript(frame_xpath, jscript, id, notify_result); |
4198 } | 4237 } |
4199 | 4238 |
4239 void RenderViewImpl::OnPostMessageEvent( | |
4240 const ViewHostMsg_PostMessage_Params& params) { | |
4241 // TODO(creis): Support sending to subframes. | |
4242 WebFrame *frame = webview()->mainFrame(); | |
4243 | |
4244 // Find the source frame if it exists. | |
4245 // TODO(creis): Support source subframes. | |
4246 WebFrame* source_frame = NULL; | |
4247 if (params.source_routing_id != MSG_ROUTING_NONE) { | |
4248 RenderViewImpl* source_view = FromRoutingID(params.source_routing_id); | |
4249 if (source_view) | |
4250 source_frame = source_view->webview()->mainFrame(); | |
4251 } | |
4252 | |
4253 // Create an event with the message. The final parameter to initMessageEvent | |
4254 // is the last event ID, which is not used with postMessage. | |
4255 WebDOMEvent event = frame->document().createEvent("MessageEvent"); | |
4256 WebDOMMessageEvent msg_event = event.to<WebDOMMessageEvent>(); | |
4257 msg_event.initMessageEvent("message", | |
4258 // |canBubble| and |cancellable| are always false | |
4259 false, false, | |
4260 WebSerializedScriptValue::fromString(params.data), | |
4261 params.source_origin, source_frame, ""); | |
4262 | |
4263 // We must pass in the target_origin to do the security check on this side, | |
4264 // since it may have changed since the original postMessage call was made. | |
4265 WebSecurityOrigin target_origin; | |
4266 if (!params.target_origin.empty()) { | |
4267 target_origin = | |
4268 WebSecurityOrigin::createFromString(WebString(params.target_origin)); | |
4269 } | |
4270 frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event); | |
4271 } | |
4272 | |
4200 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath, | 4273 void RenderViewImpl::OnCSSInsertRequest(const string16& frame_xpath, |
4201 const std::string& css) { | 4274 const std::string& css) { |
4202 WebFrame* frame = GetChildFrame(frame_xpath); | 4275 WebFrame* frame = GetChildFrame(frame_xpath); |
4203 if (!frame) | 4276 if (!frame) |
4204 return; | 4277 return; |
4205 | 4278 |
4206 frame->document().insertUserStyleSheet( | 4279 frame->document().insertUserStyleSheet( |
4207 WebString::fromUTF8(css), | 4280 WebString::fromUTF8(css), |
4208 WebDocument::UserStyleAuthorLevel); | 4281 WebDocument::UserStyleAuthorLevel); |
4209 } | 4282 } |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5311 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5384 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5312 return !!RenderThreadImpl::current()->compositor_thread(); | 5385 return !!RenderThreadImpl::current()->compositor_thread(); |
5313 } | 5386 } |
5314 | 5387 |
5315 void RenderViewImpl::OnJavaBridgeInit() { | 5388 void RenderViewImpl::OnJavaBridgeInit() { |
5316 DCHECK(!java_bridge_dispatcher_.get()); | 5389 DCHECK(!java_bridge_dispatcher_.get()); |
5317 #if defined(ENABLE_JAVA_BRIDGE) | 5390 #if defined(ENABLE_JAVA_BRIDGE) |
5318 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 5391 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
5319 #endif | 5392 #endif |
5320 } | 5393 } |
OLD | NEW |