* Added a class CookieJarClient to WebCore's CookieJar.h which provides the
same functionality as the global methods for managing cookies. This is only enabled for the Haiku platform. Since the global cookie methods get a Document pointer, I envision, the CookieJarClient could eventually be a member of Document instances. It would then be passed upon WebCore::Page creation. Still waiting on feedback from other WebKit developers on this one. This change is more elegant than what the Qt port does, which is to use WebKit classes in WebCore (layering violation). Right now, a single global instance of a CookieJarClient can be assigned. * Implemented CookieJarClientHaiku which uses a BNetworkCookieJar to forward the requests. Eventually, the behaviour could be browser specific. * Added all the necessary wiring to BrowserApplication to make the cookie jar persistent. * TODO: Actually parse cookies and handle at least the expiration date, but other stuff like matching the domain of the cookie and the URL and "HTTP-only" cookies seems important as well. Even though I have confirmed that cookies are stored and restored correctly, and also retrieved via the global cookie methods, I can see no change in browser behaviour. For example enabling "Stay signed in" on googlemail.com does not work in WebPositive, although BeZillaBrowser automatically logs in in a new session when surfing to googlemail.com. No idea if this is even implemented with cookies, although it seems like it should be. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@303 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
committed by
Alexandre Deckner
parent
6faa5c3d74
commit
7239ea752d
@@ -34,6 +34,7 @@
|
||||
#include "DownloadWindow.h"
|
||||
#include "SettingsMessage.h"
|
||||
#include "SettingsWindow.h"
|
||||
#include "NetworkCookieJar.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebSettings.h"
|
||||
#include "WebView.h"
|
||||
@@ -61,6 +62,7 @@ BrowserApp::BrowserApp()
|
||||
fLaunchRefsMessage(0),
|
||||
fInitialized(false),
|
||||
fSettings(NULL),
|
||||
fCookieJar(NULL),
|
||||
fDownloadWindow(NULL),
|
||||
fSettingsWindow(NULL)
|
||||
{
|
||||
@@ -72,6 +74,8 @@ BrowserApp::~BrowserApp()
|
||||
{
|
||||
delete fLaunchRefsMessage;
|
||||
delete fSettings;
|
||||
delete fCookies;
|
||||
delete fCookieJar;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +129,14 @@ BrowserApp::ReadyToRun()
|
||||
mainSettingsPath << "/Application";
|
||||
fSettings = new SettingsMessage(B_USER_SETTINGS_DIRECTORY,
|
||||
mainSettingsPath.String());
|
||||
mainSettingsPath = kApplicationName;
|
||||
mainSettingsPath << "/Cookies";
|
||||
fCookies = new SettingsMessage(B_USER_SETTINGS_DIRECTORY,
|
||||
mainSettingsPath.String());
|
||||
BMessage cookieArchive;
|
||||
cookieArchive = fCookies->GetValue("cookies", cookieArchive);
|
||||
fCookieJar = new BNetworkCookieJar(cookieArchive);
|
||||
BWebPage::SetCookieJar(fCookieJar);
|
||||
|
||||
fLastWindowFrame = fSettings->GetValue("window frame", fLastWindowFrame);
|
||||
BRect downloadWindowFrame = fSettings->GetValue("downloads window frame",
|
||||
@@ -261,6 +273,10 @@ BrowserApp::QuitRequested()
|
||||
fSettingsWindow->Unlock();
|
||||
}
|
||||
|
||||
BMessage cookieArchive;
|
||||
if (fCookieJar->Archive(&cookieArchive) == B_OK)
|
||||
fCookies->SetValue("cookies", cookieArchive);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Catalog.h>
|
||||
#include <Rect.h>
|
||||
|
||||
class BNetworkCookieJar;
|
||||
class DownloadWindow;
|
||||
class BrowserWindow;
|
||||
class SettingsMessage;
|
||||
@@ -66,6 +67,8 @@ private:
|
||||
bool fInitialized;
|
||||
|
||||
SettingsMessage* fSettings;
|
||||
SettingsMessage* fCookies;
|
||||
BNetworkCookieJar* fCookieJar;
|
||||
|
||||
DownloadWindow* fDownloadWindow;
|
||||
SettingsWindow* fSettingsWindow;
|
||||
|
||||
@@ -197,10 +197,11 @@ private:
|
||||
|
||||
BrowserWindow::BrowserWindow(BRect frame, const BMessenger& downloadListener,
|
||||
ToolbarPolicy toolbarPolicy)
|
||||
: BWebWindow(frame, kApplicationName,
|
||||
:
|
||||
BWebWindow(frame, kApplicationName,
|
||||
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS)
|
||||
, fDownloadListener(downloadListener)
|
||||
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS),
|
||||
fDownloadListener(downloadListener)
|
||||
{
|
||||
BMessage* newTabMessage = new BMessage(NEW_TAB);
|
||||
newTabMessage->AddString("url", "");
|
||||
@@ -346,11 +347,8 @@ BrowserWindow::BrowserWindow(BRect frame, const BMessenger& downloadListener,
|
||||
fStatusText = 0;
|
||||
fLoadingProgressBar = 0;
|
||||
|
||||
BWebView* webView = new BWebView("web_view");
|
||||
SetCurrentWebView(webView);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
|
||||
.Add(CurrentWebView())
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(fTabManager->ContainerView())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -186,11 +186,11 @@ SettingsMessage::SetValue(const char* name, const entry_ref& value)
|
||||
|
||||
|
||||
status_t
|
||||
SettingsMessage::SetValue(const char* name, const BMessage* value)
|
||||
SettingsMessage::SetValue(const char* name, const BMessage& value)
|
||||
{
|
||||
if (ReplaceMessage(name, value) == B_OK)
|
||||
if (ReplaceMessage(name, &value) == B_OK)
|
||||
return B_OK;
|
||||
return AddMessage(name, value);
|
||||
return AddMessage(name, &value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
status_t SetValue(const char* name, const BRect& value);
|
||||
status_t SetValue(const char* name, const entry_ref& value);
|
||||
status_t SetValue(const char* name,
|
||||
const BMessage* value);
|
||||
const BMessage& value);
|
||||
status_t SetValue(const char* name,
|
||||
const BFlattenable* value);
|
||||
status_t SetValue(const char* name,
|
||||
|
||||
Reference in New Issue
Block a user