diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 17:02:08 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 17:02:08 +0000 |
commit | 109607461c875c18217b2c3624a060945f11daea (patch) | |
tree | a13e520003dffb6079c762c20ebddd5a4d4b8640 | |
parent | 07958334a979f0049e4d2baf44da70a9a4f1aaff (diff) | |
download | chromium_src-109607461c875c18217b2c3624a060945f11daea.zip chromium_src-109607461c875c18217b2c3624a060945f11daea.tar.gz chromium_src-109607461c875c18217b2c3624a060945f11daea.tar.bz2 |
Enable DOM_STORAGE in our build. Put LocalStorage and SessionStorage behind their own flags. Add the beginnings of StorageNamespaceProxy since it implements WebCore::StorageNamespace::____StorageNamespace and we'd get link errors otherwise.
--enable-local-storage and --enable-session-storage are the new flags. If you enable them and try to use DOM Storage, Chromium will crash.
BUG=4360
TEST=none
Review URL: http://codereview.chromium.org/149792
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21059 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_delegate_helper.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 6 | ||||
-rw-r--r-- | webkit/api/src/StorageNamespaceProxy.cpp | 47 | ||||
-rw-r--r-- | webkit/api/src/StorageNamespaceProxy.h | 37 | ||||
-rw-r--r-- | webkit/glue/webpreferences.h | 4 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 2 | ||||
-rw-r--r-- | webkit/webkit.gyp | 13 |
9 files changed, 113 insertions, 10 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 ec00ba5..37923a6 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -176,6 +176,10 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( command_line.HasSwitch(switches::kEnableRemoteFonts); web_prefs.xss_auditor_enabled = command_line.HasSwitch(switches::kEnableXSSAuditor); + web_prefs.local_storage_enabled = + command_line.HasSwitch(switches::kEnableLocalStorage); + web_prefs.session_storage_enabled = + command_line.HasSwitch(switches::kEnableSessionStorage); } web_prefs.uses_universal_detector = diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index c3a7770..6528ae1 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -551,4 +551,10 @@ const wchar_t kEnableTabtastic2[] = L"enable-tabtastic2"; // enabled. const wchar_t kPinnedTabCount[] = L"pinned-tab-count"; +// Enable local storage. Still buggy. +const wchar_t kEnableLocalStorage[] = L"enable-local-storage"; + +// Enable session storage. Still buggy. +const wchar_t kEnableSessionStorage[] = L"enable-session-storage"; + } // namespace switches diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 135b148..3af9fb2 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -211,6 +211,10 @@ extern const wchar_t kEnableTabtastic2[]; extern const wchar_t kPinnedTabCount[]; +extern const wchar_t kEnableLocalStorage[]; + +extern const wchar_t kEnableSessionStorage[]; + } // namespace switches #endif // CHROME_COMMON_CHROME_SWITCHES_H_ diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 41b9466..f769aaf 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -1529,6 +1529,8 @@ struct ParamTraits<WebPreferences> { WriteParam(m, p.uses_page_cache); WriteParam(m, p.remote_fonts_enabled); WriteParam(m, p.xss_auditor_enabled); + WriteParam(m, p.local_storage_enabled); + WriteParam(m, p.session_storage_enabled); } static bool Read(const Message* m, void** iter, param_type* p) { return @@ -1559,7 +1561,9 @@ struct ParamTraits<WebPreferences> { ReadParam(m, iter, &p->user_style_sheet_location) && ReadParam(m, iter, &p->uses_page_cache) && ReadParam(m, iter, &p->remote_fonts_enabled) && - ReadParam(m, iter, &p->xss_auditor_enabled); + ReadParam(m, iter, &p->xss_auditor_enabled) && + ReadParam(m, iter, &p->local_storage_enabled) && + ReadParam(m, iter, &p->session_storage_enabled); } static void Log(const param_type& p, std::wstring* l) { l->append(L"<WebPreferences>"); diff --git a/webkit/api/src/StorageNamespaceProxy.cpp b/webkit/api/src/StorageNamespaceProxy.cpp new file mode 100644 index 0000000..8955c33 --- /dev/null +++ b/webkit/api/src/StorageNamespaceProxy.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "StorageNamespaceProxy.h" + +#if ENABLE(DOM_STORAGE) + +namespace WebCore { + +PassRefPtr<StorageNamespace> StorageNamespace::localStorageNamespace(const String& path) +{ + ASSERT_NOT_REACHED(); + return NULL; +} + +PassRefPtr<StorageNamespace> StorageNamespace::sessionStorageNamespace() +{ + ASSERT_NOT_REACHED(); + return NULL; +} + +} // namespace WebCore + +#endif // ENABLE(DOM_STORAGE) diff --git a/webkit/api/src/StorageNamespaceProxy.h b/webkit/api/src/StorageNamespaceProxy.h new file mode 100644 index 0000000..0b9058c --- /dev/null +++ b/webkit/api/src/StorageNamespaceProxy.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef StorageNamespaceProxy_h +#define StorageNamespaceProxy_h + +#if ENABLE(DOM_STORAGE) + +#include "StorageNamespace.h" + +// FIXME: Implement the StorageNamespaceProxy + +#endif // ENABLE(DOM_STORAGE) + +#endif // StorageNamespaceProxy_h diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index d75138a..dd0581e 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -42,6 +42,8 @@ struct WebPreferences { bool uses_page_cache; bool remote_fonts_enabled; bool xss_auditor_enabled; + bool local_storage_enabled; + bool session_storage_enabled; // TODO(tc): User style sheets will not work in chrome because it tries to // load the style sheet using a request without a frame. @@ -79,6 +81,8 @@ struct WebPreferences { uses_page_cache(false), remote_fonts_enabled(false), xss_auditor_enabled(false), + local_storage_enabled(false), + session_storage_enabled(false), user_style_sheet_enabled(false) { } }; diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 29152bd..53a5f22 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1424,6 +1424,8 @@ void WebViewImpl::SetPreferences(const WebPreferences& preferences) { settings->setUsesPageCache(preferences.uses_page_cache); settings->setDownloadableBinaryFontsEnabled(preferences.remote_fonts_enabled); settings->setXSSAuditorEnabled(preferences.xss_auditor_enabled); + settings->setLocalStorageEnabled(preferences.local_storage_enabled); + settings->setSessionStorageEnabled(preferences.session_storage_enabled); // This setting affects the behavior of links in an editable region: // clicking the link should select it rather than navigate to it. diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index 0ae547d..e49edcc 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -9,6 +9,7 @@ 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=1', 'ENABLE_DASHBOARD_SUPPORT=0', + 'ENABLE_DOM_STORAGE=1', 'ENABLE_JAVASCRIPT_DEBUGGER=0', 'ENABLE_JSC_MULTIPLE_THREADS=0', 'ENABLE_ICONDATABASE=0', @@ -594,9 +595,6 @@ # Exclude JSC custom bindings. ['exclude', '/third_party/WebKit/WebCore/bindings/js'], - # Don't build bindings for storage. - ['exclude', '/third_party/WebKit/WebCore/storage/Storage[^/]*\\.idl$'], - # SVG_FILTERS only. ['exclude', '/third_party/WebKit/WebCore/svg/SVG(FE|Filter)[^/]*\\.idl$'], @@ -619,9 +617,6 @@ ['exclude', '/third_party/WebKit/WebCore/svg/Filter[^/]*\\.cpp$'], ['exclude', '/third_party/WebKit/WebCore/svg/SVG(FE|Filter)[^/]*\\.cpp$'], - # Exclude some, but not all, of storage. - ['exclude', '/third_party/WebKit/WebCore/storage/(Local|Session)Storage[^/]*\\.cpp$'], - # Exclude PluginDebug.cpp since it doesn't compile properly without the # correct npapi.h inclusion (http://crbug.com/17127 ['exclude', '/third_party/WebKit/WebCore/plugins/PluginDebug.cpp'], @@ -671,9 +666,7 @@ # A few things can't be excluded by patterns. List them individually. - # Do not build StorageArea or StorageNamespace for Chromium. We (will) - # have our own implementation. - '../third_party/WebKit/WebCore/storage/StorageArea.cpp', + # Don't build StorageNamespace. We have our own implementation. '../third_party/WebKit/WebCore/storage/StorageNamespace.cpp', # Use history/BackForwardListChromium.cpp instead. @@ -1043,6 +1036,8 @@ 'api/src/LocalizedStrings.cpp', 'api/src/MediaPlayerPrivateChromium.cpp', 'api/src/ResourceHandle.cpp', + 'api/src/StorageNamespaceProxy.cpp', + 'api/src/StorageNamespaceProxy.h', 'api/src/TemporaryGlue.h', 'api/src/WebCache.cpp', 'api/src/WebCString.cpp', |