Пример #1
0
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
}
WebView* createPlatformWebView(void)
{
    WebView* webView = WebView::createInstance();
    SDL_Rect rect = { 0, 0, 800, 600 };
    s_screen = createSDLWindow(rect.w, rect.h);
    webView->setViewWindow(s_screen);
    webView->initWithFrame(rect, NULL, NULL);
    s_webView = webView;
    return webView;
}
Пример #3
0
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& features)
{
#if PLATFORM(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) {
            IntRect clientRect(0, 0, newowbwindow->webViewWidth, newowbwindow->webViewHeight);
            newWebView->initWithFrame(clientRect, "", "");
            newWebView->setViewWindow(newowbwindow);

            return core(newWebView);
        }
        delete newWebView;
    }

    return 0;
#else
    if (features.dialog) {
        /*COMPtr<IWebUIDelegate3> delegate = uiDelegate3();
        if (!delegate)
            return 0;
        COMPtr<IWebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest()));
        COMPtr<IWebView> dialog;
        if (FAILED(delegate->createModalDialog(m_webView, request.get(), &dialog)))
            return 0;
        return core(dialog.get());*/
        return 0;
    }

    Page* page = 0;
    //IWebUIDelegate* uiDelegate = 0;
    WebMutableURLRequest* request = WebMutableURLRequest::createInstance(frameLoadRequest.resourceRequest());

    /*if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) {
        IWebView* webView = 0;
        if (SUCCEEDED(uiDelegate->createWebViewWithRequest(m_webView, request, &webView))) {
            page = core(webView);
            webView->Release();
        }
    
        uiDelegate->Release();
    }*/
    delete request;

    return page;
#endif
}
Пример #4
0
Frame* WebFrameLoaderClient::dispatchCreatePage()
{
#if PLATFORM(AMIGAOS4)
    extern BalWidget *createAmigaWindow(WebView *);
    extern void closeAmigaWindow(BalWidget *);

    WebView* newWebView = WebView::createInstance();
    if (newWebView) {
        BalWidget *newowbwindow = createAmigaWindow(newWebView);
        if (newowbwindow) {
            IntRect clientRect(0, 0, amigaConfig.width, amigaConfig.height);
            newWebView->initWithFrame(clientRect, "", "");
            newWebView->setViewWindow(newowbwindow);

            WebFrame *mainFrame = newWebView->mainFrame();
            if (mainFrame && mainFrame->impl())
                return mainFrame->impl();

            closeAmigaWindow(newowbwindow);
        }
        delete newWebView;
    }

    return 0;
#else
    /*WebView* webView = m_webFrame->webView();

    COMPtr<IWebUIDelegate> ui;
    if (FAILED(webView->uiDelegate(&ui)))
        return 0;

    COMPtr<IWebView> newWebView;
    if (FAILED(ui->createWebViewWithRequest(webView, 0, &newWebView)))
        return 0;

    COMPtr<IWebFrame> mainFrame;
    if (FAILED(newWebView->mainFrame(&mainFrame)))
        return 0;

    COMPtr<WebFrame> mainFrameImpl(Query, mainFrame);
    return core(mainFrameImpl.get());*/
    return 0;
#endif
}