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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 } | 1671 } |
1672 | 1672 |
1673 ProtocolHandlerRegistry::ProtocolHandlerList | 1673 ProtocolHandlerRegistry::ProtocolHandlerList |
1674 RenderViewContextMenu::GetHandlersForLinkUrl() { | 1674 RenderViewContextMenu::GetHandlersForLinkUrl() { |
1675 ProtocolHandlerRegistry::ProtocolHandlerList handlers = | 1675 ProtocolHandlerRegistry::ProtocolHandlerList handlers = |
1676 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); | 1676 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); |
1677 sort(handlers.begin(), handlers.end()); | 1677 sort(handlers.begin(), handlers.end()); |
1678 return handlers; | 1678 return handlers; |
1679 } | 1679 } |
1680 | 1680 |
1681 void RenderViewContextMenu::MenuWillShow() { | 1681 void RenderViewContextMenu::MenuWillShow(ui::SimpleMenuModel* source) { |
| 1682 // Ignore notifications from submenus. |
| 1683 if (source != &menu_model_) |
| 1684 return; |
| 1685 |
1682 RenderWidgetHostView* view = source_tab_contents_->GetRenderWidgetHostView(); | 1686 RenderWidgetHostView* view = source_tab_contents_->GetRenderWidgetHostView(); |
1683 if (view) | 1687 if (view) |
1684 view->ShowingContextMenu(true); | 1688 view->ShowingContextMenu(true); |
1685 } | 1689 } |
1686 | 1690 |
1687 void RenderViewContextMenu::MenuClosed() { | 1691 void RenderViewContextMenu::MenuClosed(ui::SimpleMenuModel* source) { |
| 1692 // Ignore notifications from submenus. |
| 1693 if (source != &menu_model_) |
| 1694 return; |
| 1695 |
1688 RenderWidgetHostView* view = source_tab_contents_->GetRenderWidgetHostView(); | 1696 RenderWidgetHostView* view = source_tab_contents_->GetRenderWidgetHostView(); |
1689 if (view) | 1697 if (view) |
1690 view->ShowingContextMenu(false); | 1698 view->ShowingContextMenu(false); |
1691 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1699 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
1692 if (rvh) { | 1700 if (rvh) { |
1693 rvh->Send(new ViewMsg_ContextMenuClosed( | 1701 rvh->Send(new ViewMsg_ContextMenuClosed( |
1694 rvh->routing_id(), params_.custom_context)); | 1702 rvh->routing_id(), params_.custom_context)); |
1695 } | 1703 } |
1696 } | 1704 } |
1697 | 1705 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 g_browser_process->clipboard()); | 1776 g_browser_process->clipboard()); |
1769 } | 1777 } |
1770 | 1778 |
1771 void RenderViewContextMenu::MediaPlayerActionAt( | 1779 void RenderViewContextMenu::MediaPlayerActionAt( |
1772 const gfx::Point& location, | 1780 const gfx::Point& location, |
1773 const WebMediaPlayerAction& action) { | 1781 const WebMediaPlayerAction& action) { |
1774 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1782 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
1775 rvh->Send(new ViewMsg_MediaPlayerActionAt( | 1783 rvh->Send(new ViewMsg_MediaPlayerActionAt( |
1776 rvh->routing_id(), location, action)); | 1784 rvh->routing_id(), location, action)); |
1777 } | 1785 } |
OLD | NEW |