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


C++ WebString::utf8方法代码示例

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


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

示例1: show

// The output from all these methods matches what DumpRenderTree produces.
bool NotificationPresenter::show(const WebNotification& notification)
{
    WebString identifier = identifierForNotification(notification);
    if (!notification.replaceId().isEmpty()) {
        string replaceId(notification.replaceId().utf8());
        if (m_replacements.find(replaceId) != m_replacements.end())
            m_delegate->printMessage(string("REPLACING NOTIFICATION ") + m_replacements.find(replaceId)->second + "\n");

        m_replacements[replaceId] = identifier.utf8();
    }

    if (notification.isHTML())
        m_delegate->printMessage(string("DESKTOP NOTIFICATION: contents at ") + string(notification.url().spec()) + "\n");
    else {
        m_delegate->printMessage("DESKTOP NOTIFICATION:");
        m_delegate->printMessage(notification.direction() == WebTextDirectionRightToLeft ? "(RTL)" : "");
        m_delegate->printMessage(" icon ");
        m_delegate->printMessage(notification.iconURL().isEmpty() ? "" : notification.iconURL().spec().data());
        m_delegate->printMessage(", title ");
        m_delegate->printMessage(notification.title().isEmpty() ? "" : notification.title().utf8().data());
        m_delegate->printMessage(", text ");
        m_delegate->printMessage(notification.body().isEmpty() ? "" : notification.body().utf8().data());
        m_delegate->printMessage("\n");
    }

    string id(identifier.utf8());
    m_activeNotifications[id] = notification;

    Platform::current()->callOnMainThread(deferredDisplayDispatch, new WebNotification(notification));
    return true;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:32,代码来源:NotificationPresenter.cpp

示例2: mainResource

TEST_F(FrameThrottlingTest, DumpThrottledFrame) {
  webView().settings()->setJavaScriptEnabled(true);

  // Create a frame which is throttled.
  SimRequest mainResource("https://example.com/", "text/html");
  SimRequest frameResource("https://example.com/iframe.html", "text/html");

  loadURL("https://example.com/");
  mainResource.complete(
      "main <iframe id=frame sandbox=allow-scripts src=iframe.html></iframe>");
  frameResource.complete("");
  auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
  frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
  compositeFrame();
  EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());

  LocalFrame* localFrame = toLocalFrame(frameElement->contentFrame());
  localFrame->script().executeScriptInMainWorld(
      "document.body.innerHTML = 'throttled'");
  EXPECT_FALSE(compositor().needsBeginFrame());

  // The dumped contents should not include the throttled frame.
  DocumentLifecycle::AllowThrottlingScope throttlingScope(
      document().lifecycle());
  WebString result = WebFrameContentDumper::deprecatedDumpFrameTreeAsText(
      webView().mainFrameImpl(), 1024);
  EXPECT_NE(std::string::npos, result.utf8().find("main"));
  EXPECT_EQ(std::string::npos, result.utf8().find("throttled"));
}
开发者ID:mirror,项目名称:chromium,代码行数:29,代码来源:FrameThrottlingTest.cpp

示例3: cancel

void NotificationPresenter::cancel(const WebNotification& notification)
{
    WebString identifier = identifierForNotification(notification);
    m_delegate->printMessage(string("DESKTOP NOTIFICATION CLOSED: ") + string(identifier.utf8()) + "\n");
    WebNotification eventTarget(notification);
    eventTarget.dispatchCloseEvent(false);

    string id(identifier.utf8());
    m_activeNotifications.erase(id);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:10,代码来源:NotificationPresenter.cpp

示例4: registerMockedURLLoad

void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType)
{
    WebURLResponse response(fullURL);
    response.setMIMEType(mimeType);
    response.setHTTPStatusCode(200);

    // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName.
    std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
    filePath.append("/engine/web/tests/data/");
    filePath.append(std::string(relativeBaseDirectory.utf8().data()));
    filePath.append(std::string(fileName.utf8().data()));

    Platform::current()->unitTestSupport()->registerMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str()));
}
开发者ID:domenic,项目名称:mojo,代码行数:14,代码来源:URLTestHelpers.cpp

示例5: setStatusText

void WebViewHost::setStatusText(const WebString& text)
{
    if (!layoutTestController()->shouldDumpStatusCallbacks())
        return;
    // When running tests, write to stdout.
    printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text.utf8().data());
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: checkPermission

WebNotificationPresenter::Permission NotificationPresenter::checkPermission(const WebSecurityOrigin& origin)
{
    // Check with the layout test controller
    WebString originString = origin.toString();
    bool allowed = m_allowedOrigins.find(string(originString.utf8())) != m_allowedOrigins.end();
    return allowed ? WebNotificationPresenter::PermissionAllowed
        : WebNotificationPresenter::PermissionDenied;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:8,代码来源:NotificationPresenter.cpp

示例7: shouldApplyStyle

bool WebViewHost::shouldApplyStyle(const WebString& style, const WebRange& range)
{
    if (layoutTestController()->shouldDumpEditingCallbacks()) {
        printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:", style.utf8().data());
        printRangeDescription(range);
        fputs("\n", stdout);
    }
    return layoutTestController()->acceptsEditing();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: shouldInsertText

bool WebViewHost::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action)
{
    if (layoutTestController()->shouldDumpEditingCallbacks()) {
        printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:", text.utf8().data());
        printRangeDescription(range);
        printf(" givenAction:%s\n", editingActionDescription(action).c_str());
    }
    return layoutTestController()->acceptsEditing();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例9: cancel

void NotificationPresenter::cancel(const WebNotification& notification)
{
    WebString identifier = identifierForNotification(notification);
    printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data());
    WebNotification eventTarget(notification);
    eventTarget.dispatchCloseEvent(false);

    WTF::String id(identifier.data(), identifier.length());
    m_activeNotifications.remove(id);
}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:10,代码来源:NotificationPresenter.cpp

示例10: simulateClick

bool NotificationPresenter::simulateClick(const WebString& title)
{
    string id(title.utf8());
    if (m_activeNotifications.find(id) == m_activeNotifications.end())
        return false;

    const WebNotification& notification = m_activeNotifications.find(id)->second;
    WebNotification eventTarget(notification);
    eventTarget.dispatchClickEvent();
    return true;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:11,代码来源:NotificationPresenter.cpp

示例11: dumpFilenameBeingDragged

void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*)
{
    WebString filename;
    WebVector<WebDragData::Item> items = currentDragData.items();
    for (size_t i = 0; i < items.size(); ++i) {
        if (items[i].storageType == WebDragData::Item::StorageTypeBinaryData) {
            filename = items[i].title;
            break;
        }
    }
    printf("Filename being dragged: %s\n", filename.utf8().data());
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例12: counterValueForElementById

void LayoutTestController::counterValueForElementById(const CppArgumentList& arguments, CppVariant* result)
{
    result->setNull();
    if (arguments.size() < 1 || !arguments[0].isString())
        return;
    WebFrame* frame = m_shell->webView()->mainFrame();
    if (!frame)
        return;
    WebString counterValue = frame->counterValueForElementById(cppVariantToWebString(arguments[0]));
    if (counterValue.isNull())
        return;
    result->set(counterValue.utf8());
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:13,代码来源:LayoutTestController.cpp

示例13: addMockRecognitionResult

void MockWebSpeechInputController::addMockRecognitionResult(const WebString& result, double confidence, const WebString& language)
{
    WebSpeechInputResult res;
    res.assign(result, confidence);

    if (language.isEmpty())
        m_resultsForEmptyLanguage.push_back(res);
    else {
        string langString = language.utf8();
        if (m_recognitionResults.find(langString) == m_recognitionResults.end())
            m_recognitionResults[langString] = vector<WebSpeechInputResult>();
        m_recognitionResults[langString].push_back(res);
    }
}
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:14,代码来源:MockWebSpeechInputController.cpp

示例14: didReceiveTitle

void WebViewHost::didReceiveTitle(WebFrame* frame, const WebString& title)
{
    WebCString title8 = title.utf8();

    if (m_shell->shouldDumpFrameLoadCallbacks()) {
        printFrameDescription(frame);
        printf(" - didReceiveTitle: %s\n", title8.data());
    }

    if (layoutTestController()->shouldDumpTitleChanges())
        printf("TITLE CHANGED: %s\n", title8.data());

    setPageTitle(title);
}
开发者ID:mcgrawp,项目名称:webkit-webcl,代码行数:14,代码来源:WebViewHost.cpp

示例15: startRecognition

bool MockWebSpeechInputController::startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin)
{
    if (m_speechTask)
        return false;

    m_requestId = requestId;
    m_requestRect = elementRect;
    m_recording = true;
    m_language = language.utf8();

    m_speechTask = new SpeechTask(this);
    m_delegate->postTask(m_speechTask);

    return true;
}
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:15,代码来源:MockWebSpeechInputController.cpp


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