Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1310)

Unified Diff: Source/web/WebFrameImpl.cpp

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | Source/web/WebHelperPluginImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebFrameImpl.cpp
diff --git a/Source/web/WebFrameImpl.cpp b/Source/web/WebFrameImpl.cpp
index 9544c40d19a818f9ce9de7f186e1ce4cd7042f9b..aa2f54c85169d6dc7c8e17e83a54447e12f8cbad 100644
--- a/Source/web/WebFrameImpl.cpp
+++ b/Source/web/WebFrameImpl.cpp
@@ -551,8 +551,8 @@ WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypesMask) const
{
// The URL to the icon may be in the header. As such, only
// ask the loader for the icon if it's finished loading.
- if (frame()->loader()->state() == FrameStateComplete)
- return frame()->loader()->icon()->urlsForTypes(iconTypesMask);
+ if (frame()->loader().state() == FrameStateComplete)
+ return frame()->loader().icon()->urlsForTypes(iconTypesMask);
return WebVector<WebIconURL>();
}
@@ -620,12 +620,12 @@ WebFrame* WebFrameImpl::opener() const
{
if (!frame())
return 0;
- return fromFrame(frame()->loader()->opener());
+ return fromFrame(frame()->loader().opener());
}
void WebFrameImpl::setOpener(const WebFrame* webFrame)
{
- frame()->loader()->setOpener(webFrame ? toWebFrameImpl(webFrame)->frame() : 0);
+ frame()->loader().setOpener(webFrame ? toWebFrameImpl(webFrame)->frame() : 0);
}
WebFrame* WebFrameImpl::parent() const
@@ -813,7 +813,7 @@ void WebFrameImpl::collectGarbage()
bool WebFrameImpl::checkIfRunInsecureContent(const WebURL& url) const
{
ASSERT(frame());
- return frame()->loader()->mixedContentChecker()->canRunInsecureContent(frame()->document()->securityOrigin(), url);
+ return frame()->loader().mixedContentChecker()->canRunInsecureContent(frame()->document()->securityOrigin(), url);
}
v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const WebScriptSource& source)
@@ -895,13 +895,13 @@ v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystemType type, cons
void WebFrameImpl::reload(bool ignoreCache)
{
ASSERT(frame());
- frame()->loader()->reload(ignoreCache ? EndToEndReload : NormalReload);
+ frame()->loader().reload(ignoreCache ? EndToEndReload : NormalReload);
}
void WebFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache)
{
ASSERT(frame());
- frame()->loader()->reload(ignoreCache ? EndToEndReload : NormalReload, overrideUrl);
+ frame()->loader().reload(ignoreCache ? EndToEndReload : NormalReload, overrideUrl);
}
void WebFrameImpl::loadRequest(const WebURLRequest& request)
@@ -915,7 +915,7 @@ void WebFrameImpl::loadRequest(const WebURLRequest& request)
return;
}
- frame()->loader()->load(FrameLoadRequest(0, resourceRequest));
+ frame()->loader().load(FrameLoadRequest(0, resourceRequest));
}
void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item)
@@ -924,8 +924,8 @@ void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item)
RefPtr<HistoryItem> historyItem = PassRefPtr<HistoryItem>(item);
ASSERT(historyItem);
- frame()->loader()->prepareForHistoryNavigation();
- RefPtr<HistoryItem> currentItem = frame()->loader()->history()->currentItem();
+ frame()->loader().prepareForHistoryNavigation();
+ RefPtr<HistoryItem> currentItem = frame()->loader().history()->currentItem();
m_inSameDocumentHistoryLoad = currentItem && currentItem->shouldDoSameDocumentNavigationTo(historyItem.get());
frame()->page()->goToItem(historyItem.get());
m_inSameDocumentHistoryLoad = false;
@@ -943,13 +943,13 @@ void WebFrameImpl::loadData(const WebData& data, const WebString& mimeType, cons
// instead of the currently loaded URL.
ResourceRequest request;
if (replace && !unreachableURL.isEmpty())
- request = frame()->loader()->originalRequest();
+ request = frame()->loader().originalRequest();
request.setURL(baseURL);
FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, textEncoding, unreachableURL));
ASSERT(frameRequest.substituteData().isValid());
frameRequest.setLockBackForwardList(replace);
- frame()->loader()->load(frameRequest);
+ frame()->loader().load(frameRequest);
}
void WebFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseURL, const WebURL& unreachableURL, bool replace)
@@ -962,7 +962,7 @@ bool WebFrameImpl::isLoading() const
{
if (!frame())
return false;
- return frame()->loader()->isLoading();
+ return frame()->loader().isLoading();
}
void WebFrameImpl::stopLoading()
@@ -971,7 +971,7 @@ void WebFrameImpl::stopLoading()
return;
// FIXME: Figure out what we should really do here. It seems like a bug
// that FrameLoader::stopLoading doesn't call stopAllLoaders.
- frame()->loader()->stopAllLoaders();
+ frame()->loader().stopAllLoaders();
}
WebDataSource* WebFrameImpl::provisionalDataSource() const
@@ -979,9 +979,9 @@ WebDataSource* WebFrameImpl::provisionalDataSource() const
ASSERT(frame());
// We regard the policy document loader as still provisional.
- DocumentLoader* documentLoader = frame()->loader()->provisionalDocumentLoader();
+ DocumentLoader* documentLoader = frame()->loader().provisionalDocumentLoader();
if (!documentLoader)
- documentLoader = frame()->loader()->policyDocumentLoader();
+ documentLoader = frame()->loader().policyDocumentLoader();
return DataSourceForDocLoader(documentLoader);
}
@@ -989,7 +989,7 @@ WebDataSource* WebFrameImpl::provisionalDataSource() const
WebDataSource* WebFrameImpl::dataSource() const
{
ASSERT(frame());
- return DataSourceForDocLoader(frame()->loader()->documentLoader());
+ return DataSourceForDocLoader(frame()->loader().documentLoader());
}
WebHistoryItem WebFrameImpl::previousHistoryItem() const
@@ -999,7 +999,7 @@ WebHistoryItem WebFrameImpl::previousHistoryItem() const
// only get saved to history when it becomes the previous item. The caller
// is expected to query the history item after a navigation occurs, after
// the desired history item has become the previous entry.
- return WebHistoryItem(frame()->loader()->history()->previousItem());
+ return WebHistoryItem(frame()->loader().history()->previousItem());
}
WebHistoryItem WebFrameImpl::currentHistoryItem() const
@@ -1007,7 +1007,7 @@ WebHistoryItem WebFrameImpl::currentHistoryItem() const
ASSERT(frame());
// We're shutting down.
- if (!frame()->loader()->activeDocumentLoader())
+ if (!frame()->loader().activeDocumentLoader())
return WebHistoryItem();
// If we are still loading, then we don't want to clobber the current
@@ -1015,13 +1015,13 @@ WebHistoryItem WebFrameImpl::currentHistoryItem() const
// document state. However, it is OK for new navigations.
// FIXME: Can we make this a plain old getter, instead of worrying about
// clobbering here?
- if (!m_inSameDocumentHistoryLoad && (frame()->loader()->loadType() == FrameLoadTypeStandard
- || !frame()->loader()->activeDocumentLoader()->isLoadingInAPISense()))
- frame()->loader()->history()->saveDocumentAndScrollState();
+ if (!m_inSameDocumentHistoryLoad && (frame()->loader().loadType() == FrameLoadTypeStandard
+ || !frame()->loader().activeDocumentLoader()->isLoadingInAPISense()))
+ frame()->loader().history()->saveDocumentAndScrollState();
- if (HistoryItem* item = frame()->loader()->history()->provisionalItem())
+ if (HistoryItem* item = frame()->loader().history()->provisionalItem())
return WebHistoryItem(item);
- return WebHistoryItem(frame()->page()->mainFrame()->loader()->history()->currentItem());
+ return WebHistoryItem(frame()->page()->mainFrame()->loader().history()->currentItem());
}
void WebFrameImpl::enableViewSourceMode(bool enable)
@@ -1039,7 +1039,7 @@ bool WebFrameImpl::isViewSourceModeEnabled() const
void WebFrameImpl::setReferrerForRequest(WebURLRequest& request, const WebURL& referrerURL)
{
- String referrer = referrerURL.isEmpty() ? frame()->loader()->outgoingReferrer() : String(referrerURL.spec().utf16());
+ String referrer = referrerURL.isEmpty() ? frame()->loader().outgoingReferrer() : String(referrerURL.spec().utf16());
referrer = SecurityPolicy::generateReferrerHeader(frame()->document()->referrerPolicy(), request.url(), referrer);
if (referrer.isEmpty())
return;
@@ -1049,7 +1049,7 @@ void WebFrameImpl::setReferrerForRequest(WebURLRequest& request, const WebURL& r
void WebFrameImpl::dispatchWillSendRequest(WebURLRequest& request)
{
ResourceResponse response;
- frame()->loader()->client()->dispatchWillSendRequest(0, 0, request.toMutableResourceRequest(), response);
+ frame()->loader().client()->dispatchWillSendRequest(0, 0, request.toMutableResourceRequest(), response);
}
WebURLLoader* WebFrameImpl::createAssociatedURLLoader(const WebURLLoaderOptions& options)
@@ -1064,7 +1064,7 @@ unsigned WebFrameImpl::unloadListenerCount() const
bool WebFrameImpl::willSuppressOpenerInNewFrame() const
{
- return frame()->loader()->suppressOpenerInNewFrame();
+ return frame()->loader().suppressOpenerInNewFrame();
}
void WebFrameImpl::replaceSelection(const WebString& text)
@@ -2196,17 +2196,17 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame(const FrameLoadRequest& request
if (!childFrame->tree().parent())
return 0;
- HistoryItem* parentItem = frame()->loader()->history()->currentItem();
+ HistoryItem* parentItem = frame()->loader().history()->currentItem();
HistoryItem* childItem = 0;
// If we're moving in the back/forward list, we might want to replace the content
// of this child frame with whatever was there at that point.
- if (parentItem && parentItem->children().size() && isBackForwardLoadType(frame()->loader()->loadType()) && !frame()->document()->loadEventFinished())
+ if (parentItem && parentItem->children().size() && isBackForwardLoadType(frame()->loader().loadType()) && !frame()->document()->loadEventFinished())
childItem = parentItem->childItemWithTarget(childFrame->tree().uniqueName());
if (childItem)
- childFrame->loader()->loadHistoryItem(childItem);
+ childFrame->loader().loadHistoryItem(childItem);
else
- childFrame->loader()->load(FrameLoadRequest(0, request.resourceRequest(), "_self"));
+ childFrame->loader().load(FrameLoadRequest(0, request.resourceRequest(), "_self"));
// A synchronous navigation (about:blank) would have already processed
// onload, so it is possible for the frame to have already been destroyed by
@@ -2252,7 +2252,7 @@ WebFrameImpl* WebFrameImpl::fromFrame(Frame* frame)
{
if (!frame)
return 0;
- return toFrameLoaderClientImpl(frame->loader()->client())->webFrame();
+ return toFrameLoaderClientImpl(frame->loader().client())->webFrame();
}
WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element)
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | Source/web/WebHelperPluginImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698