Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index b18c55126eb9bcac8657cd7e8e01b2d84b659941..a8f37f6de9f7e6903d5c70c199329a160b994429 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -1091,6 +1091,28 @@ bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
| return trimmed_params_text != trimmed_selection_text; |
| } |
| +bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
| + const base::string16& message, |
| + const base::string16& default_value, |
| + const GURL& frame_url, |
| + base::string16* result) { |
| + // Don't allow further dialogs if we are waiting to swap out, since the |
| + // PageGroupLoadDeferrer in our stack prevents it. |
| + if (render_view()->suppress_dialogs_until_swap_out_) |
| + return false; |
| + |
| + bool success = false; |
| + base::string16 result_temp; |
| + if (!result) |
| + result = &result_temp; |
| + |
| + render_view()->SendAndRunNestedMessageLoop( |
| + new FrameHostMsg_RunJavaScriptMessage( |
| + routing_id_, message, default_value, frame_url, type, &success, |
| + result)); |
| + return success; |
| +} |
| + |
| void RenderFrameImpl::DidCommitCompositorFrame() { |
| if (compositing_helper_) |
| compositing_helper_->DidCommitCompositorFrame(); |
| @@ -2016,6 +2038,70 @@ void RenderFrameImpl::didChangeSelection(bool is_empty_selection) { |
| #endif |
| } |
| +void RenderFrameImpl::runModalAlertDialog(blink::WebFrame* frame, |
| + const blink::WebString& message) { |
| + DCHECK(!frame_ || frame_ == frame); |
|
jam
2014/04/05 00:21:38
please move renderviewimpl to call renderframeimpl
Avi (use Gerrit)
2014/04/07 18:03:46
Done.
|
| + RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_ALERT, |
| + message, |
| + base::string16(), |
| + frame->document().url(), |
| + NULL); |
| +} |
| + |
| +bool RenderFrameImpl::runModalConfirmDialog(blink::WebFrame* frame, |
| + const blink::WebString& message) { |
| + DCHECK(!frame_ || frame_ == frame); |
| + return RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
| + message, |
| + base::string16(), |
| + frame->document().url(), |
| + NULL); |
| +} |
| + |
| +bool RenderFrameImpl::runModalPromptDialog( |
| + blink::WebFrame* frame, |
| + const blink::WebString& message, |
| + const blink::WebString& default_value, |
| + blink::WebString* actual_value) { |
| + DCHECK(!frame_ || frame_ == frame); |
| + base::string16 result; |
| + bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
| + message, |
| + default_value, |
| + frame->document().url(), |
| + &result); |
| + if (ok) |
| + actual_value->assign(result); |
| + return ok; |
| +} |
| + |
| +bool RenderFrameImpl::runModalBeforeUnloadDialog( |
| + blink::WebFrame* frame, |
| + bool is_reload, |
| + const blink::WebString& message) { |
| + DCHECK(!frame_ || frame_ == frame); |
| + // If we are swapping out, we have already run the beforeunload handler. |
| + // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload |
| + // at all, to avoid running it twice. |
| + if (is_swapped_out_) |
|
nasko
2014/04/07 15:45:51
This should check the swapped out sate on the rend
Avi (use Gerrit)
2014/04/07 15:51:54
Huh? I thought that the RenderFrameHost swapped st
Avi (use Gerrit)
2014/04/07 18:03:46
Done.
|
| + return true; |
| + |
| + // Don't allow further dialogs if we are waiting to swap out, since the |
| + // PageGroupLoadDeferrer in our stack prevents it. |
| + if (render_view()->suppress_dialogs_until_swap_out_) |
| + return false; |
| + |
| + bool success = false; |
| + // This is an ignored return value, but is included so we can accept the same |
| + // response as RunJavaScriptMessage. |
| + base::string16 ignored_result; |
| + render_view()->SendAndRunNestedMessageLoop( |
| + new FrameHostMsg_RunBeforeUnloadConfirm( |
| + routing_id_, frame->document().url(), message, is_reload, |
| + &success, &ignored_result)); |
| + return success; |
| +} |
| + |
| void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { |
| ContextMenuParams params = ContextMenuParamsBuilder::Build(data); |
| params.source_type = GetRenderWidget()->context_menu_source_type(); |