Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 8716004: Add per-tab "JavaScript enabled" preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/render_view_context_menu.cc
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index ae12b2393dad9c229c7729d1d750abf78d2e2f87..3a0d07059ad0339565ae2ecc018b9eb8492981b9 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -1808,8 +1808,14 @@ void RenderViewContextMenu::MenuClosed(ui::SimpleMenuModel* source) {
bool RenderViewContextMenu::IsDevCommandEnabled(int id) const {
if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ TabContentsWrapper* tab_contents_wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(
+ source_tab_contents_);
+ if (!tab_contents_wrapper)
+ return false;
// Don't enable the web inspector if JavaScript is disabled.
- if (!profile_->GetPrefs()->GetBoolean(prefs::kWebKitJavascriptEnabled) ||
+ if (!tab_contents_wrapper->per_tab_prefs()->GetBoolean(
+ prefs::kWebKitJavascriptEnabled) ||
command_line.HasSwitch(switches::kDisableJavaScript))
return false;
// Don't enable the web inspector if the developer tools are disabled via

Powered by Google App Engine
This is Rietveld 408576698