summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/dropdown_bar_host.cc19
-rw-r--r--chrome/browser/views/dropdown_bar_host.h15
-rw-r--r--chrome/browser/views/find_bar_host.cc2
-rw-r--r--chrome/browser/views/frame/browser_view.cc3
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc4
5 files changed, 34 insertions, 9 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.
}
diff --git a/chrome/browser/views/dropdown_bar_host.h b/chrome/browser/views/dropdown_bar_host.h
index c15585f..58dcc17 100644
--- a/chrome/browser/views/dropdown_bar_host.h
+++ b/chrome/browser/views/dropdown_bar_host.h
@@ -84,13 +84,13 @@ class DropdownBarHost : public views::AcceleratorTarget,
// having to poll it while it animates to open/closed status.
static bool disable_animations_during_testing_;
+ // Returns the browser view that the dropdown belongs to.
+ BrowserView* browser_view() const { return browser_view_; }
+
protected:
// Returns the dropdown bar view.
DropdownBarView* view() const { return view_; }
- // Returns the browser view that the dropdown belongs to.
- BrowserView* browser_view() const { return browser_view_; }
-
// Returns the focus tracker.
views::ExternalFocusTracker* focus_tracker() const {
return focus_tracker_.get();
@@ -143,6 +143,11 @@ class DropdownBarHost : public views::AcceleratorTarget,
const TabContents* contents,
const views::Textfield::Keystroke& key_stroke);
+ // Returns the animation for the dropdown.
+ SlideAnimation* animation() {
+ return animation_.get();
+ }
+
private:
// The BrowserView that created us.
BrowserView* browser_view_;
@@ -172,6 +177,10 @@ class DropdownBarHost : public views::AcceleratorTarget,
// dropdown bar. It contains the DropdownBarView.
scoped_ptr<views::Widget> host_;
+ // A flag to manually manage visibility. GTK/X11 is asynchrnous and
+ // the state of the widget can be out of sync.
+ bool is_visible_;
+
DISALLOW_COPY_AND_ASSIGN(DropdownBarHost);
};
diff --git a/chrome/browser/views/find_bar_host.cc b/chrome/browser/views/find_bar_host.cc
index 991b7497..2e9d8ec 100644
--- a/chrome/browser/views/find_bar_host.cc
+++ b/chrome/browser/views/find_bar_host.cc
@@ -136,7 +136,7 @@ bool FindBarHost::GetFindBarWindowInfo(gfx::Point* position,
if (position)
*position = window_rect.origin();
if (fully_visible)
- *fully_visible = host()->IsVisible() && !IsAnimating();
+ *fully_visible = IsVisible() && !IsAnimating();
return true;
}
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index f661b86..197ac7c 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -445,6 +445,9 @@ BrowserView::~BrowserView() {
// notifications will call back into deleted objects).
download_shelf_.reset();
+ // Destory extender before destroying browser.
+ browser_extender_.reset();
+
// Explicitly set browser_ to NULL.
browser_.reset();
}
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 9c36b43..9a419db 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -782,7 +782,8 @@ void TabStrip::DestroyDraggedSourceTab(Tab* tab) {
}
gfx::Rect TabStrip::GetIdealBounds(int index) {
- DCHECK(index >= 0 && index < GetTabCount());
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, GetTabCount());
return tab_data_.at(index).ideal_bounds;
}
@@ -1953,6 +1954,7 @@ void TabStrip::RemoveTabAt(int index) {
removed->GetParent()->RemoveChildView(removed);
delete removed;
}
+ GenerateIdealBounds();
}
void TabStrip::HandleGlobalMouseMoveEvent() {