more DRYing of code

This commit is contained in:
ZappoMan 2015-03-19 11:41:03 -07:00
parent 3c41ecd091
commit e6cefa946c

View file

@ -32,20 +32,13 @@ void DataWebPage::javaScriptConsoleMessage(const QString& message, int lineNumbe
}
bool DataWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) {
if (!request.url().toString().startsWith(HIFI_URL_SCHEME)) {
QString urlString = request.url().toString();
if (Application::getInstance()->canAcceptURL(urlString)) {
if (Application::getInstance()->acceptURL(urlString)) {
return false; // we handled it, so QWebPage doesn't need to handle it
}
QString urlString = request.url().toString();
if (Application::getInstance()->canAcceptURL(urlString)) {
if (Application::getInstance()->acceptURL(urlString)) {
return false; // we handled it, so QWebPage doesn't need to handle it
}
return true;
} else {
// this is a hifi URL - have the AddressManager handle it
QMetaObject::invokeMethod(DependencyManager::get<AddressManager>().data(), "handleLookupString",
Qt::AutoConnection, Q_ARG(const QString&, request.url().toString()));
return false;
}
return true;
}
QString DataWebPage::userAgentForUrl(const QUrl& url) const {