OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 kFlagHasOKButton | | 1651 kFlagHasOKButton | |
1652 kFlagHasCancelButton; | 1652 kFlagHasCancelButton; |
1653 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; | 1653 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; |
1654 static const int kIsJavascriptConfirm = kIsJavascriptAlert | | 1654 static const int kIsJavascriptConfirm = kIsJavascriptAlert | |
1655 kFlagHasCancelButton; | 1655 kFlagHasCancelButton; |
1656 static const int kIsJavascriptPrompt = kIsJavascriptConfirm | | 1656 static const int kIsJavascriptPrompt = kIsJavascriptConfirm | |
1657 kFlagHasPromptField; | 1657 kFlagHasPromptField; |
1658 }; | 1658 }; |
1659 #endif | 1659 #endif |
1660 | 1660 |
1661 void RenderView::RunJavaScriptAlert(WebView* webview, | 1661 void RenderView::RunJavaScriptAlert(WebFrame* webframe, |
1662 const std::wstring& message) { | 1662 const std::wstring& message) { |
1663 RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert, | 1663 RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert, |
1664 message, | 1664 message, |
1665 std::wstring(), | 1665 std::wstring(), |
| 1666 webframe->GetURL(), |
1666 NULL); | 1667 NULL); |
1667 } | 1668 } |
1668 | 1669 |
1669 bool RenderView::RunJavaScriptConfirm(WebView* webview, | 1670 bool RenderView::RunJavaScriptConfirm(WebFrame* webframe, |
1670 const std::wstring& message) { | 1671 const std::wstring& message) { |
1671 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm, | 1672 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm, |
1672 message, | 1673 message, |
1673 std::wstring(), | 1674 std::wstring(), |
| 1675 webframe->GetURL(), |
1674 NULL); | 1676 NULL); |
1675 } | 1677 } |
1676 | 1678 |
1677 bool RenderView::RunJavaScriptPrompt(WebView* webview, | 1679 bool RenderView::RunJavaScriptPrompt(WebFrame* webframe, |
1678 const std::wstring& message, | 1680 const std::wstring& message, |
1679 const std::wstring& default_value, | 1681 const std::wstring& default_value, |
1680 std::wstring* result) { | 1682 std::wstring* result) { |
1681 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptPrompt, | 1683 return RunJavaScriptMessage(MessageBoxView::kIsJavascriptPrompt, |
1682 message, | 1684 message, |
1683 default_value, | 1685 default_value, |
| 1686 webframe->GetURL(), |
1684 result); | 1687 result); |
1685 } | 1688 } |
1686 | 1689 |
1687 bool RenderView::RunJavaScriptMessage(int type, | 1690 bool RenderView::RunJavaScriptMessage(int type, |
1688 const std::wstring& message, | 1691 const std::wstring& message, |
1689 const std::wstring& default_value, | 1692 const std::wstring& default_value, |
| 1693 const GURL& frame_url, |
1690 std::wstring* result) { | 1694 std::wstring* result) { |
1691 bool success = false; | 1695 bool success = false; |
1692 std::wstring result_temp; | 1696 std::wstring result_temp; |
1693 if (!result) | 1697 if (!result) |
1694 result = &result_temp; | 1698 result = &result_temp; |
1695 IPC::SyncMessage* msg = new ViewHostMsg_RunJavaScriptMessage( | 1699 IPC::SyncMessage* msg = new ViewHostMsg_RunJavaScriptMessage( |
1696 routing_id_, message, default_value, type, &success, result); | 1700 routing_id_, message, default_value, frame_url, type, &success, result); |
1697 | 1701 |
1698 msg->set_pump_messages_event(modal_dialog_event_.get()); | 1702 msg->set_pump_messages_event(modal_dialog_event_.get()); |
1699 Send(msg); | 1703 Send(msg); |
1700 | 1704 |
1701 return success; | 1705 return success; |
1702 } | 1706 } |
1703 | 1707 |
1704 void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) { | 1708 void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) { |
1705 if (!osd_url.is_empty()) | 1709 if (!osd_url.is_empty()) |
1706 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, | 1710 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, |
1707 autodetected)); | 1711 autodetected)); |
1708 } | 1712 } |
1709 | 1713 |
1710 bool RenderView::RunBeforeUnloadConfirm(WebView* webview, | 1714 bool RenderView::RunBeforeUnloadConfirm(WebFrame* webframe, |
1711 const std::wstring& message) { | 1715 const std::wstring& message) { |
1712 bool success = false; | 1716 bool success = false; |
1713 // This is an ignored return value, but is included so we can accept the same | 1717 // This is an ignored return value, but is included so we can accept the same |
1714 // response as RunJavaScriptMessage. | 1718 // response as RunJavaScriptMessage. |
1715 std::wstring ignored_result; | 1719 std::wstring ignored_result; |
1716 IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( | 1720 IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( |
1717 routing_id_, message, &success, &ignored_result); | 1721 routing_id_, webframe->GetURL(), message, &success, &ignored_result); |
1718 | 1722 |
1719 msg->set_pump_messages_event(modal_dialog_event_.get()); | 1723 msg->set_pump_messages_event(modal_dialog_event_.get()); |
1720 Send(msg); | 1724 Send(msg); |
1721 | 1725 |
1722 return success; | 1726 return success; |
1723 } | 1727 } |
1724 | 1728 |
1725 void RenderView::EnableSuddenTermination() { | 1729 void RenderView::EnableSuddenTermination() { |
1726 Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, false)); | 1730 Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, false)); |
1727 } | 1731 } |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2972 DCHECK(audio_renderers_.Lookup(stream_id) != NULL); | 2976 DCHECK(audio_renderers_.Lookup(stream_id) != NULL); |
2973 Send(new ViewHostMsg_SetAudioVolume(routing_id_, stream_id, left, right)); | 2977 Send(new ViewHostMsg_SetAudioVolume(routing_id_, stream_id, left, right)); |
2974 } | 2978 } |
2975 | 2979 |
2976 void RenderView::OnResize(const gfx::Size& new_size, | 2980 void RenderView::OnResize(const gfx::Size& new_size, |
2977 const gfx::Rect& resizer_rect) { | 2981 const gfx::Rect& resizer_rect) { |
2978 if (webview()) | 2982 if (webview()) |
2979 webview()->HideAutofillPopup(); | 2983 webview()->HideAutofillPopup(); |
2980 RenderWidget::OnResize(new_size, resizer_rect); | 2984 RenderWidget::OnResize(new_size, resizer_rect); |
2981 } | 2985 } |
OLD | NEW |