From 96d3fb5954088dc929dcedfd82c5b6a05e0e3116 Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Wed, 27 May 2009 14:51:21 +0000 Subject: DevTools: Add 'Enable Developer Tools' option into the Advanced tab. Hide developer tools by default. Review URL: http://codereview.chromium.org/117003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16984 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/debugger/devtools_manager.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chrome/browser/debugger/devtools_manager.cc') diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index 582cc90..67e3aa8 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -6,9 +6,12 @@ #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/debugger/devtools_client_host.h" +#include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/site_instance.h" #include "chrome/common/devtools_messages.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" #include "googleurl/src/gurl.h" DevToolsManager::DevToolsManager() { @@ -85,6 +88,7 @@ void DevToolsManager::ForwardToDevToolsClient(RenderViewHost* inspected_rvh, } void DevToolsManager::OpenDevToolsWindow(RenderViewHost* inspected_rvh) { + EnableDevToolsInPrefs(inspected_rvh); DevToolsClientHost* host = GetDevToolsClientHostFor(inspected_rvh); if (!host) { host = new DevToolsWindow( @@ -165,3 +169,13 @@ void DevToolsManager::SendDetachToAgent(RenderViewHost* inspected_rvh) { inspected_rvh->Send(m); } } + +void DevToolsManager::EnableDevToolsInPrefs(RenderViewHost* inspected_rvh) { + Profile* profile = inspected_rvh->site_instance()->browsing_instance()-> + profile(); + if (!profile->GetPrefs()->GetBoolean(prefs::kWebKitDeveloperExtrasEnabled)) { + //TODO(pfeldman): Show message box with warning to the user. + profile->GetPrefs()->SetBoolean(prefs::kWebKitDeveloperExtrasEnabled, + true); + } +} -- cgit v1.1