summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/dropdown_bar_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/dropdown_bar_host.cc')
-rw-r--r--chrome/browser/views/dropdown_bar_host.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/views/dropdown_bar_host.cc b/chrome/browser/views/dropdown_bar_host.cc
index a921b95..4e3e690 100644
--- a/chrome/browser/views/dropdown_bar_host.cc
+++ b/chrome/browser/views/dropdown_bar_host.cc
@@ -26,7 +26,8 @@ bool DropdownBarHost::disable_animations_during_testing_ = false;
DropdownBarHost::DropdownBarHost(BrowserView* browser_view)
: browser_view_(browser_view),
animation_offset_(0),
- esc_accel_target_registered_(false) {
+ esc_accel_target_registered_(false),
+ is_visible_(false) {
}
void DropdownBarHost::Init(DropdownBarView* view) {
@@ -64,11 +65,16 @@ void DropdownBarHost::Show(bool animate) {
focus_tracker_.reset(new views::ExternalFocusTracker(view_, focus_manager_));
if (!animate || disable_animations_during_testing_) {
+ is_visible_ = true;
animation_->Reset(1);
AnimationProgressed(animation_.get());
} else {
- animation_->Reset();
- animation_->Show();
+ if (!is_visible_) {
+ // Don't re-start the animation.
+ is_visible_ = true;
+ animation_->Reset();
+ animation_->Show();
+ }
}
}
@@ -81,10 +87,14 @@ bool DropdownBarHost::IsAnimating() const {
}
void DropdownBarHost::Hide(bool animate) {
+ if (!IsVisible())
+ return;
if (animate && !disable_animations_during_testing_) {
animation_->Reset(1.0);
animation_->Hide();
} else {
+ StopAnimation();
+ is_visible_ = false;
host_->Hide();
}
}
@@ -94,7 +104,7 @@ void DropdownBarHost::StopAnimation() {
}
bool DropdownBarHost::IsVisible() const {
- return host_->IsVisible();
+ return is_visible_;
}
////////////////////////////////////////////////////////////////////////////////
@@ -149,6 +159,7 @@ void DropdownBarHost::AnimationEnded(const Animation* animation) {
if (!animation_->IsShowing()) {
// Animation has finished closing.
host_->Hide();
+ is_visible_ = false;
} else {
// Animation has finished opening.
}