summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 10:20:14 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-01 10:20:14 +0000
commitc4e9890a10fb35a78247be5d204d77f512d7654c (patch)
tree721f8deca6173a7ea06f50e991597a2fde7269de /chrome
parent0bda0e053a5d9dc61c6ab026b328873111eb2b81 (diff)
downloadchromium_src-c4e9890a10fb35a78247be5d204d77f512d7654c.zip
chromium_src-c4e9890a10fb35a78247be5d204d77f512d7654c.tar.gz
chromium_src-c4e9890a10fb35a78247be5d204d77f512d7654c.tar.bz2
DevTools: inspector settings are now serialized into map, not a string
WebKit roll 60462:60647 Original review: http://codereview.chromium.org/2422001 Review URL: http://codereview.chromium.org/2459002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rwxr-xr-x[-rw-r--r--]chrome/browser/debugger/devtools_sanity_unittest.cc10
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc10
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h5
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc13
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc12
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
-rw-r--r--chrome/common/render_messages_internal.h7
-rwxr-xr-x[-rw-r--r--]chrome/renderer/render_view.cc8
-rw-r--r--chrome/renderer/render_view.h3
10 files changed, 48 insertions, 27 deletions
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc
index 67f1f58..e27339b 100644..100755
--- a/chrome/browser/debugger/devtools_sanity_unittest.cc
+++ b/chrome/browser/debugger/devtools_sanity_unittest.cc
@@ -321,13 +321,17 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest,
TestScriptsTabIsPopulatedOnInspectedPageRefresh) {
// Reset inspector settings to defaults to ensure that Elements will be
// current panel when DevTools window is open.
- GetInspectedTab()->render_view_host()->delegate()->UpdateInspectorSettings(
- WebPreferences().inspector_settings);
+ const WebPreferences::WebInspectorPreferences& settings =
+ WebPreferences().inspector_settings;
+ WebPreferences::WebInspectorPreferences::const_iterator it =
+ settings.begin();
+ for ( ; it != settings.end(); ++it)
+ GetInspectedTab()->render_view_host()->delegate()->UpdateInspectorSetting(
+ it->first, it->second);
RunTest("testScriptsTabIsPopulatedOnInspectedPageRefresh",
kDebuggerTestPage);
}
-
// Tests that a content script is in the scripts list.
// This test is disabled, see bug 28961.
IN_PROC_BROWSER_TEST_F(DevToolsExtensionDebugTest,
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 562faac..ed1c1b4b 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -712,8 +712,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL)
IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail)
IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot)
- IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSettings,
- OnUpdateInspectorSettings);
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting,
+ OnUpdateInspectorSetting);
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading)
@@ -1019,9 +1019,9 @@ void RenderViewHost::OnMsgScreenshot(const SkBitmap& bitmap) {
Details<const SkBitmap>(&bitmap));
}
-void RenderViewHost::OnUpdateInspectorSettings(
- const std::string& raw_settings) {
- delegate_->UpdateInspectorSettings(raw_settings);
+void RenderViewHost::OnUpdateInspectorSetting(
+ const std::string& key, const std::string& value) {
+ delegate_->UpdateInspectorSetting(key, value);
}
void RenderViewHost::OnMsgClose() {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index cd97788..d789047 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -577,8 +577,8 @@ class RenderViewHost : public RenderWidgetHost {
void OnAddMessageToConsole(const std::wstring& message,
int32 line_no,
const std::wstring& source_id);
-
- void OnUpdateInspectorSettings(const std::string& raw_settings);
+ void OnUpdateInspectorSetting(const std::string& key,
+ const std::string& value);
void OnForwardToDevToolsAgent(const IPC::Message& message);
void OnForwardToDevToolsClient(const IPC::Message& message);
void OnActivateDevToolsWindow();
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 6fc89bf..ac3198c 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -516,8 +516,9 @@ class RenderViewHostDelegate {
const SkBitmap& bitmap,
const ThumbnailScore& score) {}
- // Inspector settings were changes and should be persisted.
- virtual void UpdateInspectorSettings(const std::string& raw_settings) {}
+ // Inspector setting was changed and should be persisted.
+ virtual void UpdateInspectorSetting(const std::string& key,
+ const std::string& value) {}
// The page is trying to close the RenderView's representation in the client.
virtual void Close(RenderViewHost* render_view_host) {}
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 590a500..2d84d45 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -188,8 +188,17 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
prefs->GetBoolean(prefs::kWebKitDomPasteEnabled);
web_prefs.shrinks_standalone_images_to_fit =
prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit);
- web_prefs.inspector_settings = WideToUTF8(
- prefs->GetString(prefs::kWebKitInspectorSettings));
+ const DictionaryValue* inspector_settings =
+ prefs->GetDictionary(prefs::kWebKitInspectorSettings);
+ if (inspector_settings) {
+ for (DictionaryValue::key_iterator iter(inspector_settings->begin_keys());
+ iter != inspector_settings->end_keys(); ++iter) {
+ std::string value;
+ if (inspector_settings->GetStringWithoutPathExpansion(*iter, &value))
+ web_prefs.inspector_settings.push_back(
+ std::make_pair(WideToUTF8(*iter), value));
+ }
+ }
web_prefs.tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks);
{ // Command line switches are used for preferences with no user interface.
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 86ad0c5..1599737 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -440,8 +440,7 @@ void TabContents::RegisterUserPrefs(PrefService* prefs) {
pref_defaults.dom_paste_enabled);
prefs->RegisterBooleanPref(prefs::kWebKitShrinksStandaloneImagesToFit,
pref_defaults.shrinks_standalone_images_to_fit);
- prefs->RegisterStringPref(prefs::kWebKitInspectorSettings,
- UTF8ToWide(pref_defaults.inspector_settings));
+ prefs->RegisterDictionaryPref(prefs::kWebKitInspectorSettings);
prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable,
pref_defaults.text_areas_are_resizable);
prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled,
@@ -2431,9 +2430,12 @@ void TabContents::UpdateThumbnail(const GURL& url,
}
}
-void TabContents::UpdateInspectorSettings(const std::string& raw_settings) {
- profile()->GetPrefs()->SetString(prefs::kWebKitInspectorSettings,
- UTF8ToWide(raw_settings));
+void TabContents::UpdateInspectorSetting(const std::string& key,
+ const std::string& value) {
+ DictionaryValue* inspector_settings =
+ profile()->GetPrefs()->GetMutableDictionary(
+ prefs::kWebKitInspectorSettings);
+ inspector_settings->SetString(UTF8ToWide(key), value);
}
void TabContents::Close(RenderViewHost* rvh) {
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index fa4f201..5e72cc5 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -919,7 +919,8 @@ class TabContents : public PageNavigator,
virtual void UpdateThumbnail(const GURL& url,
const SkBitmap& bitmap,
const ThumbnailScore& score);
- virtual void UpdateInspectorSettings(const std::string& raw_settings);
+ virtual void UpdateInspectorSetting(const std::string& key,
+ const std::string& value);
virtual void Close(RenderViewHost* render_view_host);
virtual void RequestMove(const gfx::Rect& new_bounds);
virtual void DidStartLoading();
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index d9a0a64..c4ea9e9 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1586,9 +1586,10 @@ IPC_BEGIN_MESSAGES(ViewHost)
int32, /* line number */
std::wstring /* source id */)
- // Stores new inspector settings in the profile.
- IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateInspectorSettings,
- std::string /* raw_settings */)
+ // Stores new inspector setting in the profile.
+ IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting,
+ std::string, /* key */
+ std::string /* value */)
// Wraps an IPC message that's destined to the DevToolsClient on
// DevToolsAgent->browser hop.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index df1e665..f8f3c39 100644..100755
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1991,9 +1991,11 @@ int RenderView::historyForwardListCount() {
return history_list_length_ - historyBackListCount() - 1;
}
-void RenderView::didUpdateInspectorSettings() {
- Send(new ViewHostMsg_UpdateInspectorSettings(
- routing_id_, webview()->inspectorSettings().utf8()));
+void RenderView::didUpdateInspectorSetting(const WebString& key,
+ const WebString& value) {
+ Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_,
+ key.utf8(),
+ value.utf8()));
}
void RenderView::queryAutofillSuggestions(const WebNode& node,
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 89e46a9..529f6f3 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -270,7 +270,8 @@ class RenderView : public RenderWidget,
const WebKit::WebAccessibilityObject& acc_obj);
virtual void didChangeAccessibilityObjectState(
const WebKit::WebAccessibilityObject& acc_obj);
- virtual void didUpdateInspectorSettings();
+ virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
+ const WebKit::WebString& value);
virtual void queryAutofillSuggestions(
const WebKit::WebNode& node, const WebKit::WebString& name,
const WebKit::WebString& value);