| 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 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 return; | 2170 return; |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 Send(new FrameHostMsg_TextSurroundingSelectionResponse( | 2173 Send(new FrameHostMsg_TextSurroundingSelectionResponse( |
| 2174 routing_id_, | 2174 routing_id_, |
| 2175 surroundingText.textContent(), | 2175 surroundingText.textContent(), |
| 2176 surroundingText.startOffsetInTextContent(), | 2176 surroundingText.startOffsetInTextContent(), |
| 2177 surroundingText.endOffsetInTextContent())); | 2177 surroundingText.endOffsetInTextContent())); |
| 2178 } | 2178 } |
| 2179 | 2179 |
| 2180 bool RenderFrameImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | |
| 2181 // Before Blink asks us to show an alert (etc.), it takes care of doing the | |
| 2182 // equivalent of WebView::willEnterModalLoop. In this case it is particularly | |
| 2183 // important that we do not call willEnterModalLoop as that would defer | |
| 2184 // resource loads for the dialog itself. | |
| 2185 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | |
| 2186 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | |
| 2187 | |
| 2188 message->EnableMessagePumping(); // Runs a nested message loop. | |
| 2189 return Send(message); | |
| 2190 } | |
| 2191 | |
| 2192 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, | 2180 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
| 2193 const base::string16& message, | 2181 const base::string16& message, |
| 2194 const base::string16& default_value, | 2182 const base::string16& default_value, |
| 2195 const GURL& frame_url, | 2183 const GURL& frame_url, |
| 2196 base::string16* result) { | 2184 base::string16* result) { |
| 2197 // Don't allow further dialogs if we are waiting to swap out, since the | 2185 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2198 // ScopedPageLoadDeferrer in our stack prevents it. | 2186 // ScopedPageLoadDeferrer in our stack prevents it. |
| 2199 if (suppress_further_dialogs_) | 2187 if (suppress_further_dialogs_) |
| 2200 return false; | 2188 return false; |
| 2201 | 2189 |
| 2202 bool success = false; | 2190 bool success = false; |
| 2203 base::string16 result_temp; | 2191 base::string16 result_temp; |
| 2204 if (!result) | 2192 if (!result) |
| 2205 result = &result_temp; | 2193 result = &result_temp; |
| 2206 | 2194 |
| 2207 SendAndRunNestedMessageLoop(new FrameHostMsg_RunJavaScriptMessage( | 2195 Send(new FrameHostMsg_RunJavaScriptMessage( |
| 2208 routing_id_, message, default_value, frame_url, type, &success, result)); | 2196 routing_id_, message, default_value, frame_url, type, &success, result)); |
| 2209 return success; | 2197 return success; |
| 2210 } | 2198 } |
| 2211 | 2199 |
| 2212 void RenderFrameImpl::LoadNavigationErrorPage( | 2200 void RenderFrameImpl::LoadNavigationErrorPage( |
| 2213 const WebURLRequest& failed_request, | 2201 const WebURLRequest& failed_request, |
| 2214 const WebURLError& error, | 2202 const WebURLError& error, |
| 2215 bool replace) { | 2203 bool replace) { |
| 2216 std::string error_html; | 2204 std::string error_html; |
| 2217 GetContentClient()->renderer()->GetNavigationErrorStrings( | 2205 GetContentClient()->renderer()->GetNavigationErrorStrings( |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3709 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) { | 3697 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) { |
| 3710 // Don't allow further dialogs if we are waiting to swap out, since the | 3698 // Don't allow further dialogs if we are waiting to swap out, since the |
| 3711 // ScopedPageLoadDeferrer in our stack prevents it. | 3699 // ScopedPageLoadDeferrer in our stack prevents it. |
| 3712 if (suppress_further_dialogs_) | 3700 if (suppress_further_dialogs_) |
| 3713 return false; | 3701 return false; |
| 3714 | 3702 |
| 3715 bool success = false; | 3703 bool success = false; |
| 3716 // This is an ignored return value, but is included so we can accept the same | 3704 // This is an ignored return value, but is included so we can accept the same |
| 3717 // response as RunJavaScriptMessage. | 3705 // response as RunJavaScriptMessage. |
| 3718 base::string16 ignored_result; | 3706 base::string16 ignored_result; |
| 3719 SendAndRunNestedMessageLoop(new FrameHostMsg_RunBeforeUnloadConfirm( | 3707 Send(new FrameHostMsg_RunBeforeUnloadConfirm( |
| 3720 routing_id_, frame_->document().url(), is_reload, &success, | 3708 routing_id_, frame_->document().url(), is_reload, &success, |
| 3721 &ignored_result)); | 3709 &ignored_result)); |
| 3722 return success; | 3710 return success; |
| 3723 } | 3711 } |
| 3724 | 3712 |
| 3725 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { | 3713 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { |
| 3726 ContextMenuParams params = ContextMenuParamsBuilder::Build(data); | 3714 ContextMenuParams params = ContextMenuParamsBuilder::Build(data); |
| 3727 blink::WebRect position_in_window(params.x, params.y, 0, 0); | 3715 blink::WebRect position_in_window(params.x, params.y, 0, 0); |
| 3728 GetRenderWidget()->convertViewportToWindow(&position_in_window); | 3716 GetRenderWidget()->convertViewportToWindow(&position_in_window); |
| 3729 params.x = position_in_window.x; | 3717 params.x = position_in_window.x; |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6136 // event target. Potentially a Pepper plugin will receive the event. | 6124 // event target. Potentially a Pepper plugin will receive the event. |
| 6137 // In order to tell whether a plugin gets the last mouse event and which it | 6125 // In order to tell whether a plugin gets the last mouse event and which it |
| 6138 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6126 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6139 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6127 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6140 // |pepper_last_mouse_event_target_|. | 6128 // |pepper_last_mouse_event_target_|. |
| 6141 pepper_last_mouse_event_target_ = nullptr; | 6129 pepper_last_mouse_event_target_ = nullptr; |
| 6142 #endif | 6130 #endif |
| 6143 } | 6131 } |
| 6144 | 6132 |
| 6145 } // namespace content | 6133 } // namespace content |
| OLD | NEW |