* Made BWebPage download related methods and listener member static.
* Introduced BWebPage::RequestDownload() public API (expected to run synchronous). * Added necessary wiring for "Download this link" in context menus. * Restarting downloads works in principle, although with some quirks. (Sometimes it appears the "Desktop" is being downloaded...) git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@310 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
committed by
Alexandre Deckner
parent
dcad381777
commit
88e373028c
@@ -148,6 +148,8 @@ BrowserApp::ReadyToRun()
|
|||||||
fDownloadWindow = new DownloadWindow(downloadWindowFrame, showDownloads);
|
fDownloadWindow = new DownloadWindow(downloadWindowFrame, showDownloads);
|
||||||
fSettingsWindow = new SettingsWindow(settingsWindowFrame, fSettings);
|
fSettingsWindow = new SettingsWindow(settingsWindowFrame, fSettings);
|
||||||
|
|
||||||
|
BWebPage::SetDownloadListener(BMessenger(fDownloadWindow));
|
||||||
|
|
||||||
fInitialized = true;
|
fInitialized = true;
|
||||||
|
|
||||||
if (fLaunchRefsMessage) {
|
if (fLaunchRefsMessage) {
|
||||||
@@ -155,8 +157,7 @@ BrowserApp::ReadyToRun()
|
|||||||
delete fLaunchRefsMessage;
|
delete fLaunchRefsMessage;
|
||||||
fLaunchRefsMessage = 0;
|
fLaunchRefsMessage = 0;
|
||||||
} else {
|
} else {
|
||||||
BrowserWindow* window = new BrowserWindow(fLastWindowFrame,
|
BrowserWindow* window = new BrowserWindow(fLastWindowFrame);
|
||||||
BMessenger(fDownloadWindow));
|
|
||||||
window->Show();
|
window->Show();
|
||||||
}
|
}
|
||||||
PostMessage(PRELOAD_BROWSING_HISTORY);
|
PostMessage(PRELOAD_BROWSING_HISTORY);
|
||||||
@@ -313,8 +314,7 @@ BrowserApp::_CreateNewWindow(const BString& url)
|
|||||||
if (!BScreen().Frame().Contains(fLastWindowFrame))
|
if (!BScreen().Frame().Contains(fLastWindowFrame))
|
||||||
fLastWindowFrame.OffsetTo(50, 50);
|
fLastWindowFrame.OffsetTo(50, 50);
|
||||||
|
|
||||||
BrowserWindow* window = new BrowserWindow(fLastWindowFrame,
|
BrowserWindow* window = new BrowserWindow(fLastWindowFrame);
|
||||||
BMessenger(fDownloadWindow));
|
|
||||||
window->Show();
|
window->Show();
|
||||||
if (url.Length())
|
if (url.Length())
|
||||||
window->CurrentWebView()->LoadURL(url.String());
|
window->CurrentWebView()->LoadURL(url.String());
|
||||||
|
|||||||
@@ -195,13 +195,11 @@ private:
|
|||||||
// #pragma mark - BrowserWindow
|
// #pragma mark - BrowserWindow
|
||||||
|
|
||||||
|
|
||||||
BrowserWindow::BrowserWindow(BRect frame, const BMessenger& downloadListener,
|
BrowserWindow::BrowserWindow(BRect frame, ToolbarPolicy toolbarPolicy)
|
||||||
ToolbarPolicy toolbarPolicy)
|
|
||||||
:
|
:
|
||||||
BWebWindow(frame, kApplicationName,
|
BWebWindow(frame, kApplicationName,
|
||||||
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS),
|
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS)
|
||||||
fDownloadListener(downloadListener)
|
|
||||||
{
|
{
|
||||||
BMessage* newTabMessage = new BMessage(NEW_TAB);
|
BMessage* newTabMessage = new BMessage(NEW_TAB);
|
||||||
newTabMessage->AddString("url", "");
|
newTabMessage->AddString("url", "");
|
||||||
@@ -629,7 +627,6 @@ BrowserWindow::CreateNewTab(const BString& url, bool select, BWebView* webView)
|
|||||||
// Executed in app thread (new BWebPage needs to be created in app thread).
|
// Executed in app thread (new BWebPage needs to be created in app thread).
|
||||||
if (!webView)
|
if (!webView)
|
||||||
webView = new BWebView("web view");
|
webView = new BWebView("web view");
|
||||||
webView->WebPage()->SetDownloadListener(fDownloadListener);
|
|
||||||
|
|
||||||
fTabManager->AddTab(webView, "New tab");
|
fTabManager->AddTab(webView, "New tab");
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ enum {
|
|||||||
class BrowserWindow : public BWebWindow {
|
class BrowserWindow : public BWebWindow {
|
||||||
public:
|
public:
|
||||||
BrowserWindow(BRect frame,
|
BrowserWindow(BRect frame,
|
||||||
const BMessenger& downloadListener,
|
|
||||||
ToolbarPolicy = HaveToolbar);
|
ToolbarPolicy = HaveToolbar);
|
||||||
virtual ~BrowserWindow();
|
virtual ~BrowserWindow();
|
||||||
|
|
||||||
@@ -121,7 +120,6 @@ private:
|
|||||||
void _ShutdownTab(int32 index);
|
void _ShutdownTab(int32 index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMessenger fDownloadListener;
|
|
||||||
BMenu* fGoMenu;
|
BMenu* fGoMenu;
|
||||||
IconButton* fBackButton;
|
IconButton* fBackButton;
|
||||||
IconButton* fForwardButton;
|
IconButton* fForwardButton;
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESTART_DOWNLOAD:
|
case RESTART_DOWNLOAD:
|
||||||
// TODO:
|
BWebPage::RequestDownload(m_url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CANCEL_DOWNLOAD:
|
case CANCEL_DOWNLOAD:
|
||||||
|
|||||||
Reference in New Issue
Block a user