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:
parent
d311e279f5
commit
75845de732
@ -165,6 +165,12 @@ void LauncherApp::MessageReceived(BMessage* message)
|
||||
newWindow(url);
|
||||
break;
|
||||
}
|
||||
case CREATE_WEBVIEW: {
|
||||
BMessage reply;
|
||||
reply.AddPointer("view", new WebView("web_view"));
|
||||
message->SendReply(&reply);
|
||||
break;
|
||||
}
|
||||
case WINDOW_OPENED:
|
||||
m_windowCount++;
|
||||
break;
|
||||
|
@ -36,6 +36,10 @@ class BFile;
|
||||
class DownloadWindow;
|
||||
class LauncherWindow;
|
||||
|
||||
enum {
|
||||
CREATE_WEBVIEW = 'crwb'
|
||||
};
|
||||
|
||||
class LauncherApp : public BApplication {
|
||||
public:
|
||||
LauncherApp();
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "AuthenticationPanel.h"
|
||||
#include "BrowsingHistory.h"
|
||||
#include "LauncherApp.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebTabView.h"
|
||||
#include "WebView.h"
|
||||
@ -329,9 +330,14 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
||||
|
||||
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->Select(m_tabView->CountTabs() - 1);
|
||||
navigationCapabilitiesChanged(false, false, false, currentWebView());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -350,6 +356,11 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
||||
m_tabView->ViewForTab(index)));
|
||||
updateTitle(m_tabView->TabAt(index)->Label());
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user