当前位置: 首页>>代码示例>>C++>>正文


C++ WebView::mainFrame方法代码示例

本文整理汇总了C++中WebView::mainFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ WebView::mainFrame方法的具体用法?C++ WebView::mainFrame怎么用?C++ WebView::mainFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebView的用法示例。


在下文中一共展示了WebView::mainFrame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: searchableFormData

TEST_F(WebSearchableFormDataTest, SearchString)
{
    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "search_form.html");
    WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_form.html");

    WebVector<WebFormElement> forms;
    webView->mainFrame()->document().forms(forms);

    EXPECT_EQ(forms.size(), 1U);

    WebSearchableFormData searchableFormData(forms[0]);
    EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search", searchableFormData.url().string());
}
开发者ID:Igalia,项目名称:blink,代码行数:13,代码来源:WebSearchableFormDataTest.cpp

示例2: ASSERT

TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused)
{
    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf"));

    TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
    FrameTestHelpers::WebViewHelper webViewHelper;
    WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, &pluginWebFrameClient);
    ASSERT(webView);
    webView->updateAllLifecyclePhases();

    WebDocument document = webView->mainFrame()->document();
    EXPECT_TRUE(document.isPluginDocument());
    WebPluginContainer* pluginContainer = getWebPluginContainer(webView, "plugin");
    EXPECT_EQ(document.focusedElement(), pluginContainer->element());
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:15,代码来源:WebPluginContainerTest.cpp

示例3: runIFrameTest

void TouchActionTest::runIFrameTest(std::string file) {
  TouchActionTrackingWebViewClient client;

  WebView* webView = setupTest(file, client);
  WebFrame* curFrame = webView->mainFrame()->firstChild();
  ASSERT_TRUE(curFrame);

  for (; curFrame; curFrame = curFrame->nextSibling()) {
    // Oilpan: see runTouchActionTest() comment why these are persistent
    // references.
    Persistent<Document> contentDoc =
        static_cast<Document*>(curFrame->document());
    runTestOnTree(contentDoc.get(), webView, client);
  }

  // Explicitly reset to break dependency on locally scoped client.
  m_webViewHelper.reset();
}
开发者ID:mirror,项目名称:chromium,代码行数:18,代码来源:TouchActionTest.cpp

示例4: dispatchCreatePage

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
}
开发者ID:acss,项目名称:owb-mirror,代码行数:44,代码来源:WebFrameLoaderClient.cpp

示例5: openFromWorker

void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir)
{
#if ENABLE(WORKERS)
    WebSecurityOrigin origin(prpOrigin);
    if (!allowIDBFromWorkerThread(context, name, origin)) {
        callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database."));
        return;
    }
    WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy();
    WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
    WebView* webView = webWorker->view();
    if (!webView) {
        // Frame is closed, worker is terminaring.
        return;
    }
    WebFrame* webFrame = webView->mainFrame();
    m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir);
#endif
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例6: setupTest

WebView* TouchActionTest::setupTest(std::string file,
                                    TouchActionTrackingWebViewClient& client) {
  URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL),
                                               WebString::fromUTF8(file));
  // Note that JavaScript must be enabled for shadow DOM tests.
  WebView* webView =
      m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, &client);

  // Set size to enable hit testing, and avoid line wrapping for consistency
  // with browser.
  webView->resize(WebSize(800, 1200));

  // Scroll to verify the code properly transforms windows to client co-ords.
  const int kScrollOffset = 100;
  Document* document = static_cast<Document*>(webView->mainFrame()->document());
  document->frame()->view()->layoutViewportScrollableArea()->setScrollOffset(
      ScrollOffset(0, kScrollOffset), ProgrammaticScroll);

  return webView;
}
开发者ID:mirror,项目名称:chromium,代码行数:20,代码来源:TouchActionTest.cpp

示例7: runTouchActionTest

void TouchActionTest::runTouchActionTest(std::string file) {
  TouchActionTrackingWebViewClient client;

  // runTouchActionTest() loads a document in a frame, setting up a
  // nested message loop. Should any Oilpan GC happen while it is in
  // effect, the implicit assumption that we're outside any event
  // loop (=> there being no pointers on the stack needing scanning)
  // when that GC strikes will no longer hold.
  //
  // To ensure that the references on the stack are also traced, we
  // turn them into persistent, stack allocated references. This
  // workaround is sufficient to handle this artificial test
  // scenario.
  WebView* webView = setupTest(file, client);

  Persistent<Document> document =
      static_cast<Document*>(webView->mainFrame()->document());
  runTestOnTree(document.get(), webView, client);

  // Explicitly reset to break dependency on locally scoped client.
  m_webViewHelper.reset();
}
开发者ID:mirror,项目名称:chromium,代码行数:22,代码来源:TouchActionTest.cpp


注:本文中的WebView::mainFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。