summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/dropdown_bar_host.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 19:48:52 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 19:48:52 +0000
commitf4cce836e37b43b09e1f2d0f300f20598275f8aa (patch)
treee02bdd3dfd079ec4f57154546f7edf00c97792b9 /chrome/browser/views/dropdown_bar_host.cc
parent8bc8c9bd128aa1af7df2c5a2c04e1f2eb8eb1fd5 (diff)
downloadchromium_src-f4cce836e37b43b09e1f2d0f300f20598275f8aa.zip
chromium_src-f4cce836e37b43b09e1f2d0f300f20598275f8aa.tar.gz
chromium_src-f4cce836e37b43b09e1f2d0f300f20598275f8aa.tar.bz2
Use dropdown bar for compact location bar.
* Refactored CompactLocationBar to Host/View to use DropdownBarHost/View. * Changed the logic to show/hide. Per cole's request, losing focus now hides the location bar. Following features are not implemented yet. * Window cripping while animating. * Adjust location when toolbar is shown (it's always under tab) * clipping autocomplete dropdown. Timer code is no longer used right now, but is left intentionally as we may put it back. BUG=None TEST=None Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=35674 Review URL: http://codereview.chromium.org/525018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35929 0039d316-1c4b-4281-b951-d872f2087c98
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.
}