| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 37 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 38 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
| 39 #include "chrome/browser/profiles/profile_io_data.h" | 39 #include "chrome/browser/profiles/profile_io_data.h" |
| 40 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory
.h" | 40 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory
.h" |
| 41 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" | 41 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" |
| 42 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" | 42 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" |
| 43 #include "chrome/browser/search/search.h" | 43 #include "chrome/browser/search/search.h" |
| 44 #include "chrome/browser/search_engines/template_url_service_factory.h" | 44 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 45 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 45 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
| 46 #include "chrome/browser/spellchecker/spellcheck_service.h" | 46 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 47 #include "chrome/browser/ssl/security_state_model.h" |
| 47 #include "chrome/browser/tab_contents/retargeting_details.h" | 48 #include "chrome/browser/tab_contents/retargeting_details.h" |
| 48 #include "chrome/browser/translate/chrome_translate_client.h" | 49 #include "chrome/browser/translate/chrome_translate_client.h" |
| 49 #include "chrome/browser/translate/translate_service.h" | 50 #include "chrome/browser/translate/translate_service.h" |
| 50 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
| 51 #include "chrome/browser/ui/browser_commands.h" | 52 #include "chrome/browser/ui/browser_commands.h" |
| 52 #include "chrome/browser/ui/browser_finder.h" | 53 #include "chrome/browser/ui/browser_finder.h" |
| 53 #include "chrome/browser/ui/chrome_pages.h" | 54 #include "chrome/browser/ui/chrome_pages.h" |
| 54 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 55 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 55 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 56 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 56 #include "chrome/common/chrome_constants.h" | 57 #include "chrome/common/chrome_constants.h" |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { | 1687 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { |
| 1687 NavigationController* controller = | 1688 NavigationController* controller = |
| 1688 &embedder_web_contents_->GetController(); | 1689 &embedder_web_contents_->GetController(); |
| 1689 // Important to use GetVisibleEntry to match what's showing in the | 1690 // Important to use GetVisibleEntry to match what's showing in the |
| 1690 // omnibox. This may return null. | 1691 // omnibox. This may return null. |
| 1691 NavigationEntry* nav_entry = controller->GetVisibleEntry(); | 1692 NavigationEntry* nav_entry = controller->GetVisibleEntry(); |
| 1692 if (!nav_entry) | 1693 if (!nav_entry) |
| 1693 return; | 1694 return; |
| 1694 Browser* browser = | 1695 Browser* browser = |
| 1695 chrome::FindBrowserWithWebContents(embedder_web_contents_); | 1696 chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 1697 SecurityStateModel* security_model = |
| 1698 SecurityStateModel::FromWebContents(embedder_web_contents_); |
| 1699 DCHECK(security_model); |
| 1696 chrome::ShowWebsiteSettings(browser, embedder_web_contents_, | 1700 chrome::ShowWebsiteSettings(browser, embedder_web_contents_, |
| 1697 nav_entry->GetURL(), nav_entry->GetSSL()); | 1701 nav_entry->GetURL(), |
| 1702 security_model->GetSecurityInfo()); |
| 1698 break; | 1703 break; |
| 1699 } | 1704 } |
| 1700 | 1705 |
| 1701 case IDC_CONTENT_CONTEXT_TRANSLATE: { | 1706 case IDC_CONTENT_CONTEXT_TRANSLATE: { |
| 1702 // A translation might have been triggered by the time the menu got | 1707 // A translation might have been triggered by the time the menu got |
| 1703 // selected, do nothing in that case. | 1708 // selected, do nothing in that case. |
| 1704 ChromeTranslateClient* chrome_translate_client = | 1709 ChromeTranslateClient* chrome_translate_client = |
| 1705 ChromeTranslateClient::FromWebContents(embedder_web_contents_); | 1710 ChromeTranslateClient::FromWebContents(embedder_web_contents_); |
| 1706 if (!chrome_translate_client || | 1711 if (!chrome_translate_client || |
| 1707 chrome_translate_client->GetLanguageState().IsPageTranslated() || | 1712 chrome_translate_client->GetLanguageState().IsPageTranslated() || |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1735 break; | 1740 break; |
| 1736 | 1741 |
| 1737 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: | 1742 case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: |
| 1738 source_web_contents_->ViewFrameSource(params_.frame_url, | 1743 source_web_contents_->ViewFrameSource(params_.frame_url, |
| 1739 params_.frame_page_state); | 1744 params_.frame_page_state); |
| 1740 break; | 1745 break; |
| 1741 | 1746 |
| 1742 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: { | 1747 case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: { |
| 1743 Browser* browser = chrome::FindBrowserWithWebContents( | 1748 Browser* browser = chrome::FindBrowserWithWebContents( |
| 1744 source_web_contents_); | 1749 source_web_contents_); |
| 1750 SecurityStateModel::SecurityInfo security_info; |
| 1751 SecurityStateModel::SecurityInfoForRequest( |
| 1752 params_.frame_url, params_.security_info, |
| 1753 Profile::FromBrowserContext( |
| 1754 source_web_contents_->GetBrowserContext()), |
| 1755 &security_info); |
| 1745 chrome::ShowWebsiteSettings(browser, source_web_contents_, | 1756 chrome::ShowWebsiteSettings(browser, source_web_contents_, |
| 1746 params_.frame_url, params_.security_info); | 1757 params_.frame_url, security_info); |
| 1747 break; | 1758 break; |
| 1748 } | 1759 } |
| 1749 | 1760 |
| 1750 case IDC_CONTENT_CONTEXT_UNDO: | 1761 case IDC_CONTENT_CONTEXT_UNDO: |
| 1751 source_web_contents_->Undo(); | 1762 source_web_contents_->Undo(); |
| 1752 break; | 1763 break; |
| 1753 | 1764 |
| 1754 case IDC_CONTENT_CONTEXT_REDO: | 1765 case IDC_CONTENT_CONTEXT_REDO: |
| 1755 source_web_contents_->Redo(); | 1766 source_web_contents_->Redo(); |
| 1756 break; | 1767 break; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 source_web_contents_->GetRenderViewHost()-> | 1959 source_web_contents_->GetRenderViewHost()-> |
| 1949 ExecuteMediaPlayerActionAtLocation(location, action); | 1960 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1950 } | 1961 } |
| 1951 | 1962 |
| 1952 void RenderViewContextMenu::PluginActionAt( | 1963 void RenderViewContextMenu::PluginActionAt( |
| 1953 const gfx::Point& location, | 1964 const gfx::Point& location, |
| 1954 const WebPluginAction& action) { | 1965 const WebPluginAction& action) { |
| 1955 source_web_contents_->GetRenderViewHost()-> | 1966 source_web_contents_->GetRenderViewHost()-> |
| 1956 ExecutePluginActionAtLocation(location, action); | 1967 ExecutePluginActionAtLocation(location, action); |
| 1957 } | 1968 } |
| OLD | NEW |