本文整理汇总了C++中SecurityOrigin::canAccess方法的典型用法代码示例。如果您正苦于以下问题:C++ SecurityOrigin::canAccess方法的具体用法?C++ SecurityOrigin::canAccess怎么用?C++ SecurityOrigin::canAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityOrigin
的用法示例。
在下文中一共展示了SecurityOrigin::canAccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canAccessAncestor
static bool canAccessAncestor(const SecurityOrigin& activeSecurityOrigin,
const Frame* targetFrame) {
// targetFrame can be 0 when we're trying to navigate a top-level frame
// that has a 0 opener.
if (!targetFrame)
return false;
const bool isLocalActiveOrigin = activeSecurityOrigin.isLocal();
for (const Frame* ancestorFrame = targetFrame; ancestorFrame;
ancestorFrame = ancestorFrame->tree().parent()) {
const SecurityOrigin* ancestorSecurityOrigin =
ancestorFrame->securityContext()->getSecurityOrigin();
if (activeSecurityOrigin.canAccess(ancestorSecurityOrigin))
return true;
// Allow file URL descendant navigation even when
// allowFileAccessFromFileURLs is false.
// FIXME: It's a bit strange to special-case local origins here. Should we
// be doing something more general instead?
if (isLocalActiveOrigin && ancestorSecurityOrigin->isLocal())
return true;
}
return false;
}
示例2: countDeprecationCrossOriginIframe
void Deprecation::countDeprecationCrossOriginIframe(const LocalFrame* frame, UseCounter::Feature feature)
{
// Check to see if the frame can script into the top level document.
SecurityOrigin* securityOrigin = frame->securityContext()->getSecurityOrigin();
Frame* top = frame->tree().top();
if (top && !securityOrigin->canAccess(top->securityContext()->getSecurityOrigin()))
countDeprecation(frame, feature);
}
示例3: handleTouchEvent
WebInputEventResult TouchEventManager::handleTouchEvent(
const PlatformTouchEvent& event,
const HeapVector<TouchInfo>& touchInfos)
{
// Note that the disposition of any pointer events affects only the generation of touch
// events. If all pointer events were handled (and hence no touch events were fired), that
// is still equivalent to the touch events going unhandled because pointer event handler
// don't block scroll gesture generation.
// TODO(crbug.com/507408): If PE handlers always call preventDefault, we won't see TEs until after
// scrolling starts because the scrolling would suppress upcoming PEs. This sudden "break" in TE
// suppression can make the visible TEs inconsistent (e.g. touchmove without a touchstart).
bool allTouchesReleased = true;
for (const auto& point : event.touchPoints()) {
if (point.state() != PlatformTouchPoint::TouchReleased
&& point.state() != PlatformTouchPoint::TouchCancelled)
allTouchesReleased = false;
}
// Whether a touch should be considered a "user gesture" or not is a tricky question.
// https://docs.google.com/document/d/1oF1T3O7_E4t1PYHV6gyCwHxOi3ystm0eSL5xZu7nvOg/edit#
// The touchend corresponding to a tap is always a user gesture.
bool isTap = event.touchPoints().size() == 1
&& event.touchPoints()[0].state() == PlatformTouchPoint::TouchReleased
&& !event.causesScrollingIfUncanceled();
// For now, disallow dragging as a user gesture when the events are being sent to a
// cross-origin iframe (crbug.com/582140).
bool isSameOrigin = false;
if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) {
SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()->securityContext()->getSecurityOrigin();
Frame* top = m_frame->tree().top();
if (top && securityOrigin->canAccess(top->securityContext()->getSecurityOrigin()))
isSameOrigin = true;
}
OwnPtr<UserGestureIndicator> gestureIndicator;
if (isTap || isSameOrigin) {
UserGestureUtilizedCallback* callback = 0;
if (!isTap) {
// This is some other touch event that we currently consider a user gesture. So
// use a UserGestureUtilizedCallback to get metrics.
callback = &m_touchSequenceDocument->frame()->eventHandler();
}
if (m_touchSequenceUserGestureToken)
gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback));
else
gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback));
m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
}
return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
}
示例4: countCrossOriginIframe
void UseCounter::countCrossOriginIframe(const Document& document, Feature feature)
{
Frame* frame = document.frame();
if (!frame)
return;
// Check to see if the frame can script into the top level document.
SecurityOrigin* securityOrigin = frame->securityContext()->securityOrigin();
Frame* top = frame->tree().top();
if (top && !securityOrigin->canAccess(top->securityContext()->securityOrigin()))
count(frame, feature);
}