summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 23:37:10 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 23:37:10 +0000
commit98e0949f24b56b62f161ff7f694cedde17564b80 (patch)
tree664e610d2941eb11cb13bb0c229b3b464a3280c3 /chrome/browser/views
parent37eeb5a01e5ca3233934628c635d866999e329a6 (diff)
downloadchromium_src-98e0949f24b56b62f161ff7f694cedde17564b80.zip
chromium_src-98e0949f24b56b62f161ff7f694cedde17564b80.tar.gz
chromium_src-98e0949f24b56b62f161ff7f694cedde17564b80.tar.bz2
Fixes regression where bookmark bar would appear all black. Actually,
it wasn't that the bookmark bar was all black, rather that BrowserView thought the bookmark bar was parented when in fact it wasn't. The black was the result of BrowserView reserving the space for the bookmark bar and not painting anything in it's space. BUG=7922 TEST=see bug Review URL: http://codereview.chromium.org/28191 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc5
-rw-r--r--chrome/browser/views/frame/browser_view.cc20
-rw-r--r--chrome/browser/views/frame/browser_view.h7
3 files changed, 9 insertions, 23 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 40f603e..400b7ab 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -871,11 +871,6 @@ void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous,
void BookmarkBarView::ViewHierarchyChanged(bool is_add,
View* parent,
View* child) {
- // See http://code.google.com/p/chromium/issues/detail?id=7857 . It seems
- // as though the bookmark bar is getting unintentionally removed.
- DCHECK(testing_ || child != this || is_add ||
- static_cast<BrowserView*>(parent)->is_removing_bookmark_bar());
-
if (is_add && child == this && height() > 0) {
// We only layout while parented. When we become parented, if our bounds
// haven't changed, DidChangeBounds won't get invoked and we won't layout.
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 0d9e081..12a057c 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -204,8 +204,7 @@ BrowserView::BrowserView(Browser* browser)
personalization_enabled_(false),
personalization_(NULL),
#endif
- forwarding_to_tab_strip_(false),
- is_removing_bookmark_bar_(false) {
+ forwarding_to_tab_strip_(false) {
InitClass();
browser_->tabstrip_model()->AddObserver(this);
}
@@ -708,8 +707,8 @@ void BrowserView::DestroyBrowser() {
bool BrowserView::IsBookmarkBarVisible() const {
return SupportsWindowFeature(FEATURE_BOOKMARKBAR) &&
- bookmark_bar_view_.get() &&
- (bookmark_bar_view_->GetPreferredSize().height() != 0);
+ active_bookmark_bar_ &&
+ (active_bookmark_bar_->GetPreferredSize().height() != 0);
}
gfx::Rect BrowserView::GetRootWindowResizerRect() const {
@@ -1361,7 +1360,7 @@ int BrowserView::LayoutToolbar(int top) {
int BrowserView::LayoutBookmarkAndInfoBars(int top) {
find_bar_y_ = top + y() - 1;
- if (bookmark_bar_view_.get()) {
+ if (active_bookmark_bar_) {
// If we're showing the Bookmark bar in detached style, then we need to show
// any Info bar _above_ the Bookmark bar, since the Bookmark bar is styled
// to look like it's part of the page.
@@ -1375,7 +1374,7 @@ int BrowserView::LayoutBookmarkAndInfoBars(int top) {
}
int BrowserView::LayoutBookmarkBar(int top) {
- DCHECK(bookmark_bar_view_.get());
+ DCHECK(active_bookmark_bar_);
bool visible = IsBookmarkBarVisible();
int height, y = top;
if (visible) {
@@ -1429,9 +1428,8 @@ void BrowserView::LayoutStatusBubble(int top) {
bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
views::View* new_bookmark_bar_view = NULL;
- views::View* old_bookmark_bar_view = bookmark_bar_view_.get();
if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && contents) {
- if (!old_bookmark_bar_view) {
+ if (!bookmark_bar_view_.get()) {
bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(),
browser_.get()));
bookmark_bar_view_->SetParentOwned(false);
@@ -1441,11 +1439,7 @@ bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
bookmark_bar_view_->SetPageNavigator(contents);
new_bookmark_bar_view = bookmark_bar_view_.get();
}
- is_removing_bookmark_bar_ = true;
- bool result = UpdateChildViewAndLayout(new_bookmark_bar_view,
- &old_bookmark_bar_view);
- is_removing_bookmark_bar_ = false;
- return result;
+ return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_);
}
bool BrowserView::MaybeShowInfoBar(TabContents* contents) {
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 592e264..ad60baf 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -267,8 +267,6 @@ class BrowserView : public BrowserWindow,
}
#endif
- bool is_removing_bookmark_bar() const { return is_removing_bookmark_bar_; }
-
protected:
// Overridden from views::View:
virtual void Layout();
@@ -385,6 +383,8 @@ class BrowserView : public BrowserWindow,
scoped_ptr<Browser> browser_;
// Tool/Info bars that we are currently showing. Used for layout.
+ // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing,
+ // or is bookmark_bar_view_ if the bookmark bar is showing.
views::View* active_bookmark_bar_;
views::View* active_download_shelf_;
@@ -472,9 +472,6 @@ class BrowserView : public BrowserWindow,
bool personalization_enabled_;
#endif
- // For debugging 7857.
- bool is_removing_bookmark_bar_;
-
DISALLOW_COPY_AND_ASSIGN(BrowserView);
};