OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 ipc_params.title = params.title; | 1582 ipc_params.title = params.title; |
1583 ipc_params.default_file_name = | 1583 ipc_params.default_file_name = |
1584 webkit_glue::WebStringToFilePath(params.initialValue); | 1584 webkit_glue::WebStringToFilePath(params.initialValue); |
1585 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); | 1585 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); |
1586 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) | 1586 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) |
1587 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); | 1587 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); |
1588 | 1588 |
1589 return ScheduleFileChooser(ipc_params, chooser_completion); | 1589 return ScheduleFileChooser(ipc_params, chooser_completion); |
1590 } | 1590 } |
1591 | 1591 |
1592 void RenderViewImpl::runModalAlertDialog( | 1592 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, |
1593 WebFrame* frame, const WebString& message) { | 1593 const WebString& message) { |
1594 RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, | 1594 RunJavaScriptMessage(ui::MESSAGE_BOX_IS_JAVASCRIPT_ALERT_DIALOG, |
1595 message, | 1595 message, |
1596 string16(), | 1596 string16(), |
1597 frame->document().url(), | 1597 frame->document().url(), |
1598 NULL); | 1598 NULL); |
1599 } | 1599 } |
1600 | 1600 |
1601 bool RenderViewImpl::runModalConfirmDialog( | 1601 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, |
1602 WebFrame* frame, const WebString& message) { | 1602 const WebString& message) { |
1603 return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, | 1603 return RunJavaScriptMessage(ui::MESSAGE_BOX_IS_JAVASCRIPT_CONFIRM_DIALOG, |
1604 message, | 1604 message, |
1605 string16(), | 1605 string16(), |
1606 frame->document().url(), | 1606 frame->document().url(), |
1607 NULL); | 1607 NULL); |
1608 } | 1608 } |
1609 | 1609 |
1610 bool RenderViewImpl::runModalPromptDialog( | 1610 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, |
1611 WebFrame* frame, const WebString& message, const WebString& default_value, | 1611 const WebString& message, |
1612 WebString* actual_value) { | 1612 const WebString& default_value, |
| 1613 WebString* actual_value) { |
1613 string16 result; | 1614 string16 result; |
1614 bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, | 1615 bool ok = RunJavaScriptMessage(ui::MESSAGE_BOX_IS_JAVASCRIPT_PROMPT_DIALOG, |
1615 message, | 1616 message, |
1616 default_value, | 1617 default_value, |
1617 frame->document().url(), | 1618 frame->document().url(), |
1618 &result); | 1619 &result); |
1619 if (ok) | 1620 if (ok) |
1620 actual_value->assign(result); | 1621 actual_value->assign(result); |
1621 return ok; | 1622 return ok; |
1622 } | 1623 } |
1623 | 1624 |
1624 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1625 bool RenderViewImpl::runModalBeforeUnloadDialog(WebFrame* frame, |
1625 WebFrame* frame, const WebString& message) { | 1626 const WebString& message) { |
1626 // If we are swapping out, we have already run the beforeunload handler. | 1627 // If we are swapping out, we have already run the beforeunload handler. |
1627 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload | 1628 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload |
1628 // at all, to avoid running it twice. | 1629 // at all, to avoid running it twice. |
1629 if (is_swapped_out_) | 1630 if (is_swapped_out_) |
1630 return true; | 1631 return true; |
1631 | 1632 |
1632 bool success = false; | 1633 bool success = false; |
1633 // This is an ignored return value, but is included so we can accept the same | 1634 // This is an ignored return value, but is included so we can accept the same |
1634 // response as RunJavaScriptMessage. | 1635 // response as RunJavaScriptMessage. |
1635 string16 ignored_result; | 1636 string16 ignored_result; |
(...skipping 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4704 return webview()->settings()->useThreadedCompositor(); | 4705 return webview()->settings()->useThreadedCompositor(); |
4705 } | 4706 } |
4706 | 4707 |
4707 void RenderViewImpl::OnJavaBridgeInit( | 4708 void RenderViewImpl::OnJavaBridgeInit( |
4708 const IPC::ChannelHandle& channel_handle) { | 4709 const IPC::ChannelHandle& channel_handle) { |
4709 DCHECK(!java_bridge_dispatcher_.get()); | 4710 DCHECK(!java_bridge_dispatcher_.get()); |
4710 #if defined(ENABLE_JAVA_BRIDGE) | 4711 #if defined(ENABLE_JAVA_BRIDGE) |
4711 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4712 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4712 #endif | 4713 #endif |
4713 } | 4714 } |
OLD | NEW |