diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 12:13:08 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 12:13:08 +0000 |
commit | 0df3012fff2579aa4c09378fec0873f5c4589aab (patch) | |
tree | f63ad10d3efae0c81c3240293e20e7b003ea281b /chrome/browser/tab_contents | |
parent | ce29eeeb501db818f8f91158fd0f740a9673db61 (diff) | |
download | chromium_src-0df3012fff2579aa4c09378fec0873f5c4589aab.zip chromium_src-0df3012fff2579aa4c09378fec0873f5c4589aab.tar.gz chromium_src-0df3012fff2579aa4c09378fec0873f5c4589aab.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_delegate_helper.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 7 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 1 |
3 files changed, 10 insertions, 0 deletions
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 6132743..f0608bc 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -142,6 +142,8 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); web_prefs.shrinks_standalone_images_to_fit = prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit); + web_prefs.inspector_settings = + prefs->GetString(prefs::kWebKitInspectorSettings); { // Command line switches are used for preferences with no user interface. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index b0d5b71..db05c00 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -364,6 +364,8 @@ void TabContents::RegisterUserPrefs(PrefService* prefs) { pref_defaults.shrinks_standalone_images_to_fit); prefs->RegisterBooleanPref(prefs::kWebKitDeveloperExtrasEnabled, pref_defaults.developer_extras_enabled); + prefs->RegisterStringPref(prefs::kWebKitInspectorSettings, + pref_defaults.inspector_settings); prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable, pref_defaults.text_areas_are_resizable); prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled, @@ -1774,6 +1776,11 @@ void TabContents::UpdateThumbnail(const GURL& url, } } +void TabContents::UpdateInspectorSettings(const std::wstring& raw_settings) { + profile()->GetPrefs()->SetString(prefs::kWebKitInspectorSettings, + raw_settings); +} + void TabContents::Close(RenderViewHost* rvh) { // Ignore this if it comes from a RenderViewHost that we aren't showing. if (delegate() && rvh == render_view_host()) diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 7e3a70f..c43a919 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -758,6 +758,7 @@ class TabContents : public PageNavigator, virtual void UpdateThumbnail(const GURL& url, const SkBitmap& bitmap, const ThumbnailScore& score); + virtual void UpdateInspectorSettings(const std::wstring& raw_settings); virtual void Close(RenderViewHost* render_view_host); virtual void RequestMove(const gfx::Rect& new_bounds); virtual void DidStartLoading(RenderViewHost* render_view_host); |