Commit f3a95312 authored by nasko@chromium.org's avatar nasko@chromium.org

Remove RenderViewImpl::FrameDidCommitProvisionalLoad

BUG=304341

Review URL: https://codereview.chromium.org/324403007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276712 0039d316-1c4b-4281-b951-d872f2087c98
parent 1b1b1f47
...@@ -1969,7 +1969,7 @@ void RenderFrameImpl::didCommitProvisionalLoad( ...@@ -1969,7 +1969,7 @@ void RenderFrameImpl::didCommitProvisionalLoad(
// UpdateSessionHistory and update page_id_ even in this case, so that // UpdateSessionHistory and update page_id_ even in this case, so that
// the current entry gets a state update and so that we don't send a // the current entry gets a state update and so that we don't send a
// state update to the wrong entry when we swap back in. // state update to the wrong entry when we swap back in.
if (render_view_->GetLoadingUrl(frame) != GURL(kSwappedOutURL)) { if (GetLoadingUrl() != GURL(kSwappedOutURL)) {
// Advance our offset in session history, applying the length limit. // Advance our offset in session history, applying the length limit.
// There is now no forward history. // There is now no forward history.
render_view_->history_list_offset_++; render_view_->history_list_offset_++;
...@@ -2012,10 +2012,20 @@ void RenderFrameImpl::didCommitProvisionalLoad( ...@@ -2012,10 +2012,20 @@ void RenderFrameImpl::didCommitProvisionalLoad(
} }
} }
render_view_->FrameDidCommitProvisionalLoad(frame, is_new_navigation); FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_,
DidCommitProvisionalLoad(frame, is_new_navigation));
FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
DidCommitProvisionalLoad(is_new_navigation)); DidCommitProvisionalLoad(is_new_navigation));
if (!frame->parent()) { // Only for top frames.
RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
if (render_thread_impl) { // Can be NULL in tests.
render_thread_impl->histogram_customizer()->
RenderViewNavigatedToHost(GURL(GetLoadingUrl()).host(),
RenderViewImpl::GetRenderViewCount());
}
}
// Remember that we've already processed this request, so we don't update // Remember that we've already processed this request, so we don't update
// the session history again. We do this regardless of whether this is // the session history again. We do this regardless of whether this is
// a session history navigation, because if we attempted a session history // a session history navigation, because if we attempted a session history
...@@ -2961,7 +2971,7 @@ void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) { ...@@ -2961,7 +2971,7 @@ void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) {
params.security_info = response.securityInfo(); params.security_info = response.securityInfo();
// Set the URL to be displayed in the browser UI to the user. // Set the URL to be displayed in the browser UI to the user.
params.url = render_view_->GetLoadingUrl(frame); params.url = GetLoadingUrl();
DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL));
if (frame->document().baseURL() != params.url) if (frame->document().baseURL() != params.url)
...@@ -3505,6 +3515,15 @@ RenderFrameImpl::CreateRendererFactory() { ...@@ -3505,6 +3515,15 @@ RenderFrameImpl::CreateRendererFactory() {
#endif #endif
} }
GURL RenderFrameImpl::GetLoadingUrl() const {
WebDataSource* ds = frame_->dataSource();
if (ds->hasUnreachableURL())
return ds->unreachableURL();
const WebURLRequest& request = ds->request();
return request.url();
}
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer(
......
...@@ -531,6 +531,9 @@ class CONTENT_EXPORT RenderFrameImpl ...@@ -531,6 +531,9 @@ class CONTENT_EXPORT RenderFrameImpl
// The method is virtual so that layouttests can override it. // The method is virtual so that layouttests can override it.
virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory(); virtual scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
// Returns the URL being loaded by the |frame_|'s request.
GURL GetLoadingUrl() const;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
blink::WebMediaPlayer* CreateAndroidWebMediaPlayer( blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
const blink::WebURL& url, const blink::WebURL& url,
......
...@@ -890,6 +890,11 @@ RenderView* RenderView::FromRoutingID(int routing_id) { ...@@ -890,6 +890,11 @@ RenderView* RenderView::FromRoutingID(int routing_id) {
return RenderViewImpl::FromRoutingID(routing_id); return RenderViewImpl::FromRoutingID(routing_id);
} }
/* static */
size_t RenderViewImpl::GetRenderViewCount() {
return g_view_map.Get().size();
}
/*static*/ /*static*/
void RenderView::ForEach(RenderViewVisitor* visitor) { void RenderView::ForEach(RenderViewVisitor* visitor) {
ViewMap* views = g_view_map.Pointer(); ViewMap* views = g_view_map.Pointer();
...@@ -2130,23 +2135,6 @@ void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { ...@@ -2130,23 +2135,6 @@ void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
webview()->setPageScaleFactorLimits(1, maxPageScaleFactor); webview()->setPageScaleFactorLimits(1, maxPageScaleFactor);
} }
void RenderViewImpl::FrameDidCommitProvisionalLoad(WebLocalFrame* frame,
bool is_new_navigation) {
FOR_EACH_OBSERVER(RenderViewObserver, observers_,
DidCommitProvisionalLoad(frame, is_new_navigation));
// TODO(nasko): Transition this code to RenderFrameImpl, since g_view_map is
// not accessible from there.
if (!frame->parent()) { // Only for top frames.
RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
if (render_thread_impl) { // Can be NULL in tests.
render_thread_impl->histogram_customizer()->
RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(),
g_view_map.Get().size());
}
}
}
void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame) { void RenderViewImpl::didClearWindowObject(WebLocalFrame* frame) {
FOR_EACH_OBSERVER( FOR_EACH_OBSERVER(
RenderViewObserver, observers_, DidClearWindowObject(frame)); RenderViewObserver, observers_, DidClearWindowObject(frame));
...@@ -2366,15 +2354,6 @@ void RenderViewImpl::SyncNavigationState() { ...@@ -2366,15 +2354,6 @@ void RenderViewImpl::SyncNavigationState() {
SendUpdateState(history_controller_->GetCurrentEntry()); SendUpdateState(history_controller_->GetCurrentEntry());
} }
GURL RenderViewImpl::GetLoadingUrl(blink::WebFrame* frame) const {
WebDataSource* ds = frame->dataSource();
if (ds->hasUnreachableURL())
return ds->unreachableURL();
const WebURLRequest& request = ds->request();
return request.url();
}
blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() { blink::WebPlugin* RenderViewImpl::GetWebPluginForFind() {
if (!webview()) if (!webview())
return NULL; return NULL;
......
...@@ -201,6 +201,8 @@ class CONTENT_EXPORT RenderViewImpl ...@@ -201,6 +201,8 @@ class CONTENT_EXPORT RenderViewImpl
// Returns the RenderViewImpl for the given routing ID. // Returns the RenderViewImpl for the given routing ID.
static RenderViewImpl* FromRoutingID(int routing_id); static RenderViewImpl* FromRoutingID(int routing_id);
static size_t GetRenderViewCount();
// May return NULL when the view is closing. // May return NULL when the view is closing.
blink::WebView* webview() const; blink::WebView* webview() const;
...@@ -275,9 +277,6 @@ class CONTENT_EXPORT RenderViewImpl ...@@ -275,9 +277,6 @@ class CONTENT_EXPORT RenderViewImpl
void FrameDidStartLoading(blink::WebFrame* frame); void FrameDidStartLoading(blink::WebFrame* frame);
void FrameDidStopLoading(blink::WebFrame* frame); void FrameDidStopLoading(blink::WebFrame* frame);
void FrameDidCommitProvisionalLoad(blink::WebLocalFrame* frame,
bool is_new_navigation);
// Plugin-related functions -------------------------------------------------- // Plugin-related functions --------------------------------------------------
#if defined(ENABLE_PLUGINS) #if defined(ENABLE_PLUGINS)
...@@ -796,9 +795,6 @@ class CONTENT_EXPORT RenderViewImpl ...@@ -796,9 +795,6 @@ class CONTENT_EXPORT RenderViewImpl
// doesn't have a frame at the specified size, the first is returned. // doesn't have a frame at the specified size, the first is returned.
bool DownloadFavicon(int id, const GURL& image_url, int image_size); bool DownloadFavicon(int id, const GURL& image_url, int image_size);
// Returns the URL being loaded by the given frame's request.
GURL GetLoadingUrl(blink::WebFrame* frame) const;
// Called to get the WebPlugin to handle find requests in the document. // Called to get the WebPlugin to handle find requests in the document.
// Returns NULL if there is no such WebPlugin. // Returns NULL if there is no such WebPlugin.
blink::WebPlugin* GetWebPluginForFind(); blink::WebPlugin* GetWebPluginForFind();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment