本文整理汇总了C++中SecurityOrigin::isUnique方法的典型用法代码示例。如果您正苦于以下问题:C++ SecurityOrigin::isUnique方法的具体用法?C++ SecurityOrigin::isUnique怎么用?C++ SecurityOrigin::isUnique使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityOrigin
的用法示例。
在下文中一共展示了SecurityOrigin::isUnique方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addOriginAccessWhitelistEntry
void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
{
ASSERT(isMainThread());
ASSERT(!sourceOrigin.isUnique());
if (sourceOrigin.isUnique())
return;
String sourceString = sourceOrigin.toString();
pair<OriginAccessMap::iterator, bool> result = originAccessMap().add(sourceString, nullptr);
if (result.second)
result.first->second = adoptPtr(new OriginAccessWhiteList);
OriginAccessWhiteList* list = result.first->second.get();
list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
}
示例2: addOriginAccessWhitelistEntry
void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
{
ASSERT(isMainThread());
ASSERT(!sourceOrigin.isUnique());
if (sourceOrigin.isUnique())
return;
String sourceString = sourceOrigin.toString();
OriginAccessMap::AddResult result = originAccessMap().add(sourceString, nullptr);
if (result.isNewEntry)
result.iterator->value = std::make_unique<OriginAccessWhiteList>();
OriginAccessWhiteList* list = result.iterator->value.get();
list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
}
示例3: areOriginsMatching
static inline bool areOriginsMatching(const SecurityOrigin& origin1, const SecurityOrigin& origin2)
{
if (origin1.isUnique() || origin2.isUnique())
return origin1.isUnique() == origin2.isUnique();
if (origin1.protocol() != origin2.protocol())
return false;
if (origin1.protocol() == "file")
return true;
if (origin1.host() != origin2.host())
return false;
return origin1.port() == origin2.port();
}
示例4: removeOriginAccessWhitelistEntry
void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
{
ASSERT(isMainThread());
ASSERT(!sourceOrigin.isUnique());
if (sourceOrigin.isUnique())
return;
String sourceString = sourceOrigin.toString();
OriginAccessMap& map = originAccessMap();
OriginAccessMap::iterator it = map.find(sourceString);
if (it == map.end())
return;
OriginAccessWhiteList& list = *it->value;
OriginAccessEntry originAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains);
if (!list.removeFirst(originAccessEntry))
return;
if (list.isEmpty())
map.remove(it);
}
示例5: removeOriginAccessWhitelistEntry
void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomain, bool allowDestinationSubdomains)
{
ASSERT(isMainThread());
ASSERT(!sourceOrigin.isUnique());
if (sourceOrigin.isUnique())
return;
String sourceString = sourceOrigin.toString();
OriginAccessMap& map = originAccessMap();
OriginAccessMap::iterator it = map.find(sourceString);
if (it == map.end())
return;
OriginAccessWhiteList* list = it->second.get();
size_t index = list->find(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
if (index == notFound)
return;
list->remove(index);
if (list->isEmpty())
map.remove(it);
}
示例6: queryInfo
ScriptPromise StorageQuota::queryInfo(ExecutionContext* executionContext, String type)
{
ASSERT(executionContext);
ScriptPromise promise = ScriptPromise::createPending(executionContext);
RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(promise, executionContext);
SecurityOrigin* securityOrigin = executionContext->securityOrigin();
if (securityOrigin->isUnique()) {
resolver->reject(DOMError::create(NotSupportedError));
return promise;
}
KURL storagePartition = KURL(KURL(), securityOrigin->toString());
blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stringToStorageQuotaType(type), WebStorageQuotaCallbacksImpl::createLeakedPtr(resolver, executionContext));
return promise;
}
示例7: queryUsageAndQuota
void DeprecatedStorageQuota::queryUsageAndQuota(ExecutionContext* executionContext, PassOwnPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageErrorCallback> errorCallback)
{
ASSERT(executionContext);
blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaType>(m_type);
if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != blink::WebStorageQuotaTypePersistent) {
// Unknown storage type is requested.
executionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
return;
}
SecurityOrigin* securityOrigin = executionContext->securityOrigin();
if (securityOrigin->isUnique()) {
executionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError));
return;
}
KURL storagePartition = KURL(KURL(), securityOrigin->toString());
OwnPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQuotaCallbacksImpl::create(successCallback, errorCallback);
blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType, callbacks.release());
}