Reviewed by Kevin Ollivier.
authorkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Oct 2009 16:08:41 +0000 (16:08 +0000)
committerkevino@webkit.org <kevino@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Oct 2009 16:08:41 +0000 (16:08 +0000)
Add basic database support to wx API

https://bugs.webkit.org/show_bug.cgi?id=30445

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@49750 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/wx/ChangeLog
WebKit/wx/WebKitSupport/ChromeClientWx.cpp
WebKit/wx/WebView.cpp
WebKit/wx/WebView.h

index 51ac132..8ab1fb9 100644 (file)
@@ -2,6 +2,22 @@
 
         Reviewed by Kevin Ollivier.
 
+        Add basic database support to wx API
+        
+        https://bugs.webkit.org/show_bug.cgi?id=30445
+
+        * WebKitSupport/ChromeClientWx.cpp:
+        (WebCore::ChromeClientWx::exceededDatabaseQuota):
+        * WebView.cpp:
+        (wxWebView::Create):
+        (wxWebView::SetDatabaseDirectory):
+        (wxWebView::GetDatabaseDirectory):
+        * WebView.h:
+
+2009-10-16  Kevin Watters  <kevinwatters@gmail.com>
+
+        Reviewed by Kevin Ollivier.
+
         Optionally allow the user to zoom text using the mouse wheel.
         
         https://bugs.webkit.org/show_bug.cgi?id=30444
index 9b2f264..629463f 100644 (file)
 #include "config.h"
 #include "ChromeClientWx.h"
 #include "Console.h"
+#if ENABLE(DATABASE)
+#include "DatabaseTracker.h"
+#endif
 #include "FileChooser.h"
 #include "FloatRect.h"
+#include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "NotImplemented.h"
 #include "PlatformString.h"
@@ -381,7 +385,13 @@ void ChromeClientWx::print(Frame*)
 #if ENABLE(DATABASE)
 void ChromeClientWx::exceededDatabaseQuota(Frame*, const String&)
 {
-    notImplemented();
+    unsigned long long quota = 5 * 1024 * 1024;
+
+    if (wxWebFrame* webFrame = m_webView->GetMainFrame())
+        if (Frame* frame = webFrame->GetFrame())
+            if (Document* document = frame->document())
+                if (!DatabaseTracker::tracker().hasEntryForOrigin(document->securityOrigin()))
+                    DatabaseTracker::tracker().setQuota(document->securityOrigin(), quota);
 }
 #endif
 
index 6c7d181..615b66f 100644 (file)
 #include <runtime/JSValue.h>
 #include <runtime/UString.h>
 
+#if ENABLE(DATABASE)
+#include "DatabaseTracker.h"
+#endif
+
 #include "wx/wxprec.h"
 #ifndef WX_PRECOMP
     #include "wx/wx.h"
@@ -330,6 +334,10 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position,
     settings->setStandardFontFamily("Times New Roman");
     settings->setJavaScriptEnabled(true);
 
+#if ENABLE(DATABASE)
+    settings->setDatabasesEnabled(true);
+#endif
+
     m_isInitialized = true;
 
     return true;
@@ -898,3 +906,21 @@ bool wxWebView::ShouldClose() const
 
     return true;
 }
+
+/* static */
+void wxWebView::SetDatabaseDirectory(const wxString& databaseDirectory)
+{
+#if ENABLE(DATABASE)
+    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory);
+#endif
+}
+
+/* static */
+wxString wxWebView::GetDatabaseDirectory()
+{
+#if ENABLE(DATABASE)
+    return WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
+#else
+    return wxEmptyString;
+#endif
+}
index e44def9..01c23dd 100644 (file)
@@ -197,6 +197,9 @@ public:
     void SetMouseWheelZooms(bool mouseWheelZooms) { m_mouseWheelZooms = mouseWheelZooms; }
     bool GetMouseWheelZooms() const { return m_mouseWheelZooms; }
 
+    static void SetDatabaseDirectory(const wxString& databaseDirectory);
+    static wxString GetDatabaseDirectory();
+
 protected:
 
     // event handlers (these functions should _not_ be virtual)