diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 23:06:19 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 23:06:19 +0000 |
commit | 36b9a6ba9d3b3768a1862371ebe9a911ad48d5b1 (patch) | |
tree | be7491fad42db90898b9b267d43b3d35c44c2d0a /chrome/browser/gtk | |
parent | 6c244119e226e5b7e4b17895b69d23bc9c0ef59a (diff) | |
download | chromium_src-36b9a6ba9d3b3768a1862371ebe9a911ad48d5b1.zip chromium_src-36b9a6ba9d3b3768a1862371ebe9a911ad48d5b1.tar.gz chromium_src-36b9a6ba9d3b3768a1862371ebe9a911ad48d5b1.tar.bz2 |
Disable the stop button when the user is hovering it and the page finishes loading, so we don't look like we stay loading forever. This change only does this for Mac and Windows, as GTK is going to be trickier.
This also fixes a pair of other bugs on Windows and Linux:
* Because we were setting the timer after telling the browser to reload, and the browser was calling us back synchronously, the timer had no effect.
* Because the timer firing changed modes with |force| set to true, if the page finished loading before the timer fired, the timer would flip the button back to reload.
BUG=46981
TEST=Hover the reload button and hit F5. When the page finishes loading, the stop button should become disabled. Mousing away should change it to an enabled reload button.
Review URL: http://codereview.chromium.org/3198005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/reload_button_gtk.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/gtk/reload_button_gtk.cc b/chrome/browser/gtk/reload_button_gtk.cc index da819af..15f44b7 100644 --- a/chrome/browser/gtk/reload_button_gtk.cc +++ b/chrome/browser/gtk/reload_button_gtk.cc @@ -95,7 +95,7 @@ void ReloadButtonGtk::Observe(NotificationType type, } void ReloadButtonGtk::OnButtonTimer() { - ChangeMode(intended_mode_, true); + ChangeMode(intended_mode_, false); } void ReloadButtonGtk::OnClicked(GtkWidget* sender) { @@ -130,9 +130,6 @@ void ReloadButtonGtk::OnClicked(GtkWidget* sender) { location_bar_->Revert(); } - if (browser_) - browser_->ExecuteCommandWithDisposition(command, disposition); - // Figure out the system double-click time. if (button_delay_ == 0) { GtkSettings* settings = gtk_settings_get_default(); @@ -142,11 +139,15 @@ void ReloadButtonGtk::OnClicked(GtkWidget* sender) { // Start a timer - while this timer is running, the reload button cannot be // changed to a stop button. We do not set |intended_mode_| to MODE_STOP - // here as we want to wait for the browser to tell us that it has started - // loading (and this may occur only after some delay). + // here as the browser will do that when it actually starts loading (which + // may happen synchronously, thus the need to do this before telling the + // browser to execute the reload command). timer_.Stop(); timer_.Start(base::TimeDelta::FromMilliseconds(button_delay_), this, &ReloadButtonGtk::OnButtonTimer); + + if (browser_) + browser_->ExecuteCommandWithDisposition(command, disposition); } } |