本文整理汇总了C++中WebString类的典型用法代码示例。如果您正苦于以下问题:C++ WebString类的具体用法?C++ WebString怎么用?C++ WebString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: populateCopyOfNotificationPermissions
void WebNotificationManagerProxy::populateCopyOfNotificationPermissions(HashMap<String, bool>& permissions)
{
RefPtr<ImmutableDictionary> knownPermissions = m_provider.notificationPermissions();
if (!knownPermissions)
return;
permissions.clear();
RefPtr<ImmutableArray> knownOrigins = knownPermissions->keys();
for (size_t i = 0; i < knownOrigins->size(); ++i) {
WebString* origin = knownOrigins->at<WebString>(i);
permissions.set(origin->string(), knownPermissions->get<WebBoolean>(origin->string())->value());
}
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:14,代码来源:WebNotificationManagerProxy.cpp
示例2: 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,代码来源:
示例3: generateBaseTagDeclaration
WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTarget)
{
if (baseTarget.isEmpty())
return String("<base href=\".\">");
String baseString = "<base href=\".\" target=\"" + static_cast<const String&>(baseTarget) + "\">";
return baseString;
}
开发者ID:coinpayee,项目名称:blink,代码行数:7,代码来源:WebPageSerializer.cpp
示例4: setHTTPReferrer
void WebURLRequest::setHTTPReferrer(const WebString& referrer, WebReferrerPolicy referrerPolicy)
{
if (referrer.isEmpty())
m_private->m_resourceRequest->clearHTTPReferrer();
else
m_private->m_resourceRequest->setHTTPReferrer(Referrer(referrer, static_cast<ReferrerPolicy>(referrerPolicy)));
}
开发者ID:coinpayee,项目名称:blink,代码行数:7,代码来源:WebURLRequest.cpp
示例5: printResourceDescription
void WebViewHost::didReceiveResponse(WebFrame*, unsigned identifier, const WebURLResponse& response)
{
if (m_shell->shouldDumpResourceLoadCallbacks()) {
printResourceDescription(identifier);
fputs(" - didReceiveResponse ", stdout);
printResponseDescription(response);
fputs("\n", stdout);
}
if (m_shell->shouldDumpResourceResponseMIMETypes()) {
GURL url = response.url();
WebString mimeType = response.mimeType();
printf("%s has MIME type %s\n",
url.ExtractFileName().c_str(),
// Simulate NSURLResponse's mapping of empty/unknown MIME types to application/octet-stream
mimeType.isEmpty() ? "application/octet-stream" : mimeType.utf8().data());
}
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例6: generateBaseTagDeclaration
WebString WebFrameSerializer::generateBaseTagDeclaration(const WebString& baseTarget)
{
// TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|.
if (baseTarget.isEmpty())
return String("<base href=\".\">");
String baseString = "<base href=\".\" target=\"" + static_cast<const String&>(baseTarget) + "\">";
return baseString;
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:8,代码来源:WebFrameSerializer.cpp
示例7: ASSERT
bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset, int* misspelledLength)
{
ASSERT(misspelledOffset);
ASSERT(misspelledLength);
// Initialize this spellchecker.
initializeIfNeeded();
// Reset the result values as our spellchecker does.
*misspelledOffset = 0;
*misspelledLength = 0;
// Convert to a String because we store String instances in
// m_misspelledWords and WebString has no find().
const String stringText(text.data(), text.length());
// Extract the first possible English word from the given string.
// The given string may include non-ASCII characters or numbers. So, we
// should filter out such characters before start looking up our
// misspelled-word table.
// (This is a simple version of our SpellCheckWordIterator class.)
// If the given string doesn't include any ASCII characters, we can treat the
// string as valid one.
// Unfortunately, This implementation splits a contraction, i.e. "isn't" is
// split into two pieces "isn" and "t". This is OK because webkit tests
// don't have misspelled contractions.
int wordOffset = stringText.find(isASCIIAlpha);
if (wordOffset == -1)
return true;
int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset);
int wordLength = wordEnd == -1 ? stringText.length() - wordOffset : wordEnd - wordOffset;
// Look up our misspelled-word table to check if the extracted word is a
// known misspelled word, and return the offset and the length of the
// extracted word if this word is a known misspelled word.
// (See the comment in MockSpellCheck::initializeIfNeeded() why we use a
// misspelled-word table.)
String word = stringText.substring(wordOffset, wordLength);
if (!m_misspelledWords.contains(word))
return true;
*misspelledOffset = wordOffset;
*misspelledLength = wordLength;
return false;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:45,代码来源:MockSpellCheck.cpp
示例8: toStringVector
static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
{
if (!patterns)
return 0;
size_t size = patterns->size();
if (!size)
return 0;
Vector<String>* patternsVector = new Vector<String>;
patternsVector->reserveInitialCapacity(size);
for (size_t i = 0; i < size; ++i) {
WebString* entry = patterns->at<WebString>(i);
if (entry)
patternsVector->uncheckedAppend(entry->string());
}
return patternsVector;
}
开发者ID:,项目名称:,代码行数:18,代码来源:
示例9: webkitCookieManagerGetDomainsWithCookiesCallback
static void webkitCookieManagerGetDomainsWithCookiesCallback(WKArrayRef wkDomains, WKErrorRef, void* context)
{
GRefPtr<GTask> task = adoptGRef(G_TASK(context));
if (g_task_return_error_if_cancelled(task.get()))
return;
ImmutableArray* domains = toImpl(wkDomains);
GPtrArray* returnValue = g_ptr_array_sized_new(domains->size());
for (size_t i = 0; i < domains->size(); ++i) {
WebString* domainString = static_cast<WebString*>(domains->at(i));
String domain = domainString->string();
if (domain.isEmpty())
continue;
g_ptr_array_add(returnValue, g_strdup(domain.utf8().data()));
}
g_ptr_array_add(returnValue, 0);
g_task_return_pointer(task.get(), g_ptr_array_free(returnValue, FALSE), reinterpret_cast<GDestroyNotify>(g_strfreev));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:18,代码来源:WebKitCookieManager.cpp
示例10: 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,代码来源:
示例11: 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,代码来源:
示例12: args
void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer)
{
OwnPtr<AutofillArgs> args(m_autofillArgs.release());
HTMLInputElement* inputElement = args->inputElement.get();
const String& value = inputElement->value();
// Enforce autofill_on_empty_value and caret_at_end.
bool isCaretAtEnd = true;
if (args->requireCaretAtEnd)
isCaretAtEnd = inputElement->selectionStart() == inputElement->selectionEnd()
&& inputElement->selectionEnd() == static_cast<int>(value.length());
if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) {
m_webView->hideAutoFillPopup();
return;
}
// First let's see if there is a password listener for that element.
// We won't trigger form autofill in that case, as having both behavior on
// a node would be confusing.
WebFrameImpl* webframe = WebFrameImpl::fromFrame(inputElement->document()->frame());
if (!webframe)
return;
WebPasswordAutocompleteListener* listener = webframe->getPasswordListener(inputElement);
if (listener) {
if (args->autofillFormOnly)
return;
listener->performInlineAutocomplete(value,
args->backspaceOrDeletePressed,
true);
return;
}
// Then trigger form autofill.
WebString name = WebInputElement(inputElement).nameForAutofill();
ASSERT(static_cast<int>(name.length()) > 0);
if (m_webView->client())
m_webView->client()->queryAutofillSuggestions(WebNode(inputElement),
name, WebString(value));
}
开发者ID:,项目名称:,代码行数:44,代码来源:
示例13: isSupportedObjectMIMEType
bool WebSettings::isSupportedObjectMIMEType(const WebString& mimeType)
{
if (mimeType.isEmpty())
return false;
if (!s_supportedObjectMIMETypes)
return false;
return s_supportedObjectMIMETypes->contains(MIMETypeRegistry::getNormalizedMIMEType(mimeType));
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例14: toStringVector
static Vector<String> toStringVector(ImmutableArray* patterns)
{
Vector<String> patternsVector;
if (!patterns)
return patternsVector;
size_t size = patterns->size();
if (!size)
return patternsVector;
patternsVector.reserveInitialCapacity(size);
for (size_t i = 0; i < size; ++i) {
WebString* entry = patterns->at<WebString>(i);
if (entry)
patternsVector.uncheckedAppend(entry->string());
}
return patternsVector;
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:19,代码来源:InjectedBundle.cpp
示例15: NPVARIANT_TO_OBJECT
void PlainTextController::plainText(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
if (arguments.size() < 1 || !arguments[0].isObject())
return;
// Check that passed-in object is, in fact, a range.
NPObject* npobject = NPVARIANT_TO_OBJECT(arguments[0]);
if (!npobject)
return;
WebRange range;
if (!WebBindings::getRange(npobject, &range))
return;
// Extract the text using the Range's text() method
WebString text = range.toPlainText();
result->set(text.utf8());
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例16: WebInputElement
bool EditorClientImpl::autofill(HTMLInputElement* inputElement,
bool autofillFormOnly,
bool autofillOnEmptyValue,
bool requireCaretAtEnd)
{
// Cancel any pending DoAutofill call.
m_autofillArgs.clear();
m_autofillTimer.stop();
// FIXME: Remove the extraneous isEnabledFormControl call below.
// Let's try to trigger autofill for that field, if applicable.
if (!inputElement->isEnabledFormControl() || !inputElement->isTextField()
|| inputElement->isPasswordField() || !inputElement->autoComplete()
|| !inputElement->isEnabledFormControl()
|| inputElement->isReadOnlyFormControl())
return false;
WebString name = WebInputElement(inputElement).nameForAutofill();
if (name.isEmpty()) // If the field has no name, then we won't have values.
return false;
// Don't attempt to autofill with values that are too large.
if (inputElement->value().length() > maximumTextSizeForAutofill)
return false;
m_autofillArgs = new AutofillArgs();
m_autofillArgs->inputElement = inputElement;
m_autofillArgs->autofillFormOnly = autofillFormOnly;
m_autofillArgs->autofillOnEmptyValue = autofillOnEmptyValue;
m_autofillArgs->requireCaretAtEnd = requireCaretAtEnd;
m_autofillArgs->backspaceOrDeletePressed = m_backspaceOrDeletePressed;
if (!requireCaretAtEnd)
doAutofill(0);
else {
// We post a task for doing the autofill as the caret position is not set
// properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976)
// and we need it to determine whether or not to trigger autofill.
m_autofillTimer.startOneShot(0.0);
}
return true;
}
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:42,代码来源:EditorClientImpl.cpp
示例17: 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
示例18: setAppCachePath
void WebSettings::setAppCachePath(const WebString& path)
{
// The directory of cacheStorage for one page group can only be initialized once.
static HashSet<WTF::String> initGroups;
if (path.isEmpty() || initGroups.contains(d->m_webCoreSettingsState->pageGroupName))
return;
initGroups.add(d->m_webCoreSettingsState->pageGroupName);
d->m_webCoreSettingsState->appCachePath = path;
WebCore::cacheStorage(d->m_webCoreSettingsState->pageGroupName).setCacheDirectory(d->m_webCoreSettingsState->appCachePath);
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:11,代码来源:WebSettings.cpp
示例19: fadeAnimation
WebAnimation WebAnimation::fadeAnimation(const WebString& name, float from, float to, double duration)
{
WebAnimation tmp;
tmp.d->name = String(name.impl());
tmp.d->animation = Animation::create();
tmp.d->animation->setDuration(duration);
tmp.d->keyframes = KeyframeValueList(AnimatedPropertyOpacity);
tmp.d->keyframes.insert(new FloatAnimationValue(0, from));
tmp.d->keyframes.insert(new FloatAnimationValue(1.0, to));
return tmp;
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例20: requestCheckingOfText
void SpellCheckClient::requestCheckingOfText(const WebString& text, WebTextCheckingCompletion* completion)
{
if (text.isEmpty()) {
if (completion)
completion->didCancelCheckingText();
return;
}
m_lastRequestedTextCheckingCompletion = completion;
m_lastRequestedTextCheckString = text;
m_delegate->postDelayedTask(new HostMethodTask(this, &SpellCheckClient::finishLastTextCheck), 0);
}
开发者ID:,项目名称:,代码行数:12,代码来源:
注:本文中的WebString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论