set eol-style to native on tons of files to head off future mixed-line-ending problems
[WebKit-https.git] / WebKit / win / WebDatabaseManager.cpp
index e3a31276f0404d27feba3e5b83ae5207100d7fdd..dd18d04b420baa29a46f850787354f0fee426729 100644 (file)
-/*\r
- * Copyright (C) 2007 Apple Inc. All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- *\r
- * 1.  Redistributions of source code must retain the above copyright\r
- *     notice, this list of conditions and the following disclaimer.\r
- * 2.  Redistributions in binary form must reproduce the above copyright\r
- *     notice, this list of conditions and the following disclaimer in the\r
- *     documentation and/or other materials provided with the distribution.\r
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of\r
- *     its contributors may be used to endorse or promote products derived\r
- *     from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY\r
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\r
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-#include "config.h"\r
-#include "WebDatabaseManager.h"\r
-#include "WebKitDLL.h"\r
-\r
-#include "CFDictionaryPropertyBag.h"\r
-#include "COMEnumVariant.h"\r
-#include "MarshallingHelpers.h"\r
-#include "WebNotificationCenter.h"\r
-#include "WebSecurityOrigin.h"\r
-\r
-#include <WebCore/BString.h>\r
-#include <WebCore/COMPtr.h>\r
-#include <WebCore/DatabaseTracker.h>\r
-#include <WebCore/FileSystem.h>\r
-#include <WebCore/SecurityOrigin.h>\r
-\r
-using namespace WebCore;\r
-\r
-static inline bool isEqual(LPCWSTR s1, LPCWSTR s2)\r
-{\r
-    return !wcscmp(s1, s2);\r
-}\r
-\r
-class DatabaseDetailsPropertyBag : public IPropertyBag, Noncopyable {\r
-public:\r
-    static DatabaseDetailsPropertyBag* createInstance(const DatabaseDetails&);\r
-\r
-    // IUnknown\r
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);\r
-    virtual ULONG STDMETHODCALLTYPE AddRef();\r
-    virtual ULONG STDMETHODCALLTYPE Release();\r
-\r
-    // IPropertyBag\r
-    virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);\r
-    virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT* pVar);\r
-private:\r
-    DatabaseDetailsPropertyBag(const DatabaseDetails& details) \r
-        : m_refCount(0)\r
-        , m_details(details) { }\r
-    ~DatabaseDetailsPropertyBag() { }\r
-\r
-    ULONG m_refCount;\r
-    DatabaseDetails m_details;\r
-};\r
-\r
-// DatabaseDetailsPropertyBag ------------------------------------------------------\r
-DatabaseDetailsPropertyBag* DatabaseDetailsPropertyBag::createInstance(const DatabaseDetails& details)\r
-{\r
-    DatabaseDetailsPropertyBag* instance = new DatabaseDetailsPropertyBag(details);\r
-    instance->AddRef();\r
-    return instance;\r
-}\r
-\r
-// IUnknown ------------------------------------------------------------------------\r
-ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::AddRef()\r
-{\r
-    return ++m_refCount;\r
-}\r
-\r
-ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Release()\r
-{\r
-    ULONG newRef = --m_refCount;\r
-    if (!newRef)\r
-        delete this;\r
-\r
-    return newRef;\r
-}\r
-\r
-HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::QueryInterface(REFIID riid, void** ppvObject)\r
-{\r
-    *ppvObject = 0;\r
-    if (IsEqualGUID(riid, IID_IUnknown))\r
-        *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);\r
-    else if (IsEqualGUID(riid, IID_IPropertyBag))\r
-        *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);\r
-    else\r
-        return E_NOINTERFACE;\r
-\r
-    AddRef();\r
-    return S_OK;\r
-}\r
-\r
-// IPropertyBag --------------------------------------------------------------------\r
-HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog*)\r
-{\r
-    if (!pszPropName || !pVar)\r
-        return E_POINTER;\r
-\r
-    VariantInit(pVar);\r
-\r
-    if (isEqual(pszPropName, WebDatabaseDisplayNameKey)) {\r
-        COMVariantSetter<String>::setVariant(pVar, m_details.displayName());\r
-        return S_OK;\r
-    } else if (isEqual(pszPropName, WebDatabaseExpectedSizeKey)) {\r
-        COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.expectedUsage());\r
-        return S_OK;\r
-    } else if (isEqual(pszPropName, WebDatabaseUsageKey)) {\r
-        COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.currentUsage());\r
-        return S_OK;\r
-    }\r
-\r
-    return E_INVALIDARG;\r
-}\r
-\r
-HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)\r
-{\r
-    if (!pszPropName || !pVar)\r
-        return E_POINTER;\r
-\r
-    return E_FAIL;\r
-}\r
-\r
-static COMPtr<WebDatabaseManager> s_sharedWebDatabaseManager;\r
-\r
-// WebDatabaseManager --------------------------------------------------------------\r
-WebDatabaseManager* WebDatabaseManager::createInstance()\r
-{\r
-    WebDatabaseManager* manager = new WebDatabaseManager();\r
-    manager->AddRef();\r
-    return manager;    \r
-}\r
-\r
-WebDatabaseManager::WebDatabaseManager()\r
-    : m_refCount(0)\r
-{\r
-    gClassCount++;\r
-}\r
-\r
-WebDatabaseManager::~WebDatabaseManager()\r
-{\r
-    gClassCount--;\r
-}\r
-\r
-// IUnknown ------------------------------------------------------------------------\r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::QueryInterface(REFIID riid, void** ppvObject)\r
-{\r
-    *ppvObject = 0;\r
-    if (IsEqualGUID(riid, IID_IUnknown))\r
-        *ppvObject = static_cast<WebDatabaseManager*>(this);\r
-    else if (IsEqualGUID(riid, IID_IWebDatabaseManager))\r
-        *ppvObject = static_cast<WebDatabaseManager*>(this);\r
-    else\r
-        return E_NOINTERFACE;\r
-\r
-    AddRef();\r
-    return S_OK;\r
-}\r
-\r
-ULONG STDMETHODCALLTYPE WebDatabaseManager::AddRef()\r
-{\r
-    return ++m_refCount;\r
-}\r
-\r
-ULONG STDMETHODCALLTYPE WebDatabaseManager::Release()\r
-{\r
-    ULONG newRef = --m_refCount;\r
-    if (!newRef)\r
-        delete this;\r
-\r
-    return newRef;\r
-}\r
-\r
-template<> struct COMVariantSetter<RefPtr<SecurityOrigin> > : COMIUnknownVariantSetter<WebSecurityOrigin, RefPtr<SecurityOrigin> > {};\r
-\r
-// IWebDatabaseManager -------------------------------------------------------------\r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::sharedWebDatabaseManager( \r
-    /* [retval][out] */ IWebDatabaseManager** result)\r
-{\r
-    if (!s_sharedWebDatabaseManager) {\r
-        s_sharedWebDatabaseManager.adoptRef(WebDatabaseManager::createInstance());\r
-        DatabaseTracker::tracker().setClient(s_sharedWebDatabaseManager.get());\r
-    }\r
-\r
-    return s_sharedWebDatabaseManager.copyRefTo(result);\r
-}\r
-\r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::origins( \r
-    /* [retval][out] */ IEnumVARIANT** result)\r
-{\r
-    if (!result)\r
-        return E_POINTER;\r
-\r
-    *result = 0;\r
-\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    Vector<RefPtr<SecurityOrigin> > origins;\r
-    DatabaseTracker::tracker().origins(origins);\r
-        COMPtr<COMEnumVariant<Vector<RefPtr<SecurityOrigin> > > > enumVariant(AdoptCOM, COMEnumVariant<Vector<RefPtr<SecurityOrigin> > >::adopt(origins));\r
-\r
-    *result = enumVariant.releaseRef();\r
-    return S_OK;\r
-}\r
-    \r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::databasesWithOrigin( \r
-    /* [in] */ IWebSecurityOrigin* origin,\r
-    /* [retval][out] */ IEnumVARIANT** result)\r
-{\r
-    if (!origin || !result)\r
-        return E_POINTER;\r
-\r
-    *result = 0;\r
-\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);\r
-    if (!webSecurityOrigin)\r
-        return E_FAIL;\r
-\r
-    Vector<String> databaseNames;\r
-    DatabaseTracker::tracker().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);\r
-\r
-    COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::adopt(databaseNames));\r
-\r
-    *result = enumVariant.releaseRef();\r
-    return S_OK;\r
-}\r
-\r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabaseWithOrigin( \r
-    /* [in] */ BSTR databaseName,\r
-    /* [in] */ IWebSecurityOrigin* origin,\r
-    /* [retval][out] */ IPropertyBag** result)\r
-{\r
-    if (!origin || !result)\r
-        return E_POINTER;\r
-\r
-    *result = 0;\r
-\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);\r
-    if (!webSecurityOrigin)\r
-        return E_FAIL;\r
-\r
-    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),\r
-        webSecurityOrigin->securityOrigin());\r
-\r
-    if (!details.isValid())\r
-        return E_INVALIDARG;\r
-\r
-    *result = DatabaseDetailsPropertyBag::createInstance(details);\r
-    return S_OK;\r
-}\r
-    \r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteAllDatabases()\r
-{\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    DatabaseTracker::tracker().deleteAllDatabases();\r
-\r
-    return S_OK;\r
-}\r
-   \r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabasesWithOrigin( \r
-    /* [in] */ IWebSecurityOrigin* origin)\r
-{\r
-    if (!origin)\r
-        return E_POINTER;\r
-\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);\r
-    if (!webSecurityOrigin)\r
-        return E_FAIL;\r
-\r
-    DatabaseTracker::tracker().deleteDatabasesWithOrigin(webSecurityOrigin->securityOrigin());\r
-\r
-    return S_OK;\r
-}\r
-    \r
-HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabaseWithOrigin( \r
-    /* [in] */ BSTR databaseName,\r
-    /* [in] */ IWebSecurityOrigin* origin)\r
-{\r
-    if (!origin)\r
-        return E_POINTER;\r
-\r
-    if (!databaseName)\r
-        return E_INVALIDARG;\r
-\r
-    if (this != s_sharedWebDatabaseManager)\r
-        return E_FAIL;\r
-\r
-    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);\r
-    if (!webSecurityOrigin)\r
-        return E_FAIL;\r
-\r
-    DatabaseTracker::tracker().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));\r
-\r
-    return S_OK;\r
-}\r
-\r
+/*
+ * Copyright (C) 2007 Apple 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "WebDatabaseManager.h"
+#include "WebKitDLL.h"
+
+#include "CFDictionaryPropertyBag.h"
+#include "COMEnumVariant.h"
+#include "MarshallingHelpers.h"
+#include "WebNotificationCenter.h"
+#include "WebSecurityOrigin.h"
+
+#include <WebCore/BString.h>
+#include <WebCore/COMPtr.h>
+#include <WebCore/DatabaseTracker.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/SecurityOrigin.h>
+
+using namespace WebCore;
+
+static inline bool isEqual(LPCWSTR s1, LPCWSTR s2)
+{
+    return !wcscmp(s1, s2);
+}
+
+class DatabaseDetailsPropertyBag : public IPropertyBag, Noncopyable {
+public:
+    static DatabaseDetailsPropertyBag* createInstance(const DatabaseDetails&);
+
+    // IUnknown
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
+
+    // IPropertyBag
+    virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
+    virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT* pVar);
+private:
+    DatabaseDetailsPropertyBag(const DatabaseDetails& details) 
+        : m_refCount(0)
+        , m_details(details) { }
+    ~DatabaseDetailsPropertyBag() { }
+
+    ULONG m_refCount;
+    DatabaseDetails m_details;
+};
+
+// DatabaseDetailsPropertyBag ------------------------------------------------------
+DatabaseDetailsPropertyBag* DatabaseDetailsPropertyBag::createInstance(const DatabaseDetails& details)
+{
+    DatabaseDetailsPropertyBag* instance = new DatabaseDetailsPropertyBag(details);
+    instance->AddRef();
+    return instance;
+}
+
+// IUnknown ------------------------------------------------------------------------
+ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::AddRef()
+{
+    return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Release()
+{
+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete this;
+
+    return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IUnknown))
+        *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);
+    else if (IsEqualGUID(riid, IID_IPropertyBag))
+        *ppvObject = static_cast<DatabaseDetailsPropertyBag*>(this);
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+// IPropertyBag --------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog*)
+{
+    if (!pszPropName || !pVar)
+        return E_POINTER;
+
+    VariantInit(pVar);
+
+    if (isEqual(pszPropName, WebDatabaseDisplayNameKey)) {
+        COMVariantSetter<String>::setVariant(pVar, m_details.displayName());
+        return S_OK;
+    } else if (isEqual(pszPropName, WebDatabaseExpectedSizeKey)) {
+        COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.expectedUsage());
+        return S_OK;
+    } else if (isEqual(pszPropName, WebDatabaseUsageKey)) {
+        COMVariantSetter<unsigned long long>::setVariant(pVar, m_details.currentUsage());
+        return S_OK;
+    }
+
+    return E_INVALIDARG;
+}
+
+HRESULT STDMETHODCALLTYPE DatabaseDetailsPropertyBag::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+    if (!pszPropName || !pVar)
+        return E_POINTER;
+
+    return E_FAIL;
+}
+
+static COMPtr<WebDatabaseManager> s_sharedWebDatabaseManager;
+
+// WebDatabaseManager --------------------------------------------------------------
+WebDatabaseManager* WebDatabaseManager::createInstance()
+{
+    WebDatabaseManager* manager = new WebDatabaseManager();
+    manager->AddRef();
+    return manager;    
+}
+
+WebDatabaseManager::WebDatabaseManager()
+    : m_refCount(0)
+{
+    gClassCount++;
+}
+
+WebDatabaseManager::~WebDatabaseManager()
+{
+    gClassCount--;
+}
+
+// IUnknown ------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IUnknown))
+        *ppvObject = static_cast<WebDatabaseManager*>(this);
+    else if (IsEqualGUID(riid, IID_IWebDatabaseManager))
+        *ppvObject = static_cast<WebDatabaseManager*>(this);
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE WebDatabaseManager::AddRef()
+{
+    return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE WebDatabaseManager::Release()
+{
+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete this;
+
+    return newRef;
+}
+
+template<> struct COMVariantSetter<RefPtr<SecurityOrigin> > : COMIUnknownVariantSetter<WebSecurityOrigin, RefPtr<SecurityOrigin> > {};
+
+// IWebDatabaseManager -------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::sharedWebDatabaseManager( 
+    /* [retval][out] */ IWebDatabaseManager** result)
+{
+    if (!s_sharedWebDatabaseManager) {
+        s_sharedWebDatabaseManager.adoptRef(WebDatabaseManager::createInstance());
+        DatabaseTracker::tracker().setClient(s_sharedWebDatabaseManager.get());
+    }
+
+    return s_sharedWebDatabaseManager.copyRefTo(result);
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::origins( 
+    /* [retval][out] */ IEnumVARIANT** result)
+{
+    if (!result)
+        return E_POINTER;
+
+    *result = 0;
+
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    Vector<RefPtr<SecurityOrigin> > origins;
+    DatabaseTracker::tracker().origins(origins);
+        COMPtr<COMEnumVariant<Vector<RefPtr<SecurityOrigin> > > > enumVariant(AdoptCOM, COMEnumVariant<Vector<RefPtr<SecurityOrigin> > >::adopt(origins));
+
+    *result = enumVariant.releaseRef();
+    return S_OK;
+}
+    
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::databasesWithOrigin( 
+    /* [in] */ IWebSecurityOrigin* origin,
+    /* [retval][out] */ IEnumVARIANT** result)
+{
+    if (!origin || !result)
+        return E_POINTER;
+
+    *result = 0;
+
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+    if (!webSecurityOrigin)
+        return E_FAIL;
+
+    Vector<String> databaseNames;
+    DatabaseTracker::tracker().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
+
+    COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::adopt(databaseNames));
+
+    *result = enumVariant.releaseRef();
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::detailsForDatabaseWithOrigin( 
+    /* [in] */ BSTR databaseName,
+    /* [in] */ IWebSecurityOrigin* origin,
+    /* [retval][out] */ IPropertyBag** result)
+{
+    if (!origin || !result)
+        return E_POINTER;
+
+    *result = 0;
+
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+    if (!webSecurityOrigin)
+        return E_FAIL;
+
+    DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
+        webSecurityOrigin->securityOrigin());
+
+    if (!details.isValid())
+        return E_INVALIDARG;
+
+    *result = DatabaseDetailsPropertyBag::createInstance(details);
+    return S_OK;
+}
+    
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteAllDatabases()
+{
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    DatabaseTracker::tracker().deleteAllDatabases();
+
+    return S_OK;
+}
+   
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabasesWithOrigin( 
+    /* [in] */ IWebSecurityOrigin* origin)
+{
+    if (!origin)
+        return E_POINTER;
+
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+    if (!webSecurityOrigin)
+        return E_FAIL;
+
+    DatabaseTracker::tracker().deleteDatabasesWithOrigin(webSecurityOrigin->securityOrigin());
+
+    return S_OK;
+}
+    
+HRESULT STDMETHODCALLTYPE WebDatabaseManager::deleteDatabaseWithOrigin( 
+    /* [in] */ BSTR databaseName,
+    /* [in] */ IWebSecurityOrigin* origin)
+{
+    if (!origin)
+        return E_POINTER;
+
+    if (!databaseName)
+        return E_INVALIDARG;
+
+    if (this != s_sharedWebDatabaseManager)
+        return E_FAIL;
+
+    COMPtr<WebSecurityOrigin> webSecurityOrigin(Query, origin);
+    if (!webSecurityOrigin)
+        return E_FAIL;
+
+    DatabaseTracker::tracker().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
+
+    return S_OK;
+}
+
 void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
 {
     static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyOriginNotification);
 void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
 {
     static BSTR databaseDidModifyOriginName = SysAllocString(WebDatabaseDidModifyOriginNotification);
@@ -349,16 +349,16 @@ void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const
 
     notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
 }
 
     notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
 }
-\r
-void WebKitSetWebDatabasesPathIfNecessary()\r
-{\r
-    static bool pathSet = false;\r
-    if (pathSet)\r
-        return;\r
-\r
-    WebCore::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");\r
-    WebCore::DatabaseTracker::tracker().setDatabasePath(databasesDirectory);\r
-\r
-    pathSet = true;\r
-}\r
-\r
+
+void WebKitSetWebDatabasesPathIfNecessary()
+{
+    static bool pathSet = false;
+    if (pathSet)
+        return;
+
+    WebCore::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
+    WebCore::DatabaseTracker::tracker().setDatabasePath(databasesDirectory);
+
+    pathSet = true;
+}
+