本文整理汇总了C++中HistoryItem::childItemWithName方法的典型用法代码示例。如果您正苦于以下问题:C++ HistoryItem::childItemWithName方法的具体用法?C++ HistoryItem::childItemWithName怎么用?C++ HistoryItem::childItemWithName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HistoryItem
的用法示例。
在下文中一共展示了HistoryItem::childItemWithName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadURLIntoChild
void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const String& referrer, WebFrame* childFrame)
{
ASSERT(childFrame);
ASSERT(core(childFrame));
Frame* coreFrame = core(m_webFrame);
ASSERT(coreFrame);
HistoryItem* parentItem = coreFrame->loader()->currentHistoryItem();
FrameLoadType loadType = coreFrame->loader()->loadType();
FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedHistory;
KURL url = originalURL;
// If we're moving in the backforward list, we might want to replace the content
// of this child frame with whatever was there at that point.
// Reload will maintain the frame contents, LoadSame will not.
if (parentItem && parentItem->children().size() &&
(isBackForwardLoadType(loadType)
|| loadType == FrameLoadTypeReload
|| loadType == FrameLoadTypeReloadAllowingStaleData))
{
if (HistoryItem* childItem = parentItem->childItemWithName(core(childFrame)->tree()->name())) {
// Use the original URL to ensure we get all the side-effects, such as
// onLoad handlers, of any redirects that happened. An example of where
// this is needed is Radar 3213556.
url = childItem->originalURL();
// These behaviors implied by these loadTypes should apply to the child frames
childLoadType = loadType;
if (isBackForwardLoadType(loadType))
// For back/forward, remember this item so we can traverse any child items as child frames load
core(childFrame)->loader()->setProvisionalHistoryItem(childItem);
else
// For reload, just reinstall the current item, since a new child frame was created but we won't be creating a new BF item
core(childFrame)->loader()->setCurrentHistoryItem(childItem);
}
}
// FIXME: Handle loading WebArchives here
String frameName = core(childFrame)->tree()->name();
core(childFrame)->loader()->loadURL(url, referrer, frameName, childLoadType, 0, 0);
}