本文整理汇总了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"));
}
示例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()));
}
示例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());
}
示例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();
}
示例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();
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
}
示例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);
}
示例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;
}