Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features)
{
#if OS(AMIGAOS4)
    if (features.dialog) {
        fprintf(stderr, "%s: features.dialog not implemented on AmigaOS4.\n", __PRETTY_FUNCTION__);
        return 0;
    }

    extern BalWidget *createAmigaWindow(WebView *);

    WebView* newWebView = WebView::createInstance();
    if (newWebView) {
        BalWidget *newowbwindow = createAmigaWindow(newWebView);
        if (newowbwindow) {
            BalRectangle clientRect = {0, 0, newowbwindow->webViewWidth, newowbwindow->webViewHeight};
            newWebView->initWithFrame(clientRect, frameLoadRequest.frameName().utf8().data(), "");
            newWebView->setViewWindow(newowbwindow);

            if (!amigaConfig.tabs
             && (features.xSet || features.ySet || features.widthSet || features.heightSet))
                IIntuition->ChangeWindowBox(newowbwindow->window,
                                            features.xSet ? features.x : newowbwindow->window->LeftEdge,
                                            features.ySet ? features.y : newowbwindow->window->TopEdge,
                                            features.widthSet ? features.width : newowbwindow->window->Width,
                                            features.heightSet ? features.height : newowbwindow->window->Height);

            printf("url = %s\n", frameLoadRequest.resourceRequest().url().prettyURL().utf8().data());
            newWebView->mainFrame()->loadURL(frameLoadRequest.resourceRequest().url().prettyURL().utf8().data());

            return core(newWebView);
        }
        delete newWebView;
    }

    return 0;
#else
    IntRect frameRect(m_webView->frameRect());
    IntRect r(features.xSet ? features.x : 0, 
              features.ySet ? features.y : 0, 
              features.widthSet ? features.width : frameRect.width(),
              features.heightSet ? features.height : frameRect.height());
    
    bool modal = false;
    if (features.dialog)
        modal = true;
        
    WebViewWindow* win = new WebViewWindow(modal, m_webView, r);
    win->loadUrl(frameLoadRequest.resourceRequest().url().string().utf8().data());
    WebView* view = win->webView();
    view->setMenubarVisible(features.menuBarVisible);
    view->setStatusbarVisible(features.statusBarVisible);
    view->setToolbarsVisible(features.toolBarVisible);
    view->setLocationbarVisible(features.locationBarVisible);
    WebFrame* webFrame = view->topLevelFrame();
    if (webFrame)
        webFrame->setAllowsScrolling(features.scrollbarsVisible);
    win->show();
    return core(view);
#endif
}
Example #2
0
void WebChromeClient::setScrollbarsVisible(bool b)
{
    WebFrame* webFrame = m_webView->topLevelFrame();
    if (webFrame)
        webFrame->setAllowsScrolling(b);
}