OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 118 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
119 #include "third_party/WebKit/public/platform/WebString.h" | 119 #include "third_party/WebKit/public/platform/WebString.h" |
120 #include "third_party/WebKit/public/platform/WebURL.h" | 120 #include "third_party/WebKit/public/platform/WebURL.h" |
121 #include "third_party/WebKit/public/platform/WebURLError.h" | 121 #include "third_party/WebKit/public/platform/WebURLError.h" |
122 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 122 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
123 #include "third_party/WebKit/public/platform/WebVector.h" | 123 #include "third_party/WebKit/public/platform/WebVector.h" |
124 #include "third_party/WebKit/public/web/WebColorSuggestion.h" | 124 #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
125 #include "third_party/WebKit/public/web/WebDocument.h" | 125 #include "third_party/WebKit/public/web/WebDocument.h" |
126 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 126 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
127 #include "third_party/WebKit/public/web/WebGlyphCache.h" | 127 #include "third_party/WebKit/public/web/WebGlyphCache.h" |
| 128 #include "third_party/WebKit/public/web/WebKit.h" |
128 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 129 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
129 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" | 130 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" |
130 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 131 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
131 #include "third_party/WebKit/public/web/WebPlugin.h" | 132 #include "third_party/WebKit/public/web/WebPlugin.h" |
132 #include "third_party/WebKit/public/web/WebPluginParams.h" | 133 #include "third_party/WebKit/public/web/WebPluginParams.h" |
133 #include "third_party/WebKit/public/web/WebPluginPlaceholder.h" | 134 #include "third_party/WebKit/public/web/WebPluginPlaceholder.h" |
134 #include "third_party/WebKit/public/web/WebRange.h" | 135 #include "third_party/WebKit/public/web/WebRange.h" |
135 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 136 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
136 #include "third_party/WebKit/public/web/WebScriptSource.h" | 137 #include "third_party/WebKit/public/web/WebScriptSource.h" |
137 #include "third_party/WebKit/public/web/WebSearchableFormData.h" | 138 #include "third_party/WebKit/public/web/WebSearchableFormData.h" |
138 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 139 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
139 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 140 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 141 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" |
140 #include "third_party/WebKit/public/web/WebSettings.h" | 142 #include "third_party/WebKit/public/web/WebSettings.h" |
141 #include "third_party/WebKit/public/web/WebSurroundingText.h" | 143 #include "third_party/WebKit/public/web/WebSurroundingText.h" |
142 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 144 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
143 #include "third_party/WebKit/public/web/WebView.h" | 145 #include "third_party/WebKit/public/web/WebView.h" |
144 #include "third_party/mojo/src/mojo/edk/js/core.h" | 146 #include "third_party/mojo/src/mojo/edk/js/core.h" |
145 #include "third_party/mojo/src/mojo/edk/js/support.h" | 147 #include "third_party/mojo/src/mojo/edk/js/support.h" |
146 | 148 |
147 #if defined(ENABLE_PLUGINS) | 149 #if defined(ENABLE_PLUGINS) |
148 #include "content/renderer/npapi/webplugin_impl.h" | 150 #include "content/renderer/npapi/webplugin_impl.h" |
149 #include "content/renderer/pepper/pepper_browser_connection.h" | 151 #include "content/renderer/pepper/pepper_browser_connection.h" |
(...skipping 29 matching lines...) Expand all Loading... |
179 #include "content/renderer/media/media_renderer_service_provider.h" | 181 #include "content/renderer/media/media_renderer_service_provider.h" |
180 #include "media/mojo/services/mojo_renderer_factory.h" | 182 #include "media/mojo/services/mojo_renderer_factory.h" |
181 #else | 183 #else |
182 #include "media/renderers/default_renderer_factory.h" | 184 #include "media/renderers/default_renderer_factory.h" |
183 #endif | 185 #endif |
184 | 186 |
185 using blink::WebContextMenuData; | 187 using blink::WebContextMenuData; |
186 using blink::WebData; | 188 using blink::WebData; |
187 using blink::WebDataSource; | 189 using blink::WebDataSource; |
188 using blink::WebDocument; | 190 using blink::WebDocument; |
| 191 using blink::WebDOMEvent; |
| 192 using blink::WebDOMMessageEvent; |
189 using blink::WebElement; | 193 using blink::WebElement; |
190 using blink::WebExternalPopupMenu; | 194 using blink::WebExternalPopupMenu; |
191 using blink::WebExternalPopupMenuClient; | 195 using blink::WebExternalPopupMenuClient; |
192 using blink::WebFrame; | 196 using blink::WebFrame; |
193 using blink::WebHistoryItem; | 197 using blink::WebHistoryItem; |
194 using blink::WebHTTPBody; | 198 using blink::WebHTTPBody; |
195 using blink::WebLocalFrame; | 199 using blink::WebLocalFrame; |
196 using blink::WebMediaPlayer; | 200 using blink::WebMediaPlayer; |
197 using blink::WebMediaPlayerClient; | 201 using blink::WebMediaPlayerClient; |
198 using blink::WebNavigationPolicy; | 202 using blink::WebNavigationPolicy; |
199 using blink::WebNavigationType; | 203 using blink::WebNavigationType; |
200 using blink::WebNode; | 204 using blink::WebNode; |
201 using blink::WebPluginParams; | 205 using blink::WebPluginParams; |
202 using blink::WebPopupMenuInfo; | 206 using blink::WebPopupMenuInfo; |
203 using blink::WebRange; | 207 using blink::WebRange; |
204 using blink::WebReferrerPolicy; | 208 using blink::WebReferrerPolicy; |
205 using blink::WebScriptSource; | 209 using blink::WebScriptSource; |
206 using blink::WebSearchableFormData; | 210 using blink::WebSearchableFormData; |
207 using blink::WebSecurityOrigin; | 211 using blink::WebSecurityOrigin; |
208 using blink::WebSecurityPolicy; | 212 using blink::WebSecurityPolicy; |
| 213 using blink::WebSerializedScriptValue; |
209 using blink::WebServiceWorkerProvider; | 214 using blink::WebServiceWorkerProvider; |
210 using blink::WebStorageQuotaCallbacks; | 215 using blink::WebStorageQuotaCallbacks; |
211 using blink::WebString; | 216 using blink::WebString; |
212 using blink::WebURL; | 217 using blink::WebURL; |
213 using blink::WebURLError; | 218 using blink::WebURLError; |
214 using blink::WebURLRequest; | 219 using blink::WebURLRequest; |
215 using blink::WebURLResponse; | 220 using blink::WebURLResponse; |
216 using blink::WebUserGestureIndicator; | 221 using blink::WebUserGestureIndicator; |
217 using blink::WebVector; | 222 using blink::WebVector; |
218 using blink::WebView; | 223 using blink::WebView; |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 OnTextSurroundingSelectionRequest) | 1047 OnTextSurroundingSelectionRequest) |
1043 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 1048 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
1044 OnAddStyleSheetByURL) | 1049 OnAddStyleSheetByURL) |
1045 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1050 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
1046 OnSetAccessibilityMode) | 1051 OnSetAccessibilityMode) |
1047 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) | 1052 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
1048 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1053 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
1049 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 1054 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
1050 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, | 1055 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, |
1051 OnTextTrackSettingsChanged) | 1056 OnTextTrackSettingsChanged) |
| 1057 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) |
1052 #if defined(OS_ANDROID) | 1058 #if defined(OS_ANDROID) |
1053 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1059 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1054 #elif defined(OS_MACOSX) | 1060 #elif defined(OS_MACOSX) |
1055 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1061 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1056 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1062 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
1057 #endif | 1063 #endif |
1058 IPC_END_MESSAGE_MAP() | 1064 IPC_END_MESSAGE_MAP() |
1059 | 1065 |
1060 return handled; | 1066 return handled; |
1061 } | 1067 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support | 1260 // TODO(creis): Call dispatchUnloadEvent unconditionally here to support |
1255 // unload on subframes as well. | 1261 // unload on subframes as well. |
1256 if (is_main_frame) | 1262 if (is_main_frame) |
1257 frame_->dispatchUnloadEvent(); | 1263 frame_->dispatchUnloadEvent(); |
1258 | 1264 |
1259 // Swap out and stop sending any IPC messages that are not ACKs. | 1265 // Swap out and stop sending any IPC messages that are not ACKs. |
1260 if (is_main_frame) | 1266 if (is_main_frame) |
1261 render_view_->SetSwappedOut(true); | 1267 render_view_->SetSwappedOut(true); |
1262 is_swapped_out_ = true; | 1268 is_swapped_out_ = true; |
1263 | 1269 |
| 1270 // Set the proxy here, since OnStop() below could cause an onload event |
| 1271 // handler to execute, which could trigger code such as |
| 1272 // willCheckAndDispatchMessageEvent() that needs the proxy. |
| 1273 if (proxy) |
| 1274 set_render_frame_proxy(proxy); |
| 1275 |
1264 // Now that we're swapped out and filtering IPC messages, stop loading to | 1276 // Now that we're swapped out and filtering IPC messages, stop loading to |
1265 // ensure that no other in-progress navigation continues. We do this here | 1277 // ensure that no other in-progress navigation continues. We do this here |
1266 // to avoid sending a DidStopLoading message to the browser process. | 1278 // to avoid sending a DidStopLoading message to the browser process. |
1267 // TODO(creis): Should we be stopping all frames here and using | 1279 // TODO(creis): Should we be stopping all frames here and using |
1268 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this | 1280 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this |
1269 // frame? | 1281 // frame? |
1270 OnStop(); | 1282 OnStop(); |
1271 | 1283 |
1272 // Transfer settings such as initial drawing parameters to the remote frame, | 1284 // Transfer settings such as initial drawing parameters to the remote frame, |
1273 // if one is created, that will replace this frame. | 1285 // if one is created, that will replace this frame. |
(...skipping 29 matching lines...) Expand all Loading... |
1303 if (!is_main_frame) { | 1315 if (!is_main_frame) { |
1304 frame_->swap(proxy->web_frame()); | 1316 frame_->swap(proxy->web_frame()); |
1305 | 1317 |
1306 if (is_loading) | 1318 if (is_loading) |
1307 proxy->OnDidStartLoading(); | 1319 proxy->OnDidStartLoading(); |
1308 | 1320 |
1309 if (is_site_per_process) { | 1321 if (is_site_per_process) { |
1310 // TODO(nasko): delete the frame here, since we've replaced it with a | 1322 // TODO(nasko): delete the frame here, since we've replaced it with a |
1311 // proxy. | 1323 // proxy. |
1312 } | 1324 } |
1313 } else { | |
1314 set_render_frame_proxy(proxy); | |
1315 } | 1325 } |
1316 } | 1326 } |
1317 | 1327 |
1318 // In --site-per-process, initialize the WebRemoteFrame with the replication | 1328 // In --site-per-process, initialize the WebRemoteFrame with the replication |
1319 // state passed by the process that is now rendering the frame. | 1329 // state passed by the process that is now rendering the frame. |
1320 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because | 1330 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because |
1321 // in that case we leave the LocalFrame as the main frame visible to Blink | 1331 // in that case we leave the LocalFrame as the main frame visible to Blink |
1322 // and don't call swap() above. Because swap() is what creates a RemoteFrame | 1332 // and don't call swap() above. Because swap() is what creates a RemoteFrame |
1323 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. | 1333 // in proxy->web_frame(), the RemoteFrame will not exist for main frames. |
1324 // When we do an unconditional swap for all frames, we can remove | 1334 // When we do an unconditional swap for all frames, we can remove |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 render_view_->webview()->settings()->setTextTrackFontVariant( | 1605 render_view_->webview()->settings()->setTextTrackFontVariant( |
1596 WebString::fromUTF8(params.text_track_font_variant)); | 1606 WebString::fromUTF8(params.text_track_font_variant)); |
1597 render_view_->webview()->settings()->setTextTrackTextColor( | 1607 render_view_->webview()->settings()->setTextTrackTextColor( |
1598 WebString::fromUTF8(params.text_track_text_color)); | 1608 WebString::fromUTF8(params.text_track_text_color)); |
1599 render_view_->webview()->settings()->setTextTrackTextShadow( | 1609 render_view_->webview()->settings()->setTextTrackTextShadow( |
1600 WebString::fromUTF8(params.text_track_text_shadow)); | 1610 WebString::fromUTF8(params.text_track_text_shadow)); |
1601 render_view_->webview()->settings()->setTextTrackTextSize( | 1611 render_view_->webview()->settings()->setTextTrackTextSize( |
1602 WebString::fromUTF8(params.text_track_text_size)); | 1612 WebString::fromUTF8(params.text_track_text_size)); |
1603 } | 1613 } |
1604 | 1614 |
| 1615 void RenderFrameImpl::OnPostMessageEvent( |
| 1616 const FrameMsg_PostMessage_Params& params) { |
| 1617 // Find the source frame if it exists. |
| 1618 WebFrame* source_frame = NULL; |
| 1619 if (params.source_view_routing_id != MSG_ROUTING_NONE) { |
| 1620 // Support a legacy postMessage path for specifying a source RenderView; |
| 1621 // this is currently used when sending messages to Android WebView. |
| 1622 // TODO(alexmos): This path can be removed once crbug.com/473258 is fixed. |
| 1623 RenderViewImpl* source_view = |
| 1624 RenderViewImpl::FromRoutingID(params.source_view_routing_id); |
| 1625 if (source_view) |
| 1626 source_frame = source_view->webview()->mainFrame(); |
| 1627 } else if (params.source_routing_id != MSG_ROUTING_NONE) { |
| 1628 RenderFrameProxy* source_proxy = |
| 1629 RenderFrameProxy::FromRoutingID(params.source_routing_id); |
| 1630 if (source_proxy) { |
| 1631 // Currently, navigating a top-level frame cross-process does not swap |
| 1632 // the WebLocalFrame for a WebRemoteFrame in the frame tree, and the |
| 1633 // WebRemoteFrame will not have an associated blink::Frame. If this is |
| 1634 // the case for |source_proxy|, use the corresponding (swapped-out) |
| 1635 // WebLocalFrame instead, so that event.source for this message can be |
| 1636 // set and used properly. |
| 1637 if (source_proxy->IsMainFrameDetachedFromTree()) |
| 1638 source_frame = source_proxy->render_view()->webview()->mainFrame(); |
| 1639 else |
| 1640 source_frame = source_proxy->web_frame(); |
| 1641 } |
| 1642 } |
| 1643 |
| 1644 // If the message contained MessagePorts, create the corresponding endpoints. |
| 1645 blink::WebMessagePortChannelArray channels = |
| 1646 WebMessagePortChannelImpl::CreatePorts( |
| 1647 params.message_ports, params.new_routing_ids, |
| 1648 base::MessageLoopProxy::current().get()); |
| 1649 |
| 1650 WebSerializedScriptValue serialized_script_value; |
| 1651 if (params.is_data_raw_string) { |
| 1652 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
| 1653 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); |
| 1654 v8::Context::Scope context_scope(context); |
| 1655 V8ValueConverterImpl converter; |
| 1656 converter.SetDateAllowed(true); |
| 1657 converter.SetRegExpAllowed(true); |
| 1658 scoped_ptr<base::Value> value(new base::StringValue(params.data)); |
| 1659 v8::Handle<v8::Value> result_value = converter.ToV8Value(value.get(), |
| 1660 context); |
| 1661 serialized_script_value = WebSerializedScriptValue::serialize(result_value); |
| 1662 } else { |
| 1663 serialized_script_value = WebSerializedScriptValue::fromString(params.data); |
| 1664 } |
| 1665 |
| 1666 // Create an event with the message. The next-to-last parameter to |
| 1667 // initMessageEvent is the last event ID, which is not used with postMessage. |
| 1668 WebDOMEvent event = frame_->document().createEvent("MessageEvent"); |
| 1669 WebDOMMessageEvent msg_event = event.to<WebDOMMessageEvent>(); |
| 1670 msg_event.initMessageEvent("message", |
| 1671 // |canBubble| and |cancellable| are always false |
| 1672 false, false, |
| 1673 serialized_script_value, |
| 1674 params.source_origin, source_frame, "", channels); |
| 1675 |
| 1676 // We must pass in the target_origin to do the security check on this side, |
| 1677 // since it may have changed since the original postMessage call was made. |
| 1678 WebSecurityOrigin target_origin; |
| 1679 if (!params.target_origin.empty()) { |
| 1680 target_origin = |
| 1681 WebSecurityOrigin::createFromString(WebString(params.target_origin)); |
| 1682 } |
| 1683 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); |
| 1684 } |
| 1685 |
1605 #if defined(OS_ANDROID) | 1686 #if defined(OS_ANDROID) |
1606 void RenderFrameImpl::OnSelectPopupMenuItems( | 1687 void RenderFrameImpl::OnSelectPopupMenuItems( |
1607 bool canceled, | 1688 bool canceled, |
1608 const std::vector<int>& selected_indices) { | 1689 const std::vector<int>& selected_indices) { |
1609 // It is possible to receive more than one of these calls if the user presses | 1690 // It is possible to receive more than one of these calls if the user presses |
1610 // a select faster than it takes for the show-select-popup IPC message to make | 1691 // a select faster than it takes for the show-select-popup IPC message to make |
1611 // it to the browser UI thread. Ignore the extra-messages. | 1692 // it to the browser UI thread. Ignore the extra-messages. |
1612 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. | 1693 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. |
1613 if (!external_popup_menu_) | 1694 if (!external_popup_menu_) |
1614 return; | 1695 return; |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3564 return midi_dispatcher_; | 3645 return midi_dispatcher_; |
3565 } | 3646 } |
3566 | 3647 |
3567 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( | 3648 bool RenderFrameImpl::willCheckAndDispatchMessageEvent( |
3568 blink::WebLocalFrame* source_frame, | 3649 blink::WebLocalFrame* source_frame, |
3569 blink::WebFrame* target_frame, | 3650 blink::WebFrame* target_frame, |
3570 blink::WebSecurityOrigin target_origin, | 3651 blink::WebSecurityOrigin target_origin, |
3571 blink::WebDOMMessageEvent event) { | 3652 blink::WebDOMMessageEvent event) { |
3572 DCHECK(!frame_ || frame_ == target_frame); | 3653 DCHECK(!frame_ || frame_ == target_frame); |
3573 | 3654 |
| 3655 // Currently, a postMessage that targets a cross-process frame can be plumbed |
| 3656 // either through this function or RenderFrameProxy::postMessageEvent. This |
| 3657 // function is used when the target cross-process frame is a top-level frame |
| 3658 // which has been swapped out. In that case, the corresponding WebLocalFrame |
| 3659 // currently remains in the frame tree even in site-per-process mode (see |
| 3660 // OnSwapOut). RenderFrameProxy::postMessageEvent is used in |
| 3661 // --site-per-process mode for all other cases. |
| 3662 // |
| 3663 // TODO(alexmos, nasko): When swapped-out:// disappears, this should be |
| 3664 // cleaned up so that RenderFrameProxy::postMessageEvent is the only path for |
| 3665 // cross-process postMessages. |
3574 if (!is_swapped_out_) | 3666 if (!is_swapped_out_) |
3575 return false; | 3667 return false; |
3576 | 3668 |
3577 ViewMsg_PostMessage_Params params; | 3669 CHECK(render_frame_proxy_); |
3578 params.is_data_raw_string = false; | 3670 render_frame_proxy_->postMessageEvent( |
3579 params.data = event.data().toString(); | 3671 source_frame, render_frame_proxy_->web_frame(), target_origin, event); |
3580 params.source_origin = event.origin(); | |
3581 if (!target_origin.isNull()) | |
3582 params.target_origin = target_origin.toString(); | |
3583 | |
3584 params.message_ports = | |
3585 WebMessagePortChannelImpl::ExtractMessagePortIDs(event.releaseChannels()); | |
3586 | |
3587 // Include the routing ID for the source frame (if one exists), which the | |
3588 // browser process will translate into the routing ID for the equivalent | |
3589 // frame in the target process. | |
3590 params.source_routing_id = MSG_ROUTING_NONE; | |
3591 if (source_frame) { | |
3592 RenderViewImpl* source_view = | |
3593 RenderViewImpl::FromWebView(source_frame->view()); | |
3594 if (source_view) | |
3595 params.source_routing_id = source_view->routing_id(); | |
3596 } | |
3597 | |
3598 Send(new ViewHostMsg_RouteMessageEvent(render_view_->routing_id_, params)); | |
3599 return true; | 3672 return true; |
3600 } | 3673 } |
3601 | 3674 |
3602 blink::WebString RenderFrameImpl::userAgentOverride(blink::WebLocalFrame* frame, | 3675 blink::WebString RenderFrameImpl::userAgentOverride(blink::WebLocalFrame* frame, |
3603 const blink::WebURL& url) { | 3676 const blink::WebURL& url) { |
3604 DCHECK(!frame_ || frame_ == frame); | 3677 DCHECK(!frame_ || frame_ == frame); |
3605 std::string user_agent_override_for_url = | 3678 std::string user_agent_override_for_url = |
3606 GetContentClient()->renderer()->GetUserAgentOverrideForURL(GURL(url)); | 3679 GetContentClient()->renderer()->GetUserAgentOverrideForURL(GURL(url)); |
3607 if (!user_agent_override_for_url.empty()) | 3680 if (!user_agent_override_for_url.empty()) |
3608 return WebString::fromUTF8(user_agent_override_for_url); | 3681 return WebString::fromUTF8(user_agent_override_for_url); |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4701 #elif defined(ENABLE_BROWSER_CDMS) | 4774 #elif defined(ENABLE_BROWSER_CDMS) |
4702 cdm_manager_, | 4775 cdm_manager_, |
4703 #endif | 4776 #endif |
4704 this); | 4777 this); |
4705 } | 4778 } |
4706 | 4779 |
4707 return cdm_factory_; | 4780 return cdm_factory_; |
4708 } | 4781 } |
4709 | 4782 |
4710 } // namespace content | 4783 } // namespace content |
OLD | NEW |