Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/bookmark_bar_view.h" | 5 #include "chrome/browser/views/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 } | 560 } |
| 561 | 561 |
| 562 void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous, | 562 void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous, |
| 563 const gfx::Rect& current) { | 563 const gfx::Rect& current) { |
| 564 Layout(); | 564 Layout(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 void BookmarkBarView::ViewHierarchyChanged(bool is_add, | 567 void BookmarkBarView::ViewHierarchyChanged(bool is_add, |
| 568 View* parent, | 568 View* parent, |
| 569 View* child) { | 569 View* child) { |
| 570 if (is_add && child == this && height() > 0) { | 570 if (is_add && child == this) { |
| 571 // We only layout while parented. When we become parented, if our bounds | 571 // We may get inserted into a heirarchy with a profile - this typically |
|
Miranda Callahan
2009/08/07 22:35:46
nit: hierarchy
| |
| 572 // haven't changed, DidChangeBounds won't get invoked and we won't layout. | 572 // occurs when the bar's contents get populated fast enough that the |
| 573 // Therefore we always force a layout when added. | 573 // buttons are created before the bar is attached to a frame. |
| 574 Layout(); | 574 UpdateButtonColors(); |
| 575 | |
| 576 if (height() > 0) { | |
| 577 // We only layout while parented. When we become parented, if our bounds | |
| 578 // haven't changed, DidChangeBounds won't get invoked and we won't layout. | |
| 579 // Therefore we always force a layout when added. | |
| 580 Layout(); | |
| 581 } | |
| 575 } | 582 } |
| 576 } | 583 } |
| 577 | 584 |
| 578 void BookmarkBarView::Paint(gfx::Canvas* canvas) { | 585 void BookmarkBarView::Paint(gfx::Canvas* canvas) { |
| 579 if (IsDetachedStyle()) { | 586 if (IsDetachedStyle()) { |
| 580 // Draw the background to match the new tab page. | 587 // Draw the background to match the new tab page. |
| 581 ThemeProvider* tp = GetThemeProvider(); | 588 ThemeProvider* tp = GetThemeProvider(); |
| 582 canvas->FillRectInt( | 589 canvas->FillRectInt( |
| 583 tp->GetColor(BrowserThemeProvider::COLOR_NTP_BACKGROUND), | 590 tp->GetColor(BrowserThemeProvider::COLOR_NTP_BACKGROUND), |
| 584 0, 0, width(), height()); | 591 0, 0, width(), height()); |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1758 for (int i = 0; i < GetBookmarkButtonCount(); i++) { | 1765 for (int i = 0; i < GetBookmarkButtonCount(); i++) { |
| 1759 views::TextButton* button = GetBookmarkButton(i); | 1766 views::TextButton* button = GetBookmarkButton(i); |
| 1760 button->SetEnabledColor(GetThemeProvider()->GetColor( | 1767 button->SetEnabledColor(GetThemeProvider()->GetColor( |
| 1761 BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); | 1768 BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); |
| 1762 } | 1769 } |
| 1763 other_bookmarked_button()->SetEnabledColor(GetThemeProvider()->GetColor( | 1770 other_bookmarked_button()->SetEnabledColor(GetThemeProvider()->GetColor( |
| 1764 BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); | 1771 BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); |
| 1765 } | 1772 } |
| 1766 } | 1773 } |
| 1767 | 1774 |
| OLD | NEW |