From 0ba1f530cf1dfac50ddb7d3b9ef34f2a753947c4 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Thu, 22 Jan 2009 01:34:52 +0000 Subject: Move automation specific accessors to their own interface to make their purpose clear, and make porting easier. Review URL: http://codereview.chromium.org/18481 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8435 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/frame/browser_view.cc | 33 ++++++++++++++++++------------ chrome/browser/views/frame/browser_view.h | 6 +++++- 2 files changed, 25 insertions(+), 14 deletions(-) (limited to 'chrome/browser/views') diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 8214a14..da7adae 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -419,6 +419,10 @@ void* BrowserView::GetNativeHandle() { return GetWidget()->GetHWND(); } +BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() { + return this; +} + TabStrip* BrowserView::GetTabStrip() const { return tabstrip_; } @@ -485,19 +489,6 @@ GoButton* BrowserView::GetGoButton() const { return toolbar_->GetGoButton(); } -BookmarkBarView* BrowserView::GetBookmarkBarView() { - TabContents* current_tab = browser_->GetSelectedTabContents(); - if (!bookmark_bar_view_.get()) { - bookmark_bar_view_.reset(new BookmarkBarView(current_tab->profile(), - browser_.get())); - bookmark_bar_view_->SetParentOwned(false); - } else { - bookmark_bar_view_->SetProfile(current_tab->profile()); - } - bookmark_bar_view_->SetPageNavigator(current_tab); - return bookmark_bar_view_.get(); -} - BrowserView* BrowserView::GetBrowserView() const { return NULL; } @@ -621,6 +612,22 @@ void BrowserView::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, } /////////////////////////////////////////////////////////////////////////////// +// BrowserView, BrowserWindowTesting implementation: + +BookmarkBarView* BrowserView::GetBookmarkBarView() { + TabContents* current_tab = browser_->GetSelectedTabContents(); + if (!bookmark_bar_view_.get()) { + bookmark_bar_view_.reset(new BookmarkBarView(current_tab->profile(), + browser_.get())); + bookmark_bar_view_->SetParentOwned(false); + } else { + bookmark_bar_view_->SetProfile(current_tab->profile()); + } + bookmark_bar_view_->SetPageNavigator(current_tab); + return bookmark_bar_view_.get(); +} + +/////////////////////////////////////////////////////////////////////////////// // BrowserView, NotificationObserver implementation: void BrowserView::Observe(NotificationType type, diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 172a1db..d2df248 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -34,6 +34,7 @@ class TabContentsContainerView; // including the TabStrip, toolbars, download shelves, the content area etc. // class BrowserView : public BrowserWindow, + public BrowserWindowTesting, public NotificationObserver, public TabStripModelObserver, public views::WindowDelegate, @@ -153,6 +154,7 @@ class BrowserView : public BrowserWindow, virtual void Activate(); virtual void FlashFrame(); virtual void* GetNativeHandle(); + virtual BrowserWindowTesting* GetBrowserWindowTesting(); virtual TabStrip* GetTabStrip() const; virtual StatusBubble* GetStatusBubble(); virtual void SelectedTabToolbarSizeChanged(bool is_animating); @@ -163,7 +165,6 @@ class BrowserView : public BrowserWindow, virtual ToolbarStarToggle* GetStarButton() const; virtual LocationBarView* GetLocationBarView() const; virtual GoButton* GetGoButton() const; - virtual BookmarkBarView* GetBookmarkBarView(); virtual BrowserView* GetBrowserView() const; virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void FocusToolbar(); @@ -180,6 +181,9 @@ class BrowserView : public BrowserWindow, virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, void* parent_window); + // Overridden from BrowserWindowTesting: + virtual BookmarkBarView* GetBookmarkBarView(); + // Overridden from NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, -- cgit v1.1