| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/gfx/native_widget_types.h" | 10 #include "app/gfx/native_widget_types.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/json_reader.h" | 13 #include "base/json_reader.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/waitable_event.h" | 16 #include "base/waitable_event.h" |
| 17 #include "chrome/browser/child_process_security_policy.h" | 17 #include "chrome/browser/child_process_security_policy.h" |
| 18 #include "chrome/browser/cross_site_request_manager.h" | 18 #include "chrome/browser/cross_site_request_manager.h" |
| 19 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
| 20 #include "chrome/browser/dom_operation_notification_details.h" | 20 #include "chrome/browser/dom_operation_notification_details.h" |
| 21 #include "chrome/browser/extensions/extension_message_service.h" | 21 #include "chrome/browser/extensions/extension_message_service.h" |
| 22 #include "chrome/browser/metrics/user_metrics.h" | 22 #include "chrome/browser/metrics/user_metrics.h" |
| 23 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 23 #include "chrome/browser/profile.h" | 24 #include "chrome/browser/profile.h" |
| 24 #include "chrome/browser/renderer_host/render_process_host.h" | 25 #include "chrome/browser/renderer_host/render_process_host.h" |
| 25 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 26 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 26 #include "chrome/browser/renderer_host/render_widget_host.h" | 27 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 27 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 28 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 28 #include "chrome/browser/renderer_host/site_instance.h" | 29 #include "chrome/browser/renderer_host/site_instance.h" |
| 29 #include "chrome/common/bindings_policy.h" | 30 #include "chrome/common/bindings_policy.h" |
| 30 #include "chrome/common/notification_details.h" | 31 #include "chrome/common/notification_details.h" |
| 31 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
| 32 #include "chrome/common/notification_type.h" | 33 #include "chrome/common/notification_type.h" |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 OnReceivedSerializedHtmlData); | 827 OnReceivedSerializedHtmlData); |
| 827 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 828 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
| 828 OnDidGetApplicationInfo); | 829 OnDidGetApplicationInfo); |
| 829 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, | 830 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, |
| 830 RenderViewHostDelegate::OnJSOutOfMemory); | 831 RenderViewHostDelegate::OnJSOutOfMemory); |
| 831 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); | 832 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); |
| 832 IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutofill, | 833 IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutofill, |
| 833 OnQueryFormFieldAutofill) | 834 OnQueryFormFieldAutofill) |
| 834 IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutofillEntry, | 835 IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutofillEntry, |
| 835 OnRemoveAutofillEntry) | 836 OnRemoveAutofillEntry) |
| 837 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification, |
| 838 OnShowDesktopNotification) |
| 839 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotificationText, |
| 840 OnShowDesktopNotificationText) |
| 841 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestNotificationPermission, |
| 842 OnRequestNotificationPermission) |
| 836 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest) | 843 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest) |
| 837 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) | 844 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) |
| 838 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage, | 845 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionPostMessage, |
| 839 OnExtensionPostMessage) | 846 OnExtensionPostMessage) |
| 840 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange, | 847 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityFocusChange, |
| 841 OnAccessibilityFocusChange) | 848 OnAccessibilityFocusChange) |
| 842 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) | 849 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) |
| 843 // Have the super handle all other messages. | 850 // Have the super handle all other messages. |
| 844 IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) | 851 IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) |
| 845 IPC_END_MESSAGE_MAP_EX() | 852 IPC_END_MESSAGE_MAP_EX() |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 Send(message); | 1644 Send(message); |
| 1638 } | 1645 } |
| 1639 | 1646 |
| 1640 void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message, | 1647 void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message, |
| 1641 const std::string& origin, | 1648 const std::string& origin, |
| 1642 const std::string& target) { | 1649 const std::string& target) { |
| 1643 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, | 1650 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, |
| 1644 target)); | 1651 target)); |
| 1645 } | 1652 } |
| 1646 | 1653 |
| 1654 void RenderViewHost::OnShowDesktopNotification(const GURL& source_origin, |
| 1655 const GURL& url, int notification_id) { |
| 1656 DesktopNotificationService* service = |
| 1657 process()->profile()->GetDesktopNotificationService(); |
| 1658 service->ShowDesktopNotification(source_origin, url, process()->id(), |
| 1659 routing_id(), DesktopNotificationService::PageNotification, |
| 1660 notification_id); |
| 1661 } |
| 1662 |
| 1663 void RenderViewHost::OnShowDesktopNotificationText(const GURL& source_origin, |
| 1664 const GURL& icon, const string16& title, const string16& text, |
| 1665 int notification_id) { |
| 1666 DesktopNotificationService* service = |
| 1667 process()->profile()->GetDesktopNotificationService(); |
| 1668 service->ShowDesktopNotificationText(source_origin, icon, title, text, |
| 1669 process()->id(), routing_id(), |
| 1670 DesktopNotificationService::PageNotification, notification_id); |
| 1671 } |
| 1672 |
| 1673 void RenderViewHost::OnRequestNotificationPermission( |
| 1674 const GURL& source_origin, int callback_context) { |
| 1675 DesktopNotificationService* service = |
| 1676 process()->profile()->GetDesktopNotificationService(); |
| 1677 service->RequestPermission(source_origin, callback_context); |
| 1678 } |
| 1679 |
| 1647 void RenderViewHost::OnExtensionRequest(const std::string& name, | 1680 void RenderViewHost::OnExtensionRequest(const std::string& name, |
| 1648 const ListValue& args_holder, | 1681 const ListValue& args_holder, |
| 1649 int request_id, | 1682 int request_id, |
| 1650 bool has_callback) { | 1683 bool has_callback) { |
| 1651 if (!ChildProcessSecurityPolicy::GetInstance()-> | 1684 if (!ChildProcessSecurityPolicy::GetInstance()-> |
| 1652 HasExtensionBindings(process()->id())) { | 1685 HasExtensionBindings(process()->id())) { |
| 1653 // This can happen if someone uses window.open() to open an extension URL | 1686 // This can happen if someone uses window.open() to open an extension URL |
| 1654 // from a non-extension context. | 1687 // from a non-extension context. |
| 1655 BlockExtensionRequest(request_id); | 1688 BlockExtensionRequest(request_id); |
| 1656 return; | 1689 return; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 #endif | 1734 #endif |
| 1702 } | 1735 } |
| 1703 | 1736 |
| 1704 void RenderViewHost::OnCSSInserted() { | 1737 void RenderViewHost::OnCSSInserted() { |
| 1705 delegate_->DidInsertCSS(); | 1738 delegate_->DidInsertCSS(); |
| 1706 } | 1739 } |
| 1707 | 1740 |
| 1708 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 1741 void RenderViewHost::UpdateBrowserWindowId(int window_id) { |
| 1709 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 1742 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); |
| 1710 } | 1743 } |
| OLD | NEW |