From 0df3012fff2579aa4c09378fec0873f5c4589aab Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Wed, 3 Jun 2009 12:13:08 +0000 Subject: Implement InspectorClient's Settings API. This CL implements InspectorClient's API for reading / writing inspector settings. Here is how this is done: - inspector_client_impl.cc caches / serializes preferences into raw strings. It supports all kinds of settings except for string vector. I did not implement it since a) it requires more escaping b) I think we should get rid of it upstream. It then passes serialized settings string over IPC. - There is a dedicated IPC message called UpdateInspectorSettings that takes care of settings update. Two things I don't like: 1) reading settings and writing settings follow different paths: WebPreferences interface for read, delegate -> IPC for write. WebPreferences on read is used since these settings are needed very early in the page cycle. delegate -> IPC on write is the only option. 2) this looks like too much code on the Chrome side for functionality like this. Is there a more generic way of settings and persisting WebKit's preferences in Chrome? Should there be one? Review URL: http://codereview.chromium.org/119041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17473 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/pref_names.cc | 2 ++ chrome/common/pref_names.h | 1 + chrome/common/render_messages.h | 2 ++ chrome/common/render_messages_internal.h | 4 ++++ 4 files changed, 9 insertions(+) (limited to 'chrome/common') diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 3ef102c..fd227a8 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -117,6 +117,8 @@ const wchar_t kWebKitShrinksStandaloneImagesToFit[] = L"webkit.webprefs.shrinks_standalone_images_to_fit"; const wchar_t kWebKitDeveloperExtrasEnabled[] = L"webkit.webprefs.developer_extras_enabled"; +const wchar_t kWebKitInspectorSettings[] = + L"webkit.webprefs.inspector_settings"; const wchar_t kWebKitUsesUniversalDetector[] = L"webkit.webprefs.uses_universal_detector"; const wchar_t kWebKitTextAreasAreResizable[] = diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 2114b0b..3a12f57 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -44,6 +44,7 @@ extern const wchar_t kWebKitPluginsEnabled[]; extern const wchar_t kWebKitDomPasteEnabled[]; extern const wchar_t kWebKitShrinksStandaloneImagesToFit[]; extern const wchar_t kWebKitDeveloperExtrasEnabled[]; +extern const wchar_t kWebKitInspectorSettings[]; extern const wchar_t kWebKitUsesUniversalDetector[]; extern const wchar_t kWebKitTextAreasAreResizable[]; extern const wchar_t kWebKitJavaEnabled[]; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 4511b0e..ee42f58 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -1523,6 +1523,7 @@ struct ParamTraits { WriteParam(m, p.plugins_enabled); WriteParam(m, p.dom_paste_enabled); WriteParam(m, p.developer_extras_enabled); + WriteParam(m, p.inspector_settings); WriteParam(m, p.shrinks_standalone_images_to_fit); WriteParam(m, p.uses_universal_detector); WriteParam(m, p.text_areas_are_resizable); @@ -1552,6 +1553,7 @@ struct ParamTraits { ReadParam(m, iter, &p->plugins_enabled) && ReadParam(m, iter, &p->dom_paste_enabled) && ReadParam(m, iter, &p->developer_extras_enabled) && + ReadParam(m, iter, &p->inspector_settings) && ReadParam(m, iter, &p->shrinks_standalone_images_to_fit) && ReadParam(m, iter, &p->uses_universal_detector) && ReadParam(m, iter, &p->text_areas_are_resizable) && diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 5faeb51..2559381 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1092,6 +1092,10 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_ROUTED1(ViewHostMsg_DebuggerOutput, std::wstring /* msg */) + // Stores new inspector settings in the profile. + IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateInspectorSettings, + std::wstring /* raw_settings */) + // Wraps an IPC message that's destined to the DevToolsClient on // DevToolsAgent->browser hop. IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsClient, -- cgit v1.1