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

Unified Diff: chrome/browser/views/reload_button.cc

Issue 3198005: Disable the stop button when the user is hovering it and the page finishes lo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome/browser/gtk/reload_button_gtk.cc ('k') | chrome/browser/views/toolbar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/reload_button.cc
===================================================================
--- chrome/browser/views/reload_button.cc (revision 56775)
+++ chrome/browser/views/reload_button.cc (working copy)
@@ -32,11 +32,18 @@
// If the change is forced, or the user isn't hovering the icon, or it's safe
// to change it to the other image type, make the change immediately;
// otherwise we'll let it happen later.
- if (force || (state() != BS_HOT) || ((mode == MODE_STOP) ?
+ if (force || !IsMouseHovered() || ((mode == MODE_STOP) ?
!timer_.IsRunning() : (visible_mode_ != MODE_STOP))) {
timer_.Stop();
SetToggled(mode == MODE_STOP);
visible_mode_ = mode;
+ SetEnabled(true);
+
+ // We want to disable the button if we're preventing a change from stop to
+ // reload due to hovering, but not if we're preventing a change from reload to
+ // stop due to the timer running. (There is no disabled reload state.)
+ } else if (visible_mode_ != MODE_RELOAD) {
+ SetEnabled(false);
}
}
@@ -74,17 +81,16 @@
location_bar_->Revert();
}
- browser_->ExecuteCommandWithDisposition(command, disposition);
-
- // Stop the timer.
- timer_.Stop();
-
// 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(GetDoubleClickTimeMS()),
this, &ReloadButton::OnButtonTimer);
+
+ browser_->ExecuteCommandWithDisposition(command, disposition);
}
}
@@ -107,5 +113,5 @@
// ReloadButton, private:
void ReloadButton::OnButtonTimer() {
- ChangeMode(intended_mode_, true);
+ ChangeMode(intended_mode_, false);
}
« no previous file with comments | « chrome/browser/gtk/reload_button_gtk.cc ('k') | chrome/browser/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698