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

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: Moved per-tab prefs into a helper 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 c39b4668aa18664eabfc77841d783b0541a74173..003971c0b00125ccec1da60c9266f1f167024a60 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -46,6 +46,7 @@
#include "chrome/browser/translate/translate_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
+#include "chrome/browser/ui/tab_contents/per_tab_prefs_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -1772,8 +1773,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_tab_helper()->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