diff options
author | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-30 03:29:57 +0000 |
---|---|---|
committer | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-30 03:29:57 +0000 |
commit | f57bce18d5e58f03e2b7355a9f8dcfb56190340c (patch) | |
tree | 0115ca924651b1b6f561dc377a66ce2b9e9bd149 | |
parent | 4e180a9e794478dde49e896a3069daaddd14860f (diff) | |
download | chromium_src-f57bce18d5e58f03e2b7355a9f8dcfb56190340c.zip chromium_src-f57bce18d5e58f03e2b7355a9f8dcfb56190340c.tar.gz chromium_src-f57bce18d5e58f03e2b7355a9f8dcfb56190340c.tar.bz2 |
Revert 260143 "Fix pushState causing stop/reload button and favi..."
> Fix pushState causing stop/reload button and favicon to flicker.
>
> BUG=50298
>
> Review URL: https://codereview.chromium.org/161113002
TBR=japhet@chromium.org
Review URL: https://codereview.chromium.org/216313009
git-svn-id: svn://svn.chromium.org/chrome/branches/1916/src@260413 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 48 insertions, 148 deletions
diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.cc b/chrome/browser/android/chrome_web_contents_delegate_android.cc index a5c2e8c..3f6aa0e 100644 --- a/chrome/browser/android/chrome_web_contents_delegate_android.cc +++ b/chrome/browser/android/chrome_web_contents_delegate_android.cc @@ -88,10 +88,9 @@ bool RegisterChromeWebContentsDelegateAndroid(JNIEnv* env) { } void ChromeWebContentsDelegateAndroid::LoadingStateChanged( - WebContents* source, bool to_different_document) { + WebContents* source) { bool has_stopped = source == NULL || !source->IsLoading(); - WebContentsDelegateAndroid::LoadingStateChanged( - source, to_different_document); + WebContentsDelegateAndroid::LoadingStateChanged(source); LoadProgressChanged(source, has_stopped ? 1 : 0); } diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.h b/chrome/browser/android/chrome_web_contents_delegate_android.h index 2b2bef1..ae915885 100644 --- a/chrome/browser/android/chrome_web_contents_delegate_android.h +++ b/chrome/browser/android/chrome_web_contents_delegate_android.h @@ -37,8 +37,7 @@ class ChromeWebContentsDelegateAndroid ChromeWebContentsDelegateAndroid(JNIEnv* env, jobject obj); virtual ~ChromeWebContentsDelegateAndroid(); - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void RunFileChooser(content::WebContents* web_contents, const content::FileChooserParams& params) OVERRIDE; diff --git a/chrome/browser/chromeos/login/captive_portal_view.cc b/chrome/browser/chromeos/login/captive_portal_view.cc index f20e759..7b3c709 100644 --- a/chrome/browser/chromeos/login/captive_portal_view.cc +++ b/chrome/browser/chromeos/login/captive_portal_view.cc @@ -84,14 +84,14 @@ void CaptivePortalView::NavigationStateChanged( // Note, |url| will be empty for "client3.google.com/generate_204" page. if (!redirected_ && url != GURL::EmptyGURL() && url != GURL(CaptivePortalStartURL())) { + DLOG(INFO) << CaptivePortalStartURL() << " vs " << url.spec(); redirected_ = true; proxy_->OnRedirected(); } } -void CaptivePortalView::LoadingStateChanged(content::WebContents* source, - bool to_different_document) { - SimpleWebViewDialog::LoadingStateChanged(source, to_different_document); +void CaptivePortalView::LoadingStateChanged(content::WebContents* source) { + SimpleWebViewDialog::LoadingStateChanged(source); // TODO(nkostylev): Fix case of no connectivity, check HTTP code returned. // Disable this heuristic as it has false positives. // Relying on just shill portal check to close dialog is fine. diff --git a/chrome/browser/chromeos/login/captive_portal_view.h b/chrome/browser/chromeos/login/captive_portal_view.h index 1c8ef90..1a8b34e 100644 --- a/chrome/browser/chromeos/login/captive_portal_view.h +++ b/chrome/browser/chromeos/login/captive_portal_view.h @@ -31,8 +31,7 @@ class CaptivePortalView : public SimpleWebViewDialog { // Overridden from content::WebContentsDelegate: virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; private: // Contains CaptivePortalWindowProxy to be notified when redirection state is diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.cc b/chrome/browser/chromeos/login/simple_web_view_dialog.cc index 607481b..14b38de 100644 --- a/chrome/browser/chromeos/login/simple_web_view_dialog.cc +++ b/chrome/browser/chromeos/login/simple_web_view_dialog.cc @@ -265,10 +265,9 @@ void SimpleWebViewDialog::NavigationStateChanged( } } -void SimpleWebViewDialog::LoadingStateChanged(WebContents* source, - bool to_different_document) { +void SimpleWebViewDialog::LoadingStateChanged(WebContents* source) { bool is_loading = source->IsLoading(); - UpdateReload(is_loading && to_different_document, false); + UpdateReload(is_loading, false); command_updater_->UpdateCommandEnabled(IDC_STOP, is_loading); } diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.h b/chrome/browser/chromeos/login/simple_web_view_dialog.h index 68b91f8..69f689b 100644 --- a/chrome/browser/chromeos/login/simple_web_view_dialog.h +++ b/chrome/browser/chromeos/login/simple_web_view_dialog.h @@ -70,8 +70,7 @@ class SimpleWebViewDialog : public views::ButtonListener, // Implements content::WebContentsDelegate: virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; // Implements LocationBarView::Delegate: virtual content::WebContents* GetWebContents() OVERRIDE; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 85824f4..9a802f8 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -914,7 +914,7 @@ void Browser::TabInsertedAt(WebContents* contents, // Make sure the loading state is updated correctly, otherwise the throbber // won't start if the page is loading. - LoadingStateChanged(contents, true); + LoadingStateChanged(contents); interstitial_observers_.push_back(new InterstitialObserver(this, contents)); @@ -1339,14 +1339,13 @@ void Browser::DeactivateContents(WebContents* contents) { window_->Deactivate(); } -void Browser::LoadingStateChanged(WebContents* source, - bool to_different_document) { +void Browser::LoadingStateChanged(WebContents* source) { window_->UpdateLoadingAnimations(tab_strip_model_->TabsAreLoading()); window_->UpdateTitleBar(); WebContents* selected_contents = tab_strip_model_->GetActiveWebContents(); if (source == selected_contents) { - bool is_loading = source->IsLoading() && to_different_document; + bool is_loading = source->IsLoading(); command_controller_->LoadingStateChanged(is_loading, false); if (GetStatusBubble()) { GetStatusBubble()->SetStatus(CoreTabHelper::FromWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 0e6d0bb..d66ac0d 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -549,8 +549,7 @@ class Browser : public TabStripModelObserver, bool* was_blocked) OVERRIDE; virtual void ActivateContents(content::WebContents* contents) OVERRIDE; virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; virtual void MoveContents(content::WebContents* source, const gfx::Rect& pos) OVERRIDE; diff --git a/chrome/browser/ui/browser_tab_strip_model_delegate.cc b/chrome/browser/ui/browser_tab_strip_model_delegate.cc index 730a2ad..ab08564 100644 --- a/chrome/browser/ui/browser_tab_strip_model_delegate.cc +++ b/chrome/browser/ui/browser_tab_strip_model_delegate.cc @@ -77,7 +77,7 @@ Browser* BrowserTabStripModelDelegate::CreateNewStripWithContents( // won't start if the page is loading. // TODO(beng): find a better way of doing this. static_cast<content::WebContentsDelegate*>(browser)-> - LoadingStateChanged(item.web_contents, true); + LoadingStateChanged(item.web_contents); } return browser; diff --git a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm index db0be89..3e61033 100644 --- a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm +++ b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm @@ -73,8 +73,7 @@ public: const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; private: WebDialogWindowController* controller_; // weak @@ -241,7 +240,7 @@ void WebDialogWindowDelegateBridge::AddNewContents( } void WebDialogWindowDelegateBridge::LoadingStateChanged( - content::WebContents* source, bool to_different_document) { + content::WebContents* source) { if (delegate_) delegate_->OnLoadingStateChanged(source); } diff --git a/chrome/browser/ui/panels/panel_host.cc b/chrome/browser/ui/panels/panel_host.cc index 9d8bbd3..89c1863 100644 --- a/chrome/browser/ui/panels/panel_host.cc +++ b/chrome/browser/ui/panels/panel_host.cc @@ -160,9 +160,8 @@ void PanelHost::DeactivateContents(content::WebContents* contents) { panel_->Deactivate(); } -void PanelHost::LoadingStateChanged(content::WebContents* source, - bool to_different_document) { - bool is_loading = source->IsLoading() && to_different_document; +void PanelHost::LoadingStateChanged(content::WebContents* source) { + bool is_loading = source->IsLoading(); panel_->LoadingStateChanged(is_loading); } diff --git a/chrome/browser/ui/panels/panel_host.h b/chrome/browser/ui/panels/panel_host.h index d383f63..37ab05b 100644 --- a/chrome/browser/ui/panels/panel_host.h +++ b/chrome/browser/ui/panels/panel_host.h @@ -61,8 +61,7 @@ class PanelHost : public content::WebContentsDelegate, bool* was_blocked) OVERRIDE; virtual void ActivateContents(content::WebContents* contents) OVERRIDE; virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; virtual void MoveContents(content::WebContents* source, const gfx::Rect& pos) OVERRIDE; diff --git a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc index 767db59..2caef65 100644 --- a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc +++ b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc @@ -69,7 +69,7 @@ TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) { content::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false); test_web_contents_delegate_->NavigationStateChanged(NULL, 0); test_web_contents_delegate_->ActivateContents(NULL); - test_web_contents_delegate_->LoadingStateChanged(NULL, true); + test_web_contents_delegate_->LoadingStateChanged(NULL); test_web_contents_delegate_->CloseContents(NULL); test_web_contents_delegate_->UpdateTargetURL(NULL, 0, GURL()); test_web_contents_delegate_->MoveContents(NULL, gfx::Rect()); diff --git a/components/web_contents_delegate_android/web_contents_delegate_android.cc b/components/web_contents_delegate_android/web_contents_delegate_android.cc index a4f8213..d12a23f 100644 --- a/components/web_contents_delegate_android/web_contents_delegate_android.cc +++ b/components/web_contents_delegate_android/web_contents_delegate_android.cc @@ -139,8 +139,7 @@ void WebContentsDelegateAndroid::DeactivateContents(WebContents* contents) { // to focus. Not implemented on Android. } -void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source, - bool to_different_document) { +void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); if (obj.is_null()) diff --git a/components/web_contents_delegate_android/web_contents_delegate_android.h b/components/web_contents_delegate_android/web_contents_delegate_android.h index 4c3568a..d6720280 100644 --- a/components/web_contents_delegate_android/web_contents_delegate_android.h +++ b/components/web_contents_delegate_android/web_contents_delegate_android.h @@ -62,8 +62,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { unsigned changed_flags) OVERRIDE; virtual void ActivateContents(content::WebContents* contents) OVERRIDE; virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void LoadProgressChanged(content::WebContents* source, double load_progress) OVERRIDE; virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE; diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc index fd93639..885d57b 100644 --- a/content/browser/frame_host/interstitial_page_impl.cc +++ b/content/browser/frame_host/interstitial_page_impl.cc @@ -458,7 +458,7 @@ void InterstitialPageImpl::DidNavigate( // an interstitial would hang. web_contents_was_loading_ = controller_->delegate()->IsLoading(); controller_->delegate()->SetIsLoading( - controller_->delegate()->GetRenderViewHost(), false, true, NULL); + controller_->delegate()->GetRenderViewHost(), false, NULL); } void InterstitialPageImpl::UpdateTitle( @@ -603,7 +603,7 @@ void InterstitialPageImpl::Proceed() { // Resumes the throbber, if applicable. if (web_contents_was_loading_) controller_->delegate()->SetIsLoading( - controller_->delegate()->GetRenderViewHost(), true, true, NULL); + controller_->delegate()->GetRenderViewHost(), true, NULL); // If this is a new navigation, the old page is going away, so we cancel any // blocked requests for it. If it is not a new navigation, then it means the diff --git a/content/browser/frame_host/navigation_controller_delegate.h b/content/browser/frame_host/navigation_controller_delegate.h index 77bc622..404e927 100644 --- a/content/browser/frame_host/navigation_controller_delegate.h +++ b/content/browser/frame_host/navigation_controller_delegate.h @@ -71,7 +71,6 @@ class NavigationControllerDelegate { virtual void DetachInterstitialPage() = 0; virtual void SetIsLoading(RenderViewHost* render_view_host, bool is_loading, - bool to_different_document, LoadNotificationDetails* details) = 0; }; diff --git a/content/browser/frame_host/render_frame_host_delegate.h b/content/browser/frame_host/render_frame_host_delegate.h index f5e00ab..b6ebfa9 100644 --- a/content/browser/frame_host/render_frame_host_delegate.h +++ b/content/browser/frame_host/render_frame_host_delegate.h @@ -32,10 +32,7 @@ class CONTENT_EXPORT RenderFrameHostDelegate { // The top-level RenderFrame began loading a new page. This corresponds to // Blink's notion of the throbber starting. - // |to_different_document| will be true unless the load is a fragment - // navigation, or triggered by history.pushState/replaceState. - virtual void DidStartLoading(RenderFrameHost* render_frame_host, - bool to_different_document) {} + virtual void DidStartLoading(RenderFrameHost* render_frame_host) {} // The top-level RenderFrame stopped loading a page. This corresponds to // Blink's notion of the throbber stopping. diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index bf08aff..147dd62 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -505,8 +505,8 @@ void RenderFrameHostImpl::SwapOut() { } } -void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { - delegate_->DidStartLoading(this, to_different_document); +void RenderFrameHostImpl::OnDidStartLoading() { + delegate_->DidStartLoading(this); } void RenderFrameHostImpl::OnDidStopLoading() { @@ -664,7 +664,7 @@ void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { // Blink doesn't send throb notifications for JavaScript URLs, so we // don't want to either. if (!params.url.SchemeIs(kJavaScriptScheme)) - delegate_->DidStartLoading(this, true); + delegate_->DidStartLoading(this); } void RenderFrameHostImpl::NavigateToURL(const GURL& url) { diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 483783e..5d4951a 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h @@ -140,9 +140,7 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { // TODO(nasko): This method is public so RenderViewHostImpl::Navigate can // call it directly. It should be made private once Navigate moves here. - // |to_different_document| will be true unless the load is a fragment - // navigation, or triggered by history.pushState/replaceState. - void OnDidStartLoading(bool to_different_document); + void OnDidStartLoading(); // Sends the given navigation message. Use this rather than sending it // yourself since this does the internal bookkeeping described below. This diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 38b91604..195edc3 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2614,7 +2614,6 @@ void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() { // loading, or done loading. void WebContentsImpl::SetIsLoading(RenderViewHost* render_view_host, bool is_loading, - bool to_different_document, LoadNotificationDetails* details) { if (is_loading == is_loading_) return; @@ -2633,7 +2632,7 @@ void WebContentsImpl::SetIsLoading(RenderViewHost* render_view_host, waiting_for_response_ = is_loading; if (delegate_) - delegate_->LoadingStateChanged(this, to_different_document); + delegate_->LoadingStateChanged(this); NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); std::string url = (details ? details->url.possibly_invalid_spec() : "NULL"); @@ -2903,7 +2902,7 @@ void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh, dialog_manager_->CancelActiveAndPendingDialogs(this); ClearPowerSaveBlockers(rvh); - SetIsLoading(rvh, false, true, NULL); + SetIsLoading(rvh, false, NULL); NotifyDisconnected(); SetIsCrashed(status, error_code); GetView()->OnTabCrashed(GetCrashedStatus(), crashed_error_code_); @@ -3032,10 +3031,8 @@ void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { delegate_->MoveContents(this, new_bounds); } -void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, - bool to_different_document) { - SetIsLoading(render_frame_host->GetRenderViewHost(), true, - to_different_document, NULL); +void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host) { + SetIsLoading(render_frame_host->GetRenderViewHost(), true, NULL); } void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { @@ -3060,8 +3057,7 @@ void WebContentsImpl::DidStopLoading(RenderFrameHost* render_frame_host) { controller_.GetCurrentEntryIndex())); } - SetIsLoading(render_frame_host->GetRenderViewHost(), false, true, - details.get()); + SetIsLoading(render_frame_host->GetRenderViewHost(), false, details.get()); } void WebContentsImpl::DidCancelLoading() { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index ae72bdf..e6135d1 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -304,8 +304,7 @@ class CONTENT_EXPORT WebContentsImpl const IPC::Message& message) OVERRIDE; virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; - virtual void DidStartLoading(RenderFrameHost* render_frame_host, - bool to_different_document) OVERRIDE; + virtual void DidStartLoading(RenderFrameHost* render_frame_host) OVERRIDE; virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE; virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE; virtual void ShowContextMenu(RenderFrameHost* render_frame_host, @@ -590,7 +589,6 @@ class CONTENT_EXPORT WebContentsImpl // (but can be null if not applicable). virtual void SetIsLoading(RenderViewHost* render_view_host, bool is_loading, - bool to_different_document, LoadNotificationDetails* details) OVERRIDE; typedef base::Callback<void(WebContents*)> CreatedCallback; diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index 3949928..0754799 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/web_contents/web_contents_impl.h" @@ -150,31 +149,6 @@ class RenderViewSizeObserver : public WebContentsObserver { gfx::Size rwhv_create_size_; }; -class LoadingStateChangedDelegate : public WebContentsDelegate { - public: - LoadingStateChangedDelegate() - : loadingStateChangedCount_(0) - , loadingStateToDifferentDocumentCount_(0) { - } - - // WebContentsDelgate: - virtual void LoadingStateChanged(WebContents* contents, - bool to_different_document) OVERRIDE { - loadingStateChangedCount_++; - if (to_different_document) - loadingStateToDifferentDocumentCount_++; - } - - int loadingStateChangedCount() const { return loadingStateChangedCount_; } - int loadingStateToDifferentDocumentCount() const { - return loadingStateToDifferentDocumentCount_; - } - - private: - int loadingStateChangedCount_; - int loadingStateToDifferentDocumentCount_; -}; - // See: http://crbug.com/298193 #if defined(OS_WIN) #define MAYBE_DidStopLoadingDetails DISABLED_DidStopLoadingDetails @@ -413,29 +387,4 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, EXPECT_EQ(observer.last_rfh(), shell()->web_contents()->GetMainFrame()); } -IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, - LoadingStateChangedForSameDocumentNavigation) { - ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); - scoped_ptr<LoadingStateChangedDelegate> delegate( - new LoadingStateChangedDelegate()); - shell()->web_contents()->SetDelegate(delegate.get()); - - LoadStopNotificationObserver load_observer( - &shell()->web_contents()->GetController()); - TitleWatcher title_watcher(shell()->web_contents(), - base::ASCIIToUTF16("pushState")); - NavigateToURL(shell(), embedded_test_server()->GetURL("/push_state.html")); - load_observer.Wait(); - base::string16 title = title_watcher.WaitAndGetTitle(); - ASSERT_EQ(title, base::ASCIIToUTF16("pushState")); - - // LoadingStateChanged should be called 4 times: start and stop for the - // initial load of push_state.html, and start and stop for the "navigation" - // triggered by history.pushState(). However, the start notification for the - // history.pushState() navigation should set to_different_document to false. - EXPECT_EQ("pushState", shell()->web_contents()->GetURL().ref()); - EXPECT_EQ(4, delegate->loadingStateChangedCount()); - EXPECT_EQ(3, delegate->loadingStateToDifferentDocumentCount()); -} - } // namespace content diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index c64490b..d5fc7ca 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h @@ -385,10 +385,7 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_DidFailLoadWithError, // Sent when the renderer starts loading the page. This corresponds to // Blink's notion of the throbber starting. Note that sometimes you may get // duplicates of these during a single load. -// |to_different_document| will be true unless the load is a fragment -// navigation, or triggered by history.pushState/replaceState. -IPC_MESSAGE_ROUTED1(FrameHostMsg_DidStartLoading, - bool /* to_different_document */) +IPC_MESSAGE_ROUTED0(FrameHostMsg_DidStartLoading) // Sent when the renderer is done loading a page. This corresponds to Blink's // notion of the throbber stopping. diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index b869a52..2dd2418 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -112,10 +112,7 @@ class CONTENT_EXPORT WebContentsDelegate { // Notifies the delegate that this contents is starting or is done loading // some resource. The delegate should use this notification to represent // loading feedback. See WebContents::IsLoading() - // |to_different_document| will be true unless the load is a fragment - // navigation, or triggered by history.pushState/replaceState. - virtual void LoadingStateChanged(WebContents* source, - bool to_different_document) {} + virtual void LoadingStateChanged(WebContents* source) {} // Notifies the delegate that the page has made some progress loading. // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 6ec073c..bfed42d 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -2603,7 +2603,7 @@ void RenderFrameImpl::didStartLoading(bool to_different_document) { render_view_->FrameDidStartLoading(frame_); if (!view_was_loading) - Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); + Send(new FrameHostMsg_DidStartLoading(routing_id_)); } void RenderFrameImpl::didStopLoading() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index a032b57..3295358 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -101,8 +101,6 @@ class CONTENT_EXPORT RenderFrameImpl // TODO(nasko): Those are page-level methods at this time and come from // WebViewClient. We should move them to be WebFrameClient calls and put // logic in the browser side to balance starts/stops. - // |to_different_document| will be true unless the load is a fragment - // navigation, or triggered by history.pushState/replaceState. virtual void didStartLoading(bool to_different_document); virtual void didStopLoading(); virtual void didChangeLoadProgress(double load_progress); diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index b19ad1f..6549123 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc @@ -205,14 +205,13 @@ void Shell::Stop() { web_contents_->GetView()->Focus(); } -void Shell::UpdateNavigationControls(bool to_different_document) { +void Shell::UpdateNavigationControls() { int current_index = web_contents_->GetController().GetCurrentEntryIndex(); int max_index = web_contents_->GetController().GetEntryCount() - 1; PlatformEnableUIControl(BACK_BUTTON, current_index > 0); PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); - PlatformEnableUIControl(STOP_BUTTON, - to_different_document && web_contents_->IsLoading()); + PlatformEnableUIControl(STOP_BUTTON, web_contents_->IsLoading()); } void Shell::ShowDevTools() { @@ -267,9 +266,8 @@ WebContents* Shell::OpenURLFromTab(WebContents* source, return source; } -void Shell::LoadingStateChanged(WebContents* source, - bool to_different_document) { - UpdateNavigationControls(to_different_document); +void Shell::LoadingStateChanged(WebContents* source) { + UpdateNavigationControls(); PlatformSetIsLoading(source->IsLoading()); } diff --git a/content/shell/browser/shell.h b/content/shell/browser/shell.h index 1156f21..5248199 100644 --- a/content/shell/browser/shell.h +++ b/content/shell/browser/shell.h @@ -65,7 +65,7 @@ class Shell : public WebContentsDelegate, void GoBackOrForward(int offset); void Reload(); void Stop(); - void UpdateNavigationControls(bool to_different_document); + void UpdateNavigationControls(); void Close(); void ShowDevTools(); void ShowDevToolsForElementAt(int x, int y); @@ -119,8 +119,7 @@ class Shell : public WebContentsDelegate, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) OVERRIDE; - virtual void LoadingStateChanged(WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(WebContents* source) OVERRIDE; #if defined(OS_ANDROID) virtual void LoadProgressChanged(WebContents* source, double progress) OVERRIDE; diff --git a/content/test/data/push_state.html b/content/test/data/push_state.html deleted file mode 100644 index 22178ee..0000000 --- a/content/test/data/push_state.html +++ /dev/null @@ -1,12 +0,0 @@ -<html> -<head> -<script> -window.onload = function() { - setTimeout(function() { - history.pushState("", "", "#pushState"); - document.title = "pushState"; - }, 0); -} -</script> -</head> -</html> diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index 55cab77..900c850 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc @@ -129,7 +129,7 @@ void TestWebContents::NavigateAndCommit(const GURL& url) { } void TestWebContents::TestSetIsLoading(bool value) { - SetIsLoading(GetRenderViewHost(), value, true, NULL); + SetIsLoading(GetRenderViewHost(), value, NULL); } void TestWebContents::CommitPendingNavigation() { diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc index 949c82a..98da5ad 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -324,8 +324,7 @@ void WebDialogView::AddNewContents(content::WebContents* source, was_blocked); } -void WebDialogView::LoadingStateChanged(content::WebContents* source, - bool to_different_document) { +void WebDialogView::LoadingStateChanged(content::WebContents* source) { if (delegate_) delegate_->OnLoadingStateChanged(source); } diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h index 902aa32..51d67eb 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h @@ -110,8 +110,7 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) OVERRIDE; - virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) OVERRIDE; |