diff --git a/Source/core/accessibility/AXRenderObject.cpp b/Source/core/accessibility/AXRenderObject.cpp index a5965f9cbe3..d5dc4bcbcc4 100644 --- a/Source/core/accessibility/AXRenderObject.cpp +++ b/Source/core/accessibility/AXRenderObject.cpp @@ -1493,8 +1493,8 @@ double AXRenderObject::estimatedLoadingProgress() const if (isLoaded()) return 1.0; - if (LocalFrame* frame = m_renderer->document().frame()) - return frame->loader().progress().estimatedProgress(); + if (Page* page = m_renderer->document().page()) + return page->progress().estimatedProgress(); return 0; } diff --git a/Source/core/loader/EmptyClients.h b/Source/core/loader/EmptyClients.h index 1356d17656e..9e7a7f25a3b 100644 --- a/Source/core/loader/EmptyClients.h +++ b/Source/core/loader/EmptyClients.h @@ -212,9 +212,9 @@ class EmptyFrameLoaderClient FINAL : public FrameLoaderClient { virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) OVERRIDE; virtual void dispatchWillSubmitForm(HTMLFormElement*) OVERRIDE; - virtual void didStartLoading(LoadStartType) OVERRIDE { } - virtual void progressEstimateChanged(double) OVERRIDE { } - virtual void didStopLoading() OVERRIDE { } + virtual void postProgressStartedNotification(LoadStartType) OVERRIDE { } + virtual void postProgressEstimateChangedNotification() OVERRIDE { } + virtual void postProgressFinishedNotification() OVERRIDE { } virtual void loadURLExternally(const ResourceRequest&, NavigationPolicy, const String& = String()) OVERRIDE { } diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp index 6e0790e59d0..38706a8e74a 100644 --- a/Source/core/loader/FrameFetchContext.cpp +++ b/Source/core/loader/FrameFetchContext.cpp @@ -159,26 +159,30 @@ void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq void FrameFetchContext::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader) { - m_frame->loader().progress().incrementProgress(identifier, r); + if (Page* page = m_frame->page()) + page->progress().incrementProgress(identifier, r); m_frame->loader().client()->dispatchDidReceiveResponse(loader, identifier, r); InspectorInstrumentation::didReceiveResourceResponse(m_frame, identifier, ensureLoader(loader), r, resourceLoader); } void FrameFetchContext::dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength) { - m_frame->loader().progress().incrementProgress(identifier, data, dataLength); + if (Page* page = m_frame->page()) + page->progress().incrementProgress(identifier, data, dataLength); InspectorInstrumentation::didReceiveData(m_frame, identifier, data, dataLength, encodedDataLength); } void FrameFetchContext::dispatchDidDownloadData(DocumentLoader*, unsigned long identifier, int dataLength, int encodedDataLength) { - m_frame->loader().progress().incrementProgress(identifier, 0, dataLength); + if (Page* page = m_frame->page()) + page->progress().incrementProgress(identifier, 0, dataLength); InspectorInstrumentation::didReceiveData(m_frame, identifier, 0, dataLength, encodedDataLength); } void FrameFetchContext::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, double finishTime, int64_t encodedDataLength) { - m_frame->loader().progress().completeProgress(identifier); + if (Page* page = m_frame->page()) + page->progress().completeProgress(identifier); m_frame->loader().client()->dispatchDidFinishLoading(loader, identifier); InspectorInstrumentation::didFinishLoading(m_frame, identifier, ensureLoader(loader), finishTime, encodedDataLength); @@ -186,7 +190,8 @@ void FrameFetchContext::dispatchDidFinishLoading(DocumentLoader* loader, unsigne void FrameFetchContext::dispatchDidFail(DocumentLoader* loader, unsigned long identifier, const ResourceError& error) { - m_frame->loader().progress().completeProgress(identifier); + if (Page* page = m_frame->page()) + page->progress().completeProgress(identifier); InspectorInstrumentation::didFailLoading(m_frame, identifier, error); } diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp index 4f4b34a8363..20c00570ebc 100644 --- a/Source/core/loader/FrameLoader.cpp +++ b/Source/core/loader/FrameLoader.cpp @@ -105,11 +105,48 @@ static bool needsHistoryItemRestore(FrameLoadType type) return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin; } +class FrameLoader::FrameProgressTracker { +public: + static PassOwnPtr create(LocalFrame* frame) { return adoptPtr(new FrameProgressTracker(frame)); } + ~FrameProgressTracker() + { + ASSERT(!m_inProgress || m_frame->page()); + if (m_inProgress) + m_frame->page()->progress().progressCompleted(m_frame); + } + + void progressStarted() + { + ASSERT(m_frame->page()); + if (!m_inProgress) + m_frame->page()->progress().progressStarted(m_frame); + m_inProgress = true; + } + + void progressCompleted() + { + ASSERT(m_inProgress); + ASSERT(m_frame->page()); + m_inProgress = false; + m_frame->page()->progress().progressCompleted(m_frame); + } + +private: + FrameProgressTracker(LocalFrame* frame) + : m_frame(frame) + , m_inProgress(false) + { + } + + LocalFrame* m_frame; + bool m_inProgress; +}; + FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client) : m_frame(frame) , m_client(client) , m_mixedContentChecker(frame) - , m_progressTracker(ProgressTracker::create(frame)) + , m_progressTracker(FrameProgressTracker::create(m_frame)) , m_state(FrameStateProvisional) , m_loadType(FrameLoadTypeStandard) , m_fetchContext(FrameFetchContext::create(frame)) @@ -536,14 +573,14 @@ void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume // don't fire them for fragment redirection that happens in window.onload handler. // See https://bugs.webkit.org/show_bug.cgi?id=31838 if (m_frame->document()->loadEventFinished()) - m_client->didStartLoading(NavigationWithinSameDocument); + m_client->postProgressStartedNotification(NavigationWithinSameDocument); HistoryCommitType historyCommitType = updateBackForwardList == UpdateBackForwardList && m_currentItem ? StandardCommit : HistoryInertCommit; setHistoryItemStateForCommit(historyCommitType, sameDocumentNavigationSource == SameDocumentNavigationHistoryApi, data); m_client->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitType); m_client->dispatchDidReceiveTitle(m_frame->document()->title()); if (m_frame->document()->loadEventFinished()) - m_client->didStopLoading(); + m_client->postProgressFinishedNotification(); } void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr stateObject, UpdateBackForwardListPolicy updateBackForwardList, ClientRedirectPolicy clientRedirect) @@ -1050,6 +1087,17 @@ void FrameLoader::checkLoadComplete(DocumentLoader* documentLoader) checkLoadComplete(); } +int FrameLoader::numPendingOrLoadingRequests(bool recurse) const +{ + if (!recurse) + return m_frame->document()->fetcher()->requestCount(); + + int count = 0; + for (LocalFrame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_frame)) + count += frame->document()->fetcher()->requestCount(); + return count; +} + String FrameLoader::userAgent(const KURL& url) const { String userAgent = m_client->userAgent(url); diff --git a/Source/core/loader/FrameLoader.h b/Source/core/loader/FrameLoader.h index fd3d64daf84..9bf63cf23e1 100644 --- a/Source/core/loader/FrameLoader.h +++ b/Source/core/loader/FrameLoader.h @@ -60,7 +60,6 @@ class FrameLoaderClient; class IconController; class NavigationAction; class Page; -class ProgressTracker; class ResourceError; class ResourceResponse; class SecurityOrigin; @@ -83,7 +82,6 @@ class FrameLoader { LocalFrame* frame() const { return m_frame; } MixedContentChecker* mixedContentChecker() const { return &m_mixedContentChecker; } - ProgressTracker& progress() const { return *m_progressTracker; } // These functions start a load. All eventually call into loadWithNavigationAction() or loadInSameDocument(). void load(const FrameLoadRequest&); // The entry point for non-reload, non-history loads. @@ -113,6 +111,8 @@ class FrameLoader { bool isLoading() const; + int numPendingOrLoadingRequests(bool recurse) const; + DocumentLoader* documentLoader() const { return m_documentLoader.get(); } DocumentLoader* policyDocumentLoader() const { return m_policyDocumentLoader.get(); } DocumentLoader* provisionalDocumentLoader() const { return m_provisionalDocumentLoader.get(); } @@ -238,7 +238,8 @@ class FrameLoader { mutable FrameLoaderStateMachine m_stateMachine; mutable MixedContentChecker m_mixedContentChecker; - OwnPtr m_progressTracker; + class FrameProgressTracker; + OwnPtr m_progressTracker; FrameState m_state; FrameLoadType m_loadType; diff --git a/Source/core/loader/FrameLoaderClient.h b/Source/core/loader/FrameLoaderClient.h index 9aa61aad901..ab2ca266141 100644 --- a/Source/core/loader/FrameLoaderClient.h +++ b/Source/core/loader/FrameLoaderClient.h @@ -122,9 +122,10 @@ namespace WebCore { virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) = 0; virtual void dispatchWillSubmitForm(HTMLFormElement*) = 0; - virtual void didStartLoading(LoadStartType) = 0; - virtual void progressEstimateChanged(double progressEstimate) = 0; - virtual void didStopLoading() = 0; + // Maybe these should go into a ProgressTrackerClient some day + virtual void postProgressStartedNotification(LoadStartType) = 0; + virtual void postProgressEstimateChangedNotification() = 0; + virtual void postProgressFinishedNotification() = 0; virtual void loadURLExternally(const ResourceRequest&, NavigationPolicy, const String& suggestedName = String()) = 0; diff --git a/Source/core/loader/ProgressTracker.cpp b/Source/core/loader/ProgressTracker.cpp index f11a89f4211..be2b29abe4f 100644 --- a/Source/core/loader/ProgressTracker.cpp +++ b/Source/core/loader/ProgressTracker.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "core/loader/ProgressTracker.h" -#include "core/fetch/ResourceFetcher.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" #include "core/inspector/InspectorInstrumentation.h" @@ -62,10 +61,8 @@ struct ProgressItem { long long estimatedLength; }; -ProgressTracker::ProgressTracker(LocalFrame* frame) - : m_frame(frame) - , m_inProgress(false) - , m_totalPageAndResourceBytesToLoad(0) +ProgressTracker::ProgressTracker() + : m_totalPageAndResourceBytesToLoad(0) , m_totalBytesReceived(0) , m_lastNotifiedProgressValue(0) , m_lastNotifiedProgressTime(0) @@ -73,18 +70,17 @@ ProgressTracker::ProgressTracker(LocalFrame* frame) , m_progressNotificationTimeInterval(0.1) , m_finalProgressChangedSent(false) , m_progressValue(0) + , m_numProgressTrackedFrames(0) { } ProgressTracker::~ProgressTracker() { - if (m_inProgress) - progressCompleted(); } -PassOwnPtr ProgressTracker::create(LocalFrame* frame) +PassOwnPtr ProgressTracker::create() { - return adoptPtr(new ProgressTracker(frame)); + return adoptPtr(new ProgressTracker); } double ProgressTracker::estimatedProgress() const @@ -102,35 +98,59 @@ void ProgressTracker::reset() m_lastNotifiedProgressValue = 0; m_lastNotifiedProgressTime = 0; m_finalProgressChangedSent = false; + m_numProgressTrackedFrames = 0; + m_originatingProgressFrame = nullptr; } -void ProgressTracker::progressStarted() +void ProgressTracker::progressStarted(LocalFrame* frame) { - if (!m_inProgress) { + WTF_LOG(Progress, "Progress started (%p) - frame %p(\"%s\"), value %f, tracked frames %d, originating frame %p", this, frame, frame->tree().uniqueName().utf8().data(), m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); + + if (m_numProgressTrackedFrames == 0 || m_originatingProgressFrame == frame) { reset(); m_progressValue = initialProgressValue; - m_frame->loader().client()->didStartLoading(NavigationToDifferentDocument); + m_originatingProgressFrame = frame; + + m_originatingProgressFrame->loader().client()->postProgressStartedNotification(NavigationToDifferentDocument); } - m_inProgress = true; - InspectorInstrumentation::frameStartedLoading(m_frame); + m_numProgressTrackedFrames++; + InspectorInstrumentation::frameStartedLoading(frame); +} + +void ProgressTracker::progressCompleted(LocalFrame* frame) +{ + WTF_LOG(Progress, "Progress completed (%p) - frame %p(\"%s\"), value %f, tracked frames %d, originating frame %p", this, frame, frame->tree().uniqueName().utf8().data(), m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); + + if (m_numProgressTrackedFrames <= 0) + return; + m_numProgressTrackedFrames--; + if (!m_numProgressTrackedFrames || m_originatingProgressFrame == frame) + finalProgressComplete(); } -void ProgressTracker::progressCompleted() +void ProgressTracker::finalProgressComplete() { - ASSERT(m_inProgress); - m_inProgress = false; + WTF_LOG(Progress, "Final progress complete (%p)", this); + + RefPtr frame = m_originatingProgressFrame.release(); + + // Before resetting progress value be sure to send client a least one notification + // with final progress value. if (!m_finalProgressChangedSent) { m_progressValue = 1; - m_frame->loader().client()->progressEstimateChanged(m_progressValue); + frame->loader().client()->postProgressEstimateChangedNotification(); } + reset(); - m_frame->loader().client()->didStopLoading(); - InspectorInstrumentation::frameStoppedLoading(m_frame); + frame->loader().client()->postProgressFinishedNotification(); + InspectorInstrumentation::frameStoppedLoading(frame.get()); } void ProgressTracker::incrementProgress(unsigned long identifier, const ResourceResponse& response) { - if (!m_inProgress) + WTF_LOG(Progress, "Progress incremented (%p) - value %f, tracked frames %d, originating frame %p", this, m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); + + if (m_numProgressTrackedFrames <= 0) return; long long estimatedLength = response.expectedContentLength(); @@ -154,6 +174,8 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i if (!item) return; + RefPtr frame = m_originatingProgressFrame; + unsigned bytesReceived = length; double increment, percentOfRemainingBytes; long long remainingBytes, estimatedBytesForPendingRequests; @@ -164,7 +186,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i item->estimatedLength = item->bytesReceived * 2; } - int numPendingOrLoadingRequests = m_frame->document()->fetcher()->requestCount(); + int numPendingOrLoadingRequests = frame->loader().numPendingOrLoadingRequests(true); estimatedBytesForPendingRequests = progressItemDefaultEstimatedLength * numPendingOrLoadingRequests; remainingBytes = ((m_totalPageAndResourceBytesToLoad + estimatedBytesForPendingRequests) - m_totalBytesReceived); if (remainingBytes > 0) // Prevent divide by 0. @@ -173,7 +195,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i percentOfRemainingBytes = 1.0; // For documents that use WebCore's layout system, treat first layout as the half-way point. - bool useClampedMaxProgress = !m_frame->view()->didFirstLayout(); + bool useClampedMaxProgress = !frame->view()->didFirstLayout(); double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue; increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes; m_progressValue += increment; @@ -185,13 +207,16 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i double now = currentTime(); double notifiedProgressTimeDelta = now - m_lastNotifiedProgressTime; + WTF_LOG(Progress, "Progress incremented (%p) - value %f, tracked frames %d", this, m_progressValue, m_numProgressTrackedFrames); double notificationProgressDelta = m_progressValue - m_lastNotifiedProgressValue; - if (notificationProgressDelta >= m_progressNotificationInterval || notifiedProgressTimeDelta >= m_progressNotificationTimeInterval) { + if ((notificationProgressDelta >= m_progressNotificationInterval || + notifiedProgressTimeDelta >= m_progressNotificationTimeInterval) && + m_numProgressTrackedFrames > 0) { if (!m_finalProgressChangedSent) { if (m_progressValue == 1) m_finalProgressChangedSent = true; - m_frame->loader().client()->progressEstimateChanged(m_progressValue); + frame->loader().client()->postProgressEstimateChangedNotification(); m_lastNotifiedProgressValue = m_progressValue; m_lastNotifiedProgressTime = now; diff --git a/Source/core/loader/ProgressTracker.h b/Source/core/loader/ProgressTracker.h index b92ed0651c1..60ca22c5566 100644 --- a/Source/core/loader/ProgressTracker.h +++ b/Source/core/loader/ProgressTracker.h @@ -47,12 +47,13 @@ class ProgressTracker { public: ~ProgressTracker(); - static PassOwnPtr create(LocalFrame*); + static PassOwnPtr create(); + static unsigned long createUniqueIdentifier(); double estimatedProgress() const; - void progressStarted(); - void progressCompleted(); + void progressStarted(LocalFrame*); + void progressCompleted(LocalFrame*); void incrementProgress(unsigned long identifier, const ResourceResponse&); void incrementProgress(unsigned long identifier, const char*, int); @@ -62,12 +63,11 @@ class ProgressTracker { long long totalBytesReceived() const { return m_totalBytesReceived; } private: - ProgressTracker(LocalFrame*); + ProgressTracker(); void reset(); + void finalProgressComplete(); - LocalFrame* m_frame; - bool m_inProgress; long long m_totalPageAndResourceBytesToLoad; long long m_totalBytesReceived; double m_lastNotifiedProgressValue; @@ -76,7 +76,9 @@ class ProgressTracker { double m_progressNotificationTimeInterval; bool m_finalProgressChangedSent; double m_progressValue; + RefPtr m_originatingProgressFrame; + int m_numProgressTrackedFrames; HashMap > m_progressItems; }; diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp index 1f57ff13f17..a5986abd7e8 100644 --- a/Source/core/page/Page.cpp +++ b/Source/core/page/Page.cpp @@ -38,6 +38,7 @@ #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/FrameLoader.h" #include "core/loader/HistoryItem.h" +#include "core/loader/ProgressTracker.h" #include "core/page/AutoscrollController.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" @@ -117,6 +118,7 @@ Page::Page(PageClients& pageClients) , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient)) , m_pointerLockController(PointerLockController::create(this)) , m_historyController(adoptPtr(new HistoryController(this))) + , m_progress(ProgressTracker::create()) , m_undoStack(UndoStack::create()) , m_backForwardClient(pageClients.backForwardClient) , m_editorClient(pageClients.editorClient) diff --git a/Source/core/page/Page.h b/Source/core/page/Page.h index 7248f896cdd..c25fa8d6b31 100644 --- a/Source/core/page/Page.h +++ b/Source/core/page/Page.h @@ -63,6 +63,7 @@ class PageLifecycleNotifier; class PlatformMouseEvent; class PluginData; class PointerLockController; +class ProgressTracker; class Range; class RenderBox; class RenderObject; @@ -160,6 +161,7 @@ class Page FINAL : public Supplementable, public LifecycleContext, p PassRefPtr nonFastScrollableRects(const LocalFrame*); Settings& settings() const { return *m_settings; } + ProgressTracker& progress() const { return *m_progress; } BackForwardClient& backForward() const { return *m_backForwardClient; } UseCounter& useCounter() { return m_useCounter; } @@ -250,6 +252,7 @@ class Page FINAL : public Supplementable, public LifecycleContext, p OwnPtr m_scrollingCoordinator; const OwnPtr m_historyController; + const OwnPtr m_progress; const OwnPtr m_undoStack; RefPtr m_mainFrame; diff --git a/Source/web/FrameLoaderClientImpl.cpp b/Source/web/FrameLoaderClientImpl.cpp index 6597d61caa2..18ed582c866 100644 --- a/Source/web/FrameLoaderClientImpl.cpp +++ b/Source/web/FrameLoaderClientImpl.cpp @@ -64,6 +64,7 @@ #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" #include "core/loader/HistoryItem.h" +#include "core/loader/ProgressTracker.h" #include "core/page/Chrome.h" #include "core/page/EventHandler.h" #include "core/frame/FrameView.h" @@ -492,22 +493,28 @@ void FrameLoaderClientImpl::dispatchWillSubmitForm(HTMLFormElement* form) m_webFrame->client()->willSubmitForm(m_webFrame, WebFormElement(form)); } -void FrameLoaderClientImpl::didStartLoading(LoadStartType loadStartType) +void FrameLoaderClientImpl::postProgressStartedNotification(LoadStartType loadStartType) { - if (m_webFrame->client()) - m_webFrame->client()->didStartLoading(loadStartType == NavigationToDifferentDocument); + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->client()) + webview->client()->didStartLoading(loadStartType == NavigationToDifferentDocument); } -void FrameLoaderClientImpl::progressEstimateChanged(double progressEstimate) +void FrameLoaderClientImpl::postProgressEstimateChangedNotification() { - if (m_webFrame->client()) - m_webFrame->client()->didChangeLoadProgress(progressEstimate); + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->client()) { + webview->client()->didChangeLoadProgress( + m_webFrame, m_webFrame->frame()->page()->progress().estimatedProgress()); + } } -void FrameLoaderClientImpl::didStopLoading() +void FrameLoaderClientImpl::postProgressFinishedNotification() { - if (m_webFrame->client()) - m_webFrame->client()->didStopLoading(); + // FIXME: why might the webview be null? http://b/1234461 + WebViewImpl* webview = m_webFrame->viewImpl(); + if (webview && webview->client()) + webview->client()->didStopLoading(); } void FrameLoaderClientImpl::loadURLExternally(const ResourceRequest& request, NavigationPolicy policy, const String& suggestedName) diff --git a/Source/web/FrameLoaderClientImpl.h b/Source/web/FrameLoaderClientImpl.h index b0833cfee6a..be63721796d 100644 --- a/Source/web/FrameLoaderClientImpl.h +++ b/Source/web/FrameLoaderClientImpl.h @@ -98,9 +98,9 @@ class FrameLoaderClientImpl FINAL : public WebCore::FrameLoaderClient { virtual void dispatchWillRequestResource(WebCore::FetchRequest*) OVERRIDE; virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) OVERRIDE; virtual void dispatchWillSubmitForm(WebCore::HTMLFormElement*) OVERRIDE; - virtual void didStartLoading(WebCore::LoadStartType) OVERRIDE; - virtual void didStopLoading() OVERRIDE; - virtual void progressEstimateChanged(double progressEstimate) OVERRIDE; + virtual void postProgressStartedNotification(WebCore::LoadStartType) OVERRIDE; + virtual void postProgressEstimateChangedNotification() OVERRIDE; + virtual void postProgressFinishedNotification() OVERRIDE; virtual void loadURLExternally(const WebCore::ResourceRequest&, WebCore::NavigationPolicy, const String& suggestedName = String()) OVERRIDE; virtual bool navigateBackForward(int offset) const OVERRIDE; virtual void didAccessInitialDocument() OVERRIDE; diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp index 35555bf8e1e..9645e9a2701 100644 --- a/Source/web/tests/WebFrameTest.cpp +++ b/Source/web/tests/WebFrameTest.cpp @@ -5042,9 +5042,9 @@ TEST_F(WebFrameTest, WebNodeImageContents) // EXPECT_EQ(bitmap.getColor(0, 0), SK_ColorBLUE); } -class TestStartStopCallbackWebFrameClient : public WebFrameClient { +class TestStartStopCallbackWebViewClient : public WebViewClient { public: - TestStartStopCallbackWebFrameClient() + TestStartStopCallbackWebViewClient() : m_startLoadingCount(0) , m_stopLoadingCount(0) , m_differentDocumentStartCount(0) @@ -5076,9 +5076,9 @@ class TestStartStopCallbackWebFrameClient : public WebFrameClient { TEST_F(WebFrameTest, PushStateStartsAndStops) { registerMockedHttpURLLoad("push_state.html"); - TestStartStopCallbackWebFrameClient client; + TestStartStopCallbackWebViewClient client; FrameTestHelpers::WebViewHelper webViewHelper; - webViewHelper.initializeAndLoad(m_baseURL + "push_state.html", true, &client); + webViewHelper.initializeAndLoad(m_baseURL + "push_state.html", true, 0, &client); runPendingTasks(); EXPECT_EQ(client.startLoadingCount(), 2); diff --git a/public/web/WebFrameClient.h b/public/web/WebFrameClient.h index 77948f1439c..2ea883eba0c 100644 --- a/public/web/WebFrameClient.h +++ b/public/web/WebFrameClient.h @@ -167,15 +167,6 @@ class WebFrameClient { // Navigational notifications ------------------------------------------ - // These notifications bracket any loading that occurs in the WebFrame. - virtual void didStartLoading(bool toDifferentDocument) { } - virtual void didStopLoading() { } - - // Notification that some progress was made loading the current frame. - // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully - // loaded). - virtual void didChangeLoadProgress(double loadProgress) { } - // A form submission has been requested, but the page's submit event handler // hasn't yet had a chance to run (and possibly alter/interrupt the submit.) virtual void willSendSubmitEvent(WebLocalFrame*, const WebFormElement&) { } diff --git a/public/web/WebViewClient.h b/public/web/WebViewClient.h index 42e6f4691ff..cb113b08739 100644 --- a/public/web/WebViewClient.h +++ b/public/web/WebViewClient.h @@ -146,6 +146,16 @@ class WebViewClient : virtual public WebWidgetClient { // will never be called. virtual bool enumerateChosenDirectory(const WebString& path, WebFileChooserCompletion*) { return false; } + // Navigational -------------------------------------------------------- + + // These notifications bracket any loading that occurs in the WebView. + virtual void didStartLoading(bool toDifferentDocument) { } + virtual void didStopLoading() { } + + // Notification that some progress was made loading the current page. + // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully + // loaded). + virtual void didChangeLoadProgress(WebLocalFrame*, double loadProgress) { } // Editing -------------------------------------------------------------