diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index 89bd3aeaeb..29fe7b6ccd 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -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; } diff --git a/src/apps/webpositive/BrowserApp.h b/src/apps/webpositive/BrowserApp.h index d4fb9fbf59..dfc9433e5e 100644 --- a/src/apps/webpositive/BrowserApp.h +++ b/src/apps/webpositive/BrowserApp.h @@ -33,6 +33,7 @@ #include #include +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; diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index a2ff746a89..4b0ef6b758 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -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()) ); } diff --git a/src/apps/webpositive/support/SettingsMessage.cpp b/src/apps/webpositive/support/SettingsMessage.cpp index 7c2edddfc5..98e9ef1c94 100644 --- a/src/apps/webpositive/support/SettingsMessage.cpp +++ b/src/apps/webpositive/support/SettingsMessage.cpp @@ -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); } diff --git a/src/apps/webpositive/support/SettingsMessage.h b/src/apps/webpositive/support/SettingsMessage.h index 85a29320b8..8420238be8 100644 --- a/src/apps/webpositive/support/SettingsMessage.h +++ b/src/apps/webpositive/support/SettingsMessage.h @@ -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,