Moved handling/display of "main site error" alert into client.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@481 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-05-04 12:02:24 +00:00 committed by Alexandre Deckner
parent 9adbaa4378
commit 9a6307059a
2 changed files with 62 additions and 33 deletions

View File

@ -1009,6 +1009,43 @@ BrowserWindow::LoadFinished(const BString& url, BWebView* view)
}
void
BrowserWindow::MainDocumentError(const BString& failingURL,
const BString& localizedDescription, BWebView* view)
{
// Make sure we show the page that contains the view.
if (!_ShowPage(view))
return;
BWebWindow::MainDocumentError(failingURL, localizedDescription, view);
// TODO: Remove the failing URL from the BrowsingHistory!
}
void
BrowserWindow::TitleChanged(const BString& title, BWebView* view)
{
for (int32 i = 0; i < fTabManager->CountTabs(); i++) {
if (fTabManager->ViewForTab(i) == view) {
fTabManager->SetTabLabel(i, title);
break;
}
}
if (view != CurrentWebView())
return;
_UpdateTitle(title);
}
void
BrowserWindow::IconReceived(const BBitmap* icon, BWebView* view)
{
_SetPageIcon(view, icon);
}
void
BrowserWindow::ResizeRequested(float width, float height, BWebView* view)
{
@ -1090,29 +1127,6 @@ BrowserWindow::SetResizable(bool flag, BWebView* view)
}
void
BrowserWindow::TitleChanged(const BString& title, BWebView* view)
{
for (int32 i = 0; i < fTabManager->CountTabs(); i++) {
if (fTabManager->ViewForTab(i) == view) {
fTabManager->SetTabLabel(i, title);
break;
}
}
if (view != CurrentWebView())
return;
_UpdateTitle(title);
}
void
BrowserWindow::IconReceived(const BBitmap* icon, BWebView* view)
{
_SetPageIcon(view, icon);
}
void
BrowserWindow::StatusChanged(const BString& statusText, BWebView* view)
{
@ -1174,16 +1188,9 @@ BrowserWindow::AuthenticationChallenge(BString message, BString& inOutUser,
}
}
// Switch to the page for which this authentication is required.
if (view != CurrentWebView()) {
int32 tabIndex = fTabManager->TabForView(view);
if (tabIndex < 0) {
// Page seems to be gone already?
return false;
}
fTabManager->SelectTab(tabIndex);
_TabChanged(tabIndex);
UpdateIfNeeded();
}
if (!_ShowPage(view))
return false;
AuthenticationPanel* panel = new AuthenticationPanel(Frame());
// Panel auto-destructs.
bool success = panel->getAuthentication(message, inOutUser, inOutPassword,
@ -1669,3 +1676,20 @@ BrowserWindow::_UpdateClipboardItems()
CurrentWebView()->WebPage()->SendEditingCapabilities();
}
}
bool
BrowserWindow::_ShowPage(BWebView* view)
{
if (view != CurrentWebView()) {
int32 tabIndex = fTabManager->TabForView(view);
if (tabIndex < 0) {
// Page seems to be gone already?
return false;
}
fTabManager->SelectTab(tabIndex);
_TabChanged(tabIndex);
UpdateIfNeeded();
}
return true;
}

View File

@ -113,6 +113,9 @@ private:
virtual void LoadFailed(const BString& url, BWebView* view);
virtual void LoadFinished(const BString& url,
BWebView* view);
virtual void MainDocumentError(const BString& failingURL,
const BString& localizedDescription,
BWebView* view);
virtual void TitleChanged(const BString& title,
BWebView* view);
virtual void IconReceived(const BBitmap* icon,
@ -159,6 +162,8 @@ private:
void _UpdateHistoryMenu();
void _UpdateClipboardItems();
bool _ShowPage(BWebView* view);
private:
BMenu* fHistoryMenu;
int32 fHistoryMenuFixedItemCount;