Add mechanism for asking LauncherApp to create a web view to ensure new view creation always happens in the main thread. Fixes assert failure when creating a new tab with debug builds.
git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@155 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
@@ -165,6 +165,12 @@ void LauncherApp::MessageReceived(BMessage* message)
|
|||||||
newWindow(url);
|
newWindow(url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CREATE_WEBVIEW: {
|
||||||
|
BMessage reply;
|
||||||
|
reply.AddPointer("view", new WebView("web_view"));
|
||||||
|
message->SendReply(&reply);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WINDOW_OPENED:
|
case WINDOW_OPENED:
|
||||||
m_windowCount++;
|
m_windowCount++;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ class BFile;
|
|||||||
class DownloadWindow;
|
class DownloadWindow;
|
||||||
class LauncherWindow;
|
class LauncherWindow;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CREATE_WEBVIEW = 'crwb'
|
||||||
|
};
|
||||||
|
|
||||||
class LauncherApp : public BApplication {
|
class LauncherApp : public BApplication {
|
||||||
public:
|
public:
|
||||||
LauncherApp();
|
LauncherApp();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "AuthenticationPanel.h"
|
#include "AuthenticationPanel.h"
|
||||||
#include "BrowsingHistory.h"
|
#include "BrowsingHistory.h"
|
||||||
|
#include "LauncherApp.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebTabView.h"
|
#include "WebTabView.h"
|
||||||
#include "WebView.h"
|
#include "WebView.h"
|
||||||
@@ -329,9 +330,14 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
case NEW_TAB:
|
case NEW_TAB:
|
||||||
{
|
{
|
||||||
m_tabView->AddTab(new WebView("web_view"));
|
BMessage reply;
|
||||||
|
be_app_messenger.SendMessage(CREATE_WEBVIEW, &reply);
|
||||||
|
WebView *view = NULL;
|
||||||
|
reply.FindPointer("view", reinterpret_cast<void **>(&view));
|
||||||
|
m_tabView->AddTab(view);
|
||||||
m_tabView->TabAt(m_tabView->CountTabs() - 1)->SetLabel("New Tab");
|
m_tabView->TabAt(m_tabView->CountTabs() - 1)->SetLabel("New Tab");
|
||||||
m_tabView->Select(m_tabView->CountTabs() - 1);
|
m_tabView->Select(m_tabView->CountTabs() - 1);
|
||||||
|
navigationCapabilitiesChanged(false, false, false, currentWebView());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,6 +356,11 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
|||||||
m_tabView->ViewForTab(index)));
|
m_tabView->ViewForTab(index)));
|
||||||
updateTitle(m_tabView->TabAt(index)->Label());
|
updateTitle(m_tabView->TabAt(index)->Label());
|
||||||
m_url->TextView()->SetText(currentWebView()->mainFrameURL());
|
m_url->TextView()->SetText(currentWebView()->mainFrameURL());
|
||||||
|
BWebPage *page = currentWebView()->webPage();
|
||||||
|
// bool canGoForward = page->CanGoInDirection(1);
|
||||||
|
// bool canGoBackward = page->CanGoInDirection(-1);
|
||||||
|
// navigationCapabilitiesChanged(canGoForward, canGoBackward, false,
|
||||||
|
// currentWebView());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user