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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/search_engines/template_url_service_factory.h" | 42 #include "chrome/browser/search_engines/template_url_service_factory.h" |
43 #include "chrome/browser/spellchecker/spellcheck_host.h" | 43 #include "chrome/browser/spellchecker/spellcheck_host.h" |
44 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 44 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
45 #include "chrome/browser/tab_contents/retargeting_details.h" | 45 #include "chrome/browser/tab_contents/retargeting_details.h" |
46 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 46 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
47 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 47 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
48 #include "chrome/browser/translate/translate_manager.h" | 48 #include "chrome/browser/translate/translate_manager.h" |
49 #include "chrome/browser/translate/translate_prefs.h" | 49 #include "chrome/browser/translate/translate_prefs.h" |
50 #include "chrome/browser/translate/translate_tab_helper.h" | 50 #include "chrome/browser/translate/translate_tab_helper.h" |
51 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
52 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | |
53 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 52 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
54 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 53 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
55 #include "chrome/common/chrome_constants.h" | 54 #include "chrome/common/chrome_constants.h" |
56 #include "chrome/common/chrome_notification_types.h" | 55 #include "chrome/common/chrome_notification_types.h" |
57 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
58 #include "chrome/common/extensions/extension.h" | 57 #include "chrome/common/extensions/extension.h" |
59 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
60 #include "chrome/common/print_messages.h" | 59 #include "chrome/common/print_messages.h" |
61 #include "chrome/common/spellcheck_messages.h" | 60 #include "chrome/common/spellcheck_messages.h" |
62 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 } | 1897 } |
1899 | 1898 |
1900 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { | 1899 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { |
1901 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { | 1900 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { |
1902 // Don't enable the web inspector if JavaScript is disabled. We don't | 1901 // Don't enable the web inspector if JavaScript is disabled. We don't |
1903 // check this when this is the web contents of an extension (e.g. | 1902 // check this when this is the web contents of an extension (e.g. |
1904 // for a popup extension or a platform app) as they have JavaScript | 1903 // for a popup extension or a platform app) as they have JavaScript |
1905 // always enabled. | 1904 // always enabled. |
1906 const Extension* extension = GetExtension(); | 1905 const Extension* extension = GetExtension(); |
1907 if (!extension) { | 1906 if (!extension) { |
1908 TabContentsWrapper* contents_wrapper = | |
1909 TabContentsWrapper::GetCurrentWrapperForContents( | |
1910 source_web_contents_); | |
1911 if (!contents_wrapper) | |
1912 return false; | |
1913 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1907 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1914 if (!contents_wrapper->prefs_tab_helper()->per_tab_prefs()->GetBoolean( | 1908 if (!profile_->GetPrefs()->GetBoolean( |
1915 prefs::kWebKitJavascriptEnabled) || | 1909 prefs::kWebKitGlobalJavascriptEnabled) || |
1916 command_line->HasSwitch(switches::kDisableJavaScript)) | 1910 command_line->HasSwitch(switches::kDisableJavaScript)) |
1917 return false; | 1911 return false; |
1918 #if defined(OS_MACOSX) | 1912 #if defined(OS_MACOSX) |
1919 } else { | 1913 } else { |
1920 // Disable dev tools for popup extensions for Mac OS X builds, as the | 1914 // Disable dev tools for popup extensions for Mac OS X builds, as the |
1921 // extension popups for these builds do not support dynamically inspecting | 1915 // extension popups for these builds do not support dynamically inspecting |
1922 // the popups. | 1916 // the popups. |
1923 // TODO(benwells): Add support for these builds and remove this #if. | 1917 // TODO(benwells): Add support for these builds and remove this #if. |
1924 if (!extension->is_platform_app()) | 1918 if (!extension->is_platform_app()) |
1925 return false; | 1919 return false; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 source_web_contents_->GetRenderViewHost()-> | 1982 source_web_contents_->GetRenderViewHost()-> |
1989 ExecuteMediaPlayerActionAtLocation(location, action); | 1983 ExecuteMediaPlayerActionAtLocation(location, action); |
1990 } | 1984 } |
1991 | 1985 |
1992 void RenderViewContextMenu::PluginActionAt( | 1986 void RenderViewContextMenu::PluginActionAt( |
1993 const gfx::Point& location, | 1987 const gfx::Point& location, |
1994 const WebPluginAction& action) { | 1988 const WebPluginAction& action) { |
1995 source_web_contents_->GetRenderViewHost()-> | 1989 source_web_contents_->GetRenderViewHost()-> |
1996 ExecutePluginActionAtLocation(location, action); | 1990 ExecutePluginActionAtLocation(location, action); |
1997 } | 1991 } |
OLD | NEW |