| 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 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 std::wstring ignored_result; | 1640 std::wstring ignored_result; |
| 1641 IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( | 1641 IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( |
| 1642 routing_id_, message, &success, &ignored_result); | 1642 routing_id_, message, &success, &ignored_result); |
| 1643 | 1643 |
| 1644 msg->set_pump_messages_event(modal_dialog_event_); | 1644 msg->set_pump_messages_event(modal_dialog_event_); |
| 1645 Send(msg); | 1645 Send(msg); |
| 1646 | 1646 |
| 1647 return success; | 1647 return success; |
| 1648 } | 1648 } |
| 1649 | 1649 |
| 1650 void RenderView::OnUnloadListenerChanged(WebView* webview, WebFrame* webframe) { | 1650 void RenderView::EnableSuddenTermination() { |
| 1651 bool has_listener = false; | 1651 Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, false)); |
| 1652 if (!has_unload_listener_) { | 1652 } |
| 1653 has_listener = webframe->HasUnloadListener(); | 1653 |
| 1654 } else { | 1654 void RenderView::DisableSuddenTermination() { |
| 1655 WebFrame* frame = webview->GetMainFrame(); | 1655 Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, true)); |
| 1656 while (frame != NULL) { | |
| 1657 if (frame->HasUnloadListener()) { | |
| 1658 has_listener = true; | |
| 1659 break; | |
| 1660 } | |
| 1661 frame = webview->GetNextFrameAfter(frame, false); | |
| 1662 } | |
| 1663 } | |
| 1664 if (has_listener != has_unload_listener_) { | |
| 1665 has_unload_listener_ = has_listener; | |
| 1666 Send(new ViewHostMsg_UnloadListenerChanged(routing_id_, has_listener)); | |
| 1667 } | |
| 1668 } | 1656 } |
| 1669 | 1657 |
| 1670 void RenderView::QueryFormFieldAutofill(const std::wstring& field_name, | 1658 void RenderView::QueryFormFieldAutofill(const std::wstring& field_name, |
| 1671 const std::wstring& text, | 1659 const std::wstring& text, |
| 1672 int64 node_id) { | 1660 int64 node_id) { |
| 1673 static int message_id_counter = 0; | 1661 static int message_id_counter = 0; |
| 1674 form_field_autofill_request_id_ = message_id_counter++; | 1662 form_field_autofill_request_id_ = message_id_counter++; |
| 1675 Send(new ViewHostMsg_QueryFormFieldAutofill(routing_id_, | 1663 Send(new ViewHostMsg_QueryFormFieldAutofill(routing_id_, |
| 1676 field_name, text, | 1664 field_name, text, |
| 1677 node_id, | 1665 node_id, |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 template_resource_id)); | 2713 template_resource_id)); |
| 2726 | 2714 |
| 2727 if (template_html.empty()) { | 2715 if (template_html.empty()) { |
| 2728 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2716 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
| 2729 return ""; | 2717 return ""; |
| 2730 } | 2718 } |
| 2731 // "t" is the id of the templates root node. | 2719 // "t" is the id of the templates root node. |
| 2732 return jstemplate_builder::GetTemplateHtml( | 2720 return jstemplate_builder::GetTemplateHtml( |
| 2733 template_html, &error_strings, "t"); | 2721 template_html, &error_strings, "t"); |
| 2734 } | 2722 } |
| OLD | NEW |