| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
| 56 #include "chrome/common/chrome_notification_types.h" | 56 #include "chrome/common/chrome_notification_types.h" |
| 57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/extensions/extension.h" | 58 #include "chrome/common/extensions/extension.h" |
| 59 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
| 60 #include "chrome/common/print_messages.h" | 60 #include "chrome/common/print_messages.h" |
| 61 #include "chrome/common/spellcheck_messages.h" | 61 #include "chrome/common/spellcheck_messages.h" |
| 62 #include "chrome/common/url_constants.h" | 62 #include "chrome/common/url_constants.h" |
| 63 #include "content/browser/download/download_types.h" | 63 #include "content/browser/download/download_types.h" |
| 64 #include "content/browser/renderer_host/render_view_host.h" | 64 #include "content/browser/renderer_host/render_view_host.h" |
| 65 #include "content/browser/renderer_host/render_widget_host_view.h" | |
| 66 #include "content/public/browser/child_process_security_policy.h" | 65 #include "content/public/browser/child_process_security_policy.h" |
| 67 #include "content/public/browser/download_manager.h" | 66 #include "content/public/browser/download_manager.h" |
| 68 #include "content/public/browser/navigation_details.h" | 67 #include "content/public/browser/navigation_details.h" |
| 69 #include "content/public/browser/navigation_entry.h" | 68 #include "content/public/browser/navigation_entry.h" |
| 70 #include "content/public/browser/notification_service.h" | 69 #include "content/public/browser/notification_service.h" |
| 70 #include "content/public/browser/render_widget_host_view.h" |
| 71 #include "content/public/browser/speech_input_preferences.h" | 71 #include "content/public/browser/speech_input_preferences.h" |
| 72 #include "content/public/browser/user_metrics.h" | 72 #include "content/public/browser/user_metrics.h" |
| 73 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
| 74 #include "content/public/common/content_restriction.h" | 74 #include "content/public/common/content_restriction.h" |
| 75 #include "content/public/common/ssl_status.h" | 75 #include "content/public/common/ssl_status.h" |
| 76 #include "grit/generated_resources.h" | 76 #include "grit/generated_resources.h" |
| 77 #include "net/base/escape.h" | 77 #include "net/base/escape.h" |
| 78 #include "net/base/net_util.h" | 78 #include "net/base/net_util.h" |
| 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
| 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); | 1869 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); |
| 1870 std::sort(handlers.begin(), handlers.end()); | 1870 std::sort(handlers.begin(), handlers.end()); |
| 1871 return handlers; | 1871 return handlers; |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 void RenderViewContextMenu::MenuWillShow(ui::SimpleMenuModel* source) { | 1874 void RenderViewContextMenu::MenuWillShow(ui::SimpleMenuModel* source) { |
| 1875 // Ignore notifications from submenus. | 1875 // Ignore notifications from submenus. |
| 1876 if (source != &menu_model_) | 1876 if (source != &menu_model_) |
| 1877 return; | 1877 return; |
| 1878 | 1878 |
| 1879 RenderWidgetHostView* view = source_web_contents_->GetRenderWidgetHostView(); | 1879 content::RenderWidgetHostView* view = |
| 1880 source_web_contents_->GetRenderWidgetHostView(); |
| 1880 if (view) | 1881 if (view) |
| 1881 view->SetShowingContextMenu(true); | 1882 view->SetShowingContextMenu(true); |
| 1882 } | 1883 } |
| 1883 | 1884 |
| 1884 void RenderViewContextMenu::MenuClosed(ui::SimpleMenuModel* source) { | 1885 void RenderViewContextMenu::MenuClosed(ui::SimpleMenuModel* source) { |
| 1885 // Ignore notifications from submenus. | 1886 // Ignore notifications from submenus. |
| 1886 if (source != &menu_model_) | 1887 if (source != &menu_model_) |
| 1887 return; | 1888 return; |
| 1888 | 1889 |
| 1889 RenderWidgetHostView* view = source_web_contents_->GetRenderWidgetHostView(); | 1890 content::RenderWidgetHostView* view = |
| 1891 source_web_contents_->GetRenderWidgetHostView(); |
| 1890 if (view) | 1892 if (view) |
| 1891 view->SetShowingContextMenu(false); | 1893 view->SetShowingContextMenu(false); |
| 1892 RenderViewHost* rvh = source_web_contents_->GetRenderViewHost(); | 1894 RenderViewHost* rvh = source_web_contents_->GetRenderViewHost(); |
| 1893 if (rvh) { | 1895 if (rvh) { |
| 1894 rvh->NotifyContextMenuClosed(params_.custom_context); | 1896 rvh->NotifyContextMenuClosed(params_.custom_context); |
| 1895 } | 1897 } |
| 1896 } | 1898 } |
| 1897 | 1899 |
| 1898 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { | 1900 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { |
| 1899 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { | 1901 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 source_web_contents_->GetRenderViewHost()-> | 1988 source_web_contents_->GetRenderViewHost()-> |
| 1987 ExecuteMediaPlayerActionAtLocation(location, action); | 1989 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1988 } | 1990 } |
| 1989 | 1991 |
| 1990 void RenderViewContextMenu::PluginActionAt( | 1992 void RenderViewContextMenu::PluginActionAt( |
| 1991 const gfx::Point& location, | 1993 const gfx::Point& location, |
| 1992 const WebPluginAction& action) { | 1994 const WebPluginAction& action) { |
| 1993 source_web_contents_->GetRenderViewHost()-> | 1995 source_web_contents_->GetRenderViewHost()-> |
| 1994 ExecutePluginActionAtLocation(location, action); | 1996 ExecutePluginActionAtLocation(location, action); |
| 1995 } | 1997 } |
| OLD | NEW |