Commit 9b0db495 authored by andersca@apple.com's avatar andersca@apple.com

2008-05-05 Anders Carlsson <andersca@apple.com>

        Reviewed by John.

        Add preference for enabling the offline web application cache.
        
        * Interfaces/IWebPreferencesPrivate.idl:
        * WebPreferenceKeysPrivate.h:
        * WebPreferences.cpp:
        (WebPreferences::initializeDefaultSettings):
        (WebPreferences::setOfflineWebApplicationCacheEnabled):
        (WebPreferences::offlineWebApplicationCacheEnabled):
        * WebPreferences.h:
        * WebView.cpp:
        (WebView::notifyPreferencesChanged):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 41dedc29
2008-05-05 Anders Carlsson <andersca@apple.com>
Reviewed by John.
Add preference for enabling the offline web application cache.
* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::setOfflineWebApplicationCacheEnabled):
(WebPreferences::offlineWebApplicationCacheEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):
2008-05-05 Sam Weinig <sam@webkit.org>
Reviewed by Tim Hatcher.
......
......@@ -51,4 +51,7 @@ interface IWebPreferencesPrivate : IUnknown
HRESULT inApplicationChromeMode([out, retval] BOOL *allowed);
HRESULT setApplicationChromeMode([in] BOOL allowed);
HRESULT setOfflineWebApplicationCacheEnabled([in] BOOL enabled);
HRESULT offlineWebApplicationCacheEnabled([out, retval] BOOL *enabled);
}
......@@ -99,6 +99,8 @@
#define WebKitApplicationChromeModePreferenceKey "WebKitApplicationChromeMode" // default: false
#define WebKitOfflineWebApplicationCacheEnabledPreferenceKey "WebKitOfflineWebApplicationCacheEnabled" // default: false
// If this key is present and has a value of true, we have already removed the default values from the user's preferences <rdar://problem/5214504>
#define WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey "WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey"
......
......@@ -231,6 +231,8 @@ void WebPreferences::initializeDefaultSettings()
CFDictionaryAddValue(defaults, CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitApplicationChromeModePreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebKitOfflineWebApplicationCacheEnabledPreferenceKey), kCFBooleanFalse);
defaultSettings = defaults;
}
......@@ -1130,6 +1132,18 @@ HRESULT WebPreferences::setApplicationChromeMode(BOOL enabled)
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebPreferences::setOfflineWebApplicationCacheEnabled(BOOL enabled)
{
setBoolValue(CFSTR(WebKitOfflineWebApplicationCacheEnabledPreferenceKey), enabled);
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebPreferences::offlineWebApplicationCacheEnabled(BOOL* enabled)
{
*enabled = boolValueForKey(CFSTR(WebKitOfflineWebApplicationCacheEnabledPreferenceKey));
return S_OK;
}
void WebPreferences::willAddToWebView()
{
++m_numWebViews;
......
......@@ -296,6 +296,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE setApplicationChromeMode(
/* [in] */ BOOL enabled);
virtual HRESULT STDMETHODCALLTYPE setOfflineWebApplicationCacheEnabled(
/* [in] */ BOOL enabled);
virtual HRESULT STDMETHODCALLTYPE offlineWebApplicationCacheEnabled(
/* [retval][out] */ BOOL *enabled);
// WebPreferences
// This method accesses a different preference key than developerExtrasEnabled.
......
......@@ -4050,6 +4050,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setApplicationChromeMode(enabled);
hr = prefsPrivate->offlineWebApplicationCacheEnabled(&enabled);
if (FAILED(hr))
return hr;
settings->setOfflineWebApplicationCacheEnabled(enabled);
m_mainFrame->invalidate(); // FIXME
hr = updateSharedSettingsFromPreferencesIfNeeded(preferences.get());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment