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/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, | 1602 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, |
1603 target)); | 1603 target)); |
1604 } | 1604 } |
1605 | 1605 |
1606 void RenderViewHost::OnExtensionRequest(const std::string& name, | 1606 void RenderViewHost::OnExtensionRequest(const std::string& name, |
1607 const std::string& args, | 1607 const std::string& args, |
1608 int request_id, | 1608 int request_id, |
1609 bool has_callback) { | 1609 bool has_callback) { |
1610 if (!ChildProcessSecurityPolicy::GetInstance()-> | 1610 if (!ChildProcessSecurityPolicy::GetInstance()-> |
1611 HasExtensionBindings(process()->id())) { | 1611 HasExtensionBindings(process()->id())) { |
1612 NOTREACHED() << "Blocked unauthorized use of extension bindings."; | 1612 // This can happen if someone uses window.open() to open an extension URL |
| 1613 // from a non-extension context. |
| 1614 BlockExtensionRequest(request_id); |
1613 return; | 1615 return; |
1614 } | 1616 } |
1615 | 1617 |
1616 delegate_->ProcessDOMUIMessage(name, args, request_id, has_callback); | 1618 delegate_->ProcessDOMUIMessage(name, args, request_id, has_callback); |
1617 } | 1619 } |
1618 | 1620 |
1619 void RenderViewHost::SendExtensionResponse(int request_id, bool success, | 1621 void RenderViewHost::SendExtensionResponse(int request_id, bool success, |
1620 const std::string& response, | 1622 const std::string& response, |
1621 const std::string& error) { | 1623 const std::string& error) { |
1622 Send(new ViewMsg_ExtensionResponse(routing_id(), request_id, success, | 1624 Send(new ViewMsg_ExtensionResponse(routing_id(), request_id, success, |
1623 response, error)); | 1625 response, error)); |
1624 } | 1626 } |
1625 | 1627 |
| 1628 void RenderViewHost::BlockExtensionRequest(int request_id) { |
| 1629 SendExtensionResponse(request_id, false, "", |
| 1630 "Access to extension API denied."); |
| 1631 } |
| 1632 |
1626 void RenderViewHost::OnExtensionPostMessage( | 1633 void RenderViewHost::OnExtensionPostMessage( |
1627 int port_id, const std::string& message) { | 1634 int port_id, const std::string& message) { |
1628 if (process()->profile()->GetExtensionMessageService()) { | 1635 if (process()->profile()->GetExtensionMessageService()) { |
1629 process()->profile()->GetExtensionMessageService()-> | 1636 process()->profile()->GetExtensionMessageService()-> |
1630 PostMessageFromRenderer(port_id, message); | 1637 PostMessageFromRenderer(port_id, message); |
1631 } | 1638 } |
1632 } | 1639 } |
1633 | 1640 |
1634 void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) { | 1641 void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) { |
1635 #if defined(OS_WIN) | 1642 #if defined(OS_WIN) |
(...skipping 14 matching lines...) Expand all Loading... |
1650 } | 1657 } |
1651 | 1658 |
1652 void RenderViewHost::ResetModalDialogEvent() { | 1659 void RenderViewHost::ResetModalDialogEvent() { |
1653 if (--modal_dialog_count_ == 0) | 1660 if (--modal_dialog_count_ == 0) |
1654 modal_dialog_event_->Reset(); | 1661 modal_dialog_event_->Reset(); |
1655 } | 1662 } |
1656 | 1663 |
1657 void RenderViewHost::UpdateBrowserWindowId(int window_id) { | 1664 void RenderViewHost::UpdateBrowserWindowId(int window_id) { |
1658 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); | 1665 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); |
1659 } | 1666 } |
OLD | NEW |