diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 00:26:18 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 00:26:18 +0000 |
commit | da5ff696c0007cdb6ded17a9d4fecf6d4294993e (patch) | |
tree | 278bc8929945622ea13b26a1d9939d460721b949 /chrome/browser/vista_frame.cc | |
parent | 1ca6df9ae9d23bffa27bb1f5fd19a79a6621939a (diff) | |
download | chromium_src-da5ff696c0007cdb6ded17a9d4fecf6d4294993e.zip chromium_src-da5ff696c0007cdb6ded17a9d4fecf6d4294993e.tar.gz chromium_src-da5ff696c0007cdb6ded17a9d4fecf6d4294993e.tar.bz2 |
Move the BookmarkBarView into the frames.
Yes this causes duplicate code, but only for a brief while until I can bring up BrowserView at which point this code will move from the frames to that object. "It gets worse before it gets better".
B=1031854
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/vista_frame.cc')
-rw-r--r-- | chrome/browser/vista_frame.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc index a1ddfc6..1ac4d0e 100644 --- a/chrome/browser/vista_frame.cc +++ b/chrome/browser/vista_frame.cc @@ -144,6 +144,7 @@ VistaFrame::VistaFrame(Browser* browser) root_view_(this, true), tabstrip_(NULL), toolbar_(NULL), + active_bookmark_bar_(NULL), tab_contents_container_(NULL), custom_window_enabled_(false), saved_window_placement_(false), @@ -318,7 +319,7 @@ void VistaFrame::Layout() { CSize bookmark_bar_size; CSize info_bar_size; - if (bookmark_bar_view_) + if (bookmark_bar_view_.get()) bookmark_bar_view_->GetPreferredSize(&bookmark_bar_size); if (info_bar_view_) @@ -327,9 +328,9 @@ void VistaFrame::Layout() { // If we're showing a bookmarks bar in the new tab page style and we // have an infobar showing, we need to flip them. if (info_bar_view_ && - bookmark_bar_view_ && - static_cast<BookmarkBarView*>(bookmark_bar_view_)->IsNewTabPage() && - !static_cast<BookmarkBarView*>(bookmark_bar_view_)->IsAlwaysShown()) { + bookmark_bar_view_.get() && + bookmark_bar_view_->IsNewTabPage() && + !bookmark_bar_view_->IsAlwaysShown()) { info_bar_view_->SetBounds(browser_x, browser_y, browser_w, @@ -345,7 +346,7 @@ void VistaFrame::Layout() { browser_h -= bookmark_bar_size.cy - kSeparationLineHeight; browser_y += bookmark_bar_size.cy; } else { - if (bookmark_bar_view_) { + if (bookmark_bar_view_.get()) { // We want our bookmarks bar to be responsible for drawing its own // separator, so we let it overlap ours. browser_y -= kSeparationLineHeight; @@ -629,6 +630,22 @@ GoButton* VistaFrame::GetGoButton() const { return toolbar_->GetGoButton(); } +BookmarkBarView* VistaFrame::GetBookmarkBarView() { + TabContents* current_tab = browser_->GetSelectedTabContents(); + if (!current_tab || !current_tab->profile()) + return NULL; + + if (!bookmark_bar_view_.get()) { + bookmark_bar_view_.reset(new BookmarkBarView(current_tab->profile(), + browser_)); + bookmark_bar_view_->SetParentOwned(false); + } else { + bookmark_bar_view_->SetProfile(current_tab->profile()); + } + bookmark_bar_view_->SetPageNavigator(current_tab); + return bookmark_bar_view_.get(); +} + void VistaFrame::Update(TabContents* contents, bool should_restore_state) { toolbar_->Update(contents, should_restore_state); } @@ -1591,9 +1608,9 @@ void VistaFrame::ShelfVisibilityChangedImpl(TabContents* current_tab) { ChromeViews::View* new_bookmark_bar_view = NULL; if (SupportsBookmarkBar() && current_tab) - new_bookmark_bar_view = browser_->GetBookmarkBarView(); + new_bookmark_bar_view = GetBookmarkBarView(); changed |= UpdateChildViewAndLayout(new_bookmark_bar_view, - &bookmark_bar_view_); + &active_bookmark_bar_); // Only do a layout if the current contents is non-null. We assume that if the // contents is NULL, we're either being destroyed, or ShowTabContents is going |