本文整理汇总了C++中WebView::historyDelegate方法的典型用法代码示例。如果您正苦于以下问题:C++ WebView::historyDelegate方法的具体用法?C++ WebView::historyDelegate怎么用?C++ WebView::historyDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebView
的用法示例。
在下文中一共展示了WebView::historyDelegate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateGlobalHistoryRedirectLinks
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
WebView* webView = m_webFrame->webView();
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
WebHistory* history = WebHistory::sharedHistory();
DocumentLoader* loader = core(m_webFrame)->loader().documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
BString sourceURL(loader->clientRedirectSourceForHistory());
BString destURL(loader->clientRedirectDestinationForHistory());
historyDelegate->didPerformClientRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
}
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
BString sourceURL(loader->serverRedirectSourceForHistory());
BString destURL(loader->serverRedirectDestinationForHistory());
historyDelegate->didPerformServerRedirectFromURL(webView, sourceURL, destURL, m_webFrame);
}
}
}
示例2: setTitle
void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
WebView* webView = m_webFrame->webView();
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
if (historyDelegate) {
BString titleBSTR(title);
BString urlBSTR(url.string());
historyDelegate->updateHistoryTitle(webView, titleBSTR, urlBSTR);
return;
}
BOOL privateBrowsingEnabled = FALSE;
COMPtr<IWebPreferences> preferences;
if (SUCCEEDED(m_webFrame->webView()->preferences(&preferences)))
preferences->privateBrowsingEnabled(&privateBrowsingEnabled);
if (privateBrowsingEnabled)
return;
// update title in global history
COMPtr<WebHistory> history = webHistory();
if (!history)
return;
COMPtr<IWebHistoryItem> item;
if (FAILED(history->itemForURL(BString(url.string()), &item)))
return;
COMPtr<IWebHistoryItemPrivate> itemPrivate(Query, item);
if (!itemPrivate)
return;
itemPrivate->setTitle(BString(title));
}
示例3: updateGlobalHistory
void WebFrameLoaderClient::updateGlobalHistory()
{
DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
WebView* webView = m_webFrame->webView();
SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
if (historyDelegate) {
String url(loader->urlForHistory().string());
String title(loader->title());
String redirectSource(loader->clientRedirectSourceForHistory());
OwnPtr<WebURLResponse> urlResponse(WebURLResponse::createInstance(loader->response()));
OwnPtr<WebMutableURLRequest> urlRequest(WebMutableURLRequest::createInstance(loader->originalRequestCopy()));
OwnPtr<WebNavigationData> navigationData(WebNavigationData::createInstance(url.utf8().data(), title.utf8().data(), urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), redirectSource.utf8().data()));
historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
return;
}
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->visitedURL(strdup(loader->urlForHistory().string().utf8().data()), strdup(loader->title().utf8().data()), strdup(loader->originalRequestCopy().httpMethod().utf8().data()), loader->urlForHistoryReflectsFailure());
}
示例4: populateVisitedLinksIfNeeded
void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page& sourcePage)
{
if (m_visitedLinksPopulated)
return;
m_visitedLinksPopulated = true;
WebView* webView = kit(&sourcePage);
if (!webView)
return;
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
if (historyDelegate) {
historyDelegate->populateVisitedLinksForWebView(webView);
return;
}
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->addVisitedLinksToVisitedLinkStore(*this);
}
示例5: updateGlobalHistory
void WebFrameLoaderClient::updateGlobalHistory()
{
DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
WebView* webView = m_webFrame->webView();
COMPtr<IWebHistoryDelegate> historyDelegate;
webView->historyDelegate(&historyDelegate);
if (historyDelegate) {
COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(loader->response()));
COMPtr<IWebURLRequest> urlRequest(AdoptCOM, WebMutableURLRequest::createInstance(loader->originalRequestCopy()));
COMPtr<IWebNavigationData> navigationData(AdoptCOM, WebNavigationData::createInstance(
loader->urlForHistory(), loader->title(), urlRequest.get(), urlResponse.get(), loader->substituteData().isValid(), loader->clientRedirectSourceForHistory()));
historyDelegate->didNavigateWithNavigationData(webView, navigationData.get(), m_webFrame);
return;
}
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->visitedURL(loader->urlForHistory(), loader->title(), loader->originalRequestCopy().httpMethod(), loader->urlForHistoryReflectsFailure(), !loader->clientRedirectSourceForHistory());
}
示例6: updateGlobalHistoryRedirectLinks
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
WebView* webView = m_webFrame->webView();
SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
WebHistory* history = WebHistory::sharedHistory();
DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
String sourceURL(loader->clientRedirectSourceForHistory());
String destinationURL(loader->clientRedirectDestinationForHistory());
historyDelegate->didPerformClientRedirectFromURL(webView, sourceURL.utf8().data(), destinationURL.utf8().data(), m_webFrame);
} else {
if (history) {
if (WebHistoryItem* webHistoryItem = history->itemForURLString(strdup(loader->clientRedirectSourceForHistory().utf8().data())))
webHistoryItem->getPrivateItem()->m_historyItem.get()->addRedirectURL(loader->clientRedirectDestinationForHistory());
}
}
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
if (historyDelegate) {
String sourceURL(loader->serverRedirectSourceForHistory());
String destinationURL(loader->serverRedirectDestinationForHistory());
historyDelegate->didPerformServerRedirectFromURL(webView, sourceURL.utf8().data(), destinationURL.utf8().data(), m_webFrame);
} else {
if (history) {
if (WebHistoryItem *webHistoryItem = history->itemForURLString(strdup(loader->serverRedirectSourceForHistory().utf8().data())))
webHistoryItem->getPrivateItem()->m_historyItem.get()->addRedirectURL(loader->serverRedirectDestinationForHistory());
}
}
}
}
示例7: setTitle
void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
#if OS(AMIGAOS4)
if (!m_webFrame->parentFrame()) {
BalWidget* viewWindow = m_webFrame->webView()->viewWindow();
if (viewWindow && viewWindow->window) {
extern char* utf8ToAmiga(const char* utf8);
char *titlestr = utf8ToAmiga(title.utf8().data());
if (titlestr && titlestr[0])
snprintf(viewWindow->title, sizeof(viewWindow->title), viewWindow->clickTabNode ? "%s" : "OWB: %s", titlestr);
else
strcpy(viewWindow->title, "Origyn Web Browser");
free(titlestr);
if (amigaConfig.tabs) {
IIntuition->SetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
CLICKTAB_Labels, ~0,
TAG_DONE);
IClickTab->SetClickTabNodeAttrs(viewWindow->clickTabNode, TNA_Text, viewWindow->title, TAG_DONE);
IIntuition->RefreshSetGadgetAttrs(viewWindow->gad_clicktab, viewWindow->window, NULL,
CLICKTAB_Labels, viewWindow->clickTabList,
TAG_DONE);
}
else
IIntuition->SetWindowTitles(viewWindow->window, viewWindow->title, (STRPTR)~0UL);
CString urlLatin1 = url.prettyURL().latin1();
const char *urlstr = urlLatin1.data();
if (urlstr && urlstr[0] && viewWindow->gad_url) {
snprintf(viewWindow->url, sizeof(viewWindow->url), "%s", urlstr);
if (ILayout->SetPageGadgetAttrs(viewWindow->gad_url, viewWindow->page,
viewWindow->window, NULL,
STRINGA_TextVal, viewWindow->url,
TAG_DONE))
ILayout->RefreshPageGadget(viewWindow->gad_url, viewWindow->page, viewWindow->window, NULL);
}
}
}
#endif
WebView* webView = m_webFrame->webView();
SharedPtr<WebHistoryDelegate> historyDelegate = webView->historyDelegate();
if (historyDelegate) {
historyDelegate->updateHistoryTitle(webView, title.utf8().data(), url.string().utf8().data());
return;
}
bool privateBrowsingEnabled = false;
WebPreferences* preferences = m_webFrame->webView()->preferences();
if (preferences)
privateBrowsingEnabled = preferences->privateBrowsingEnabled();
if (privateBrowsingEnabled)
return;
// update title in global history
WebHistory* history = webHistory();
if (!history)
return;
WebHistoryItem* item = history->itemForURL(strdup(url.string().utf8().data()));
if (!item)
return;
item->setTitle(title.utf8().data());
}