| Index: chrome/browser/views/go_button.cc
|
| ===================================================================
|
| --- chrome/browser/views/go_button.cc (revision 13668)
|
| +++ chrome/browser/views/go_button.cc (working copy)
|
| @@ -32,33 +32,17 @@
|
| stop_timer_.RevokeAll();
|
| }
|
|
|
| -void GoButton::ChangeMode(Mode mode) {
|
| - stop_timer_.RevokeAll();
|
| -
|
| - SetToggled(mode == MODE_STOP);
|
| +void GoButton::ChangeMode(Mode mode, bool force) {
|
| intended_mode_ = mode;
|
| - visible_mode_ = mode;
|
| -}
|
|
|
| -void GoButton::ScheduleChangeMode(Mode mode) {
|
| - if (mode == MODE_STOP) {
|
| - // If we still have a timer running, we can't yet change to a stop sign,
|
| - // so we'll queue up the change for when the timer expires or for when
|
| - // the mouse exits the button.
|
| - if (!stop_timer_.empty() && state() == BS_HOT) {
|
| - intended_mode_ = MODE_STOP;
|
| - } else {
|
| - ChangeMode(MODE_STOP);
|
| - }
|
| - } else {
|
| - // If we want to change the button to a go button, but the user's mouse
|
| - // is hovering, don't change the mode just yet - this prevents the
|
| - // stop button changing to a go under the user's mouse cursor.
|
| - if (visible_mode_ == MODE_STOP && state() == BS_HOT) {
|
| - intended_mode_ = MODE_GO;
|
| - } else {
|
| - ChangeMode(MODE_GO);
|
| - }
|
| + // 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) ?
|
| + stop_timer_.empty() : (visible_mode_ != MODE_STOP))) {
|
| + stop_timer_.RevokeAll();
|
| + SetToggled(mode == MODE_STOP);
|
| + visible_mode_ = mode;
|
| }
|
| }
|
|
|
| @@ -71,7 +55,7 @@
|
|
|
| // The user has clicked, so we can feel free to update the button,
|
| // even if the mouse is still hovering.
|
| - ChangeMode(MODE_GO);
|
| + ChangeMode(MODE_GO, true);
|
| } else if (visible_mode_ == MODE_GO && stop_timer_.empty()) {
|
| // If the go button is visible and not within the double click timer, go.
|
| browser_->Go(event_utils::DispositionFromEventFlags(mouse_event_flags()));
|
| @@ -98,9 +82,7 @@
|
| // GoButton, View overrides:
|
|
|
| void GoButton::OnMouseExited(const views::MouseEvent& e) {
|
| - if (visible_mode_ != intended_mode_)
|
| - ChangeMode(intended_mode_);
|
| -
|
| + ChangeMode(intended_mode_, true);
|
| if (state() != BS_DISABLED)
|
| SetState(BS_NORMAL);
|
| }
|
| @@ -140,8 +122,6 @@
|
| // GoButton, private:
|
|
|
| void GoButton::OnButtonTimer() {
|
| - if (intended_mode_ != visible_mode_)
|
| - ChangeMode(intended_mode_);
|
| -
|
| stop_timer_.RevokeAll();
|
| + ChangeMode(intended_mode_, true);
|
| }
|
|
|