summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-03 00:37:48 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-03 00:37:48 +0000
commit4303f91082840584199e9b79e99b6d0181ca3871 (patch)
treea921a4a6e748c4b376d209619aab8c86e595a9f6 /chrome
parent7e2584b7da3b6a7f797ec9040c91e0f612d11239 (diff)
downloadchromium_src-4303f91082840584199e9b79e99b6d0181ca3871.zip
chromium_src-4303f91082840584199e9b79e99b6d0181ca3871.tar.gz
chromium_src-4303f91082840584199e9b79e99b6d0181ca3871.tar.bz2
Move ChromeBrowserView* -> BrowserView* and ChromeosBrowserView* -> chromeos::BrowserView*
BUG=none TEST=none Review URL: http://codereview.chromium.org/569019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/browser_view.cc (renamed from chrome/browser/chromeos/chromeos_browser_view.cc)95
-rw-r--r--chrome/browser/chromeos/browser_view.h (renamed from chrome/browser/chromeos/chromeos_browser_view.h)27
-rw-r--r--chrome/browser/views/frame/browser_view.cc16
-rw-r--r--chrome/browser/views/frame/browser_view.h7
-rw-r--r--chrome/browser/views/frame/browser_view_layout.cc (renamed from chrome/browser/views/frame/chrome_browser_view_layout_manager.cc)212
-rw-r--r--chrome/browser/views/frame/browser_view_layout.h (renamed from chrome/browser/views/frame/chrome_browser_view_layout_manager.h)43
-rw-r--r--chrome/browser/views/frame/browser_view_layout_manager.h32
-rwxr-xr-xchrome/chrome_browser.gypi14
8 files changed, 208 insertions, 238 deletions
diff --git a/chrome/browser/chromeos/chromeos_browser_view.cc b/chrome/browser/chromeos/browser_view.cc
index 861c393..0e84b3c 100644
--- a/chrome/browser/chromeos/chromeos_browser_view.cc
+++ b/chrome/browser/chromeos/browser_view.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/chromeos_browser_view.h"
+#include "chrome/browser/chromeos/browser_view.h"
#include <algorithm>
#include <string>
@@ -60,7 +60,7 @@ class Spacer : public views::View {
// A chromeos implementation of Tab that shows the compact location bar.
class ChromeosTab : public Tab {
public:
- ChromeosTab(TabStrip* tab_strip, chromeos::ChromeosBrowserView* browser_view)
+ ChromeosTab(TabStrip* tab_strip, chromeos::BrowserView* browser_view)
: Tab(tab_strip),
browser_view_(browser_view) {
}
@@ -73,7 +73,7 @@ class ChromeosTab : public Tab {
}
private:
- chromeos::ChromeosBrowserView* browser_view_;
+ chromeos::BrowserView* browser_view_;
DISALLOW_COPY_AND_ASSIGN(ChromeosTab);
};
@@ -81,8 +81,7 @@ class ChromeosTab : public Tab {
// A Tabstrip that uses ChromeosTab as a Tab implementation.
class ChromeosTabStrip : public TabStrip {
public:
- ChromeosTabStrip(TabStripModel* model,
- chromeos::ChromeosBrowserView* browser_view)
+ ChromeosTabStrip(TabStripModel* model, chromeos::BrowserView* browser_view)
: TabStrip(model), browser_view_(browser_view) {
}
virtual ~ChromeosTabStrip() {}
@@ -94,7 +93,7 @@ class ChromeosTabStrip : public TabStrip {
}
private:
- chromeos::ChromeosBrowserView* browser_view_;
+ chromeos::BrowserView* browser_view_;
DISALLOW_COPY_AND_ASSIGN(ChromeosTabStrip);
};
@@ -109,27 +108,31 @@ enum ChromeOSViewIds {
VIEW_ID_SPACER,
};
-// LayoutManager for ChromeosBrowserView, which layouts extra components such as
+} // namespace
+
+namespace chromeos {
+
+// LayoutManager for BrowserView, which layouts extra components such as
// main menu, stataus views.
-class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
+class BrowserViewLayout : public ::BrowserViewLayout {
public:
- ChromeosBrowserViewLayoutManager() : ChromeBrowserViewLayoutManager() {}
- virtual ~ChromeosBrowserViewLayoutManager() {}
+ BrowserViewLayout() : BrowserViewLayout() {}
+ virtual ~BrowserViewLayout() {}
//////////////////////////////////////////////////////////////////////////////
- // ChromeBrowserViewLayoutManager overrides:
+ // BrowserViewLayout overrides:
void Installed(views::View* host) {
main_menu_ = NULL;
compact_navigation_bar_ = NULL;
status_area_ = NULL;
spacer_ = NULL;
- ChromeBrowserViewLayoutManager::Installed(host);
+ BrowserViewLayout::Installed(host);
}
void ViewAdded(views::View* host,
views::View* view) {
- ChromeBrowserViewLayoutManager::ViewAdded(host, view);
+ BrowserViewLayout::ViewAdded(host, view);
switch (view->GetID()) {
case VIEW_ID_SPACER:
spacer_ = view;
@@ -176,7 +179,7 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
}
virtual bool IsPositionInWindowCaption(const gfx::Point& point) {
- return ChromeBrowserViewLayoutManager::IsPositionInWindowCaption(point)
+ return BrowserViewLayout::IsPositionInWindowCaption(point)
&& !IsPointInViewsInTitleArea(point);
}
@@ -188,12 +191,12 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
if (IsPointInViewsInTitleArea(point_in_browser_view_coords)) {
return HTCLIENT;
}
- return ChromeBrowserViewLayoutManager::NonClientHitTest(point);
+ return BrowserViewLayout::NonClientHitTest(point);
}
private:
- chromeos::ChromeosBrowserView* chromeos_browser_view() {
- return static_cast<chromeos::ChromeosBrowserView*>(browser_view_);
+ chromeos::BrowserView* chromeos_browser_view() {
+ return static_cast<chromeos::BrowserView*>(browser_view_);
}
// Test if the point is on one of views that are within the
@@ -310,14 +313,10 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
views::View* compact_navigation_bar_;
views::View* spacer_;
- DISALLOW_COPY_AND_ASSIGN(ChromeosBrowserViewLayoutManager);
+ DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout);
};
-} // namespace
-
-namespace chromeos {
-
-ChromeosBrowserView::ChromeosBrowserView(Browser* browser)
+BrowserView::BrowserView(Browser* browser)
: BrowserView(browser),
main_menu_(NULL),
status_area_(NULL),
@@ -328,13 +327,13 @@ ChromeosBrowserView::ChromeosBrowserView(Browser* browser)
force_maximized_window_(false) {
}
-ChromeosBrowserView::~ChromeosBrowserView() {
+BrowserView::~BrowserView() {
}
////////////////////////////////////////////////////////////////////////////////
-// ChromeosBrowserView, ChromeBrowserView overrides:
+// BrowserView, ::BrowserView overrides:
-void ChromeosBrowserView::Init() {
+void BrowserView::Init() {
BrowserView::Init();
main_menu_ = new views::ImageButton(this);
main_menu_->SetID(VIEW_ID_MAIN_MENU);
@@ -388,7 +387,7 @@ void ChromeosBrowserView::Init() {
}
}
-void ChromeosBrowserView::Show() {
+void BrowserView::Show() {
bool was_visible = frame()->GetWindow()->IsVisible();
BrowserView::Show();
if (!was_visible) {
@@ -399,13 +398,13 @@ void ChromeosBrowserView::Show() {
}
}
-bool ChromeosBrowserView::IsToolbarVisible() const {
+bool BrowserView::IsToolbarVisible() const {
if (is_compact_style())
return false;
return BrowserView::IsToolbarVisible();
}
-void ChromeosBrowserView::SetFocusToLocationBar() {
+void BrowserView::SetFocusToLocationBar() {
if (compact_navigation_bar_->IsFocusable()) {
compact_navigation_bar_->FocusLocation();
} else {
@@ -413,73 +412,71 @@ void ChromeosBrowserView::SetFocusToLocationBar() {
}
}
-void ChromeosBrowserView::ToggleCompactNavigationBar() {
+void BrowserView::ToggleCompactNavigationBar() {
ui_style_ = static_cast<UIStyle>((ui_style_ + 1) % 2);
compact_navigation_bar_->SetFocusable(is_compact_style());
compact_location_bar_host_->SetEnabled(is_compact_style());
Layout();
}
-views::LayoutManager* ChromeosBrowserView::CreateLayoutManager() const {
- return new ChromeosBrowserViewLayoutManager();
+views::LayoutManager* BrowserView::CreateLayoutManager() const {
+ return new BrowserViewLayout();
}
-TabStrip* ChromeosBrowserView::CreateTabStrip(
+TabStrip* BrowserView::CreateTabStrip(
TabStripModel* tab_strip_model) {
return new ChromeosTabStrip(tab_strip_model, this);
}
// views::ButtonListener overrides.
-void ChromeosBrowserView::ButtonPressed(views::Button* sender,
- const views::Event& event) {
+void BrowserView::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
chromeos::MainMenu::Show(browser());
}
// views::ContextMenuController overrides.
-void ChromeosBrowserView::ShowContextMenu(views::View* source,
- int x,
- int y,
- bool is_mouse_gesture) {
+void BrowserView::ShowContextMenu(views::View* source, int x, int y,
+ bool is_mouse_gesture) {
system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
}
// StatusAreaHost overrides.
-gfx::NativeWindow ChromeosBrowserView::GetNativeWindow() const {
+gfx::NativeWindow BrowserView::GetNativeWindow() const {
return GetWindow()->GetNativeWindow();
}
-void ChromeosBrowserView::OpenSystemOptionsDialog() const {
+void BrowserView::OpenSystemOptionsDialog() const {
browser()->OpenSystemOptionsDialog();
}
-bool ChromeosBrowserView::IsButtonVisible(views::View* button_view) const {
+bool BrowserView::IsButtonVisible(views::View* button_view) const {
if (button_view == status_area_->menu_view())
return !IsToolbarVisible();
return true;
}
////////////////////////////////////////////////////////////////////////////////
-// ChromeosBrowserView public:
+// BrowserView public:
-void ChromeosBrowserView::ShowCompactLocationBarUnderSelectedTab() {
+void BrowserView::ShowCompactLocationBarUnderSelectedTab() {
if (!is_compact_style())
return;
int index = browser()->selected_index();
compact_location_bar_host_->Update(index, true);
}
-bool ChromeosBrowserView::ShouldForceMaximizedWindow() const {
+bool BrowserView::ShouldForceMaximizedWindow() const {
return force_maximized_window_;
}
-int ChromeosBrowserView::GetMainMenuWidth() const {
+int BrowserView::GetMainMenuWidth() const {
return main_menu_->GetPreferredSize().width();
}
////////////////////////////////////////////////////////////////////////////////
-// ChromeosBrowserView private:
+// BrowserView private:
-void ChromeosBrowserView::InitSystemMenu() {
+void BrowserView::InitSystemMenu() {
system_menu_contents_.reset(new menus::SimpleMenuModel(this));
system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB,
IDS_RESTORE_TAB);
@@ -499,7 +496,7 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
if (browser->type() & Browser::TYPE_POPUP)
view = new chromeos::PanelBrowserView(browser);
else
- view = new chromeos::ChromeosBrowserView(browser);
+ view = new chromeos::BrowserView(browser);
BrowserFrame::Create(view, browser->profile());
return view;
}
diff --git a/chrome/browser/chromeos/chromeos_browser_view.h b/chrome/browser/chromeos/browser_view.h
index 2000674..9d7b67b 100644
--- a/chrome/browser/chromeos/chromeos_browser_view.h
+++ b/chrome/browser/chromeos/browser_view.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_CHROMEOS_BROWSER_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_CHROMEOS_BROWSER_VIEW_H_
+#ifndef CHROME_BROWSER_CHROMEOS_BROWSER_VIEW_H_
+#define CHROME_BROWSER_CHROMEOS_BROWSER_VIEW_H_
#include "chrome/browser/chromeos/status_area_host.h"
#include "chrome/browser/views/frame/browser_view.h"
@@ -27,17 +27,17 @@ class CompactLocationBarHost;
class CompactNavigationBar;
class StatusAreaButton;
-// ChromeosBrowserView adds ChromeOS specific controls and menus to a
-// BrowserView created with Browser::TYPE_NORMAL. This extender adds
-// controls to the title bar as follows:
+// chromeos::BrowserView adds ChromeOS specific controls and menus to a
+// BrowserView created with Browser::TYPE_NORMAL. This extender adds controls
+// to the title bar as follows:
// ____ __ __
// [MainMenu] / \ \ \ [StatusArea]
//
// and adds the system context menu to the remaining arae of the titlebar.
-class ChromeosBrowserView : public BrowserView,
- public views::ButtonListener,
- public views::ContextMenuController,
- public StatusAreaHost {
+class BrowserView : public BrowserView,
+ public views::ButtonListener,
+ public views::ContextMenuController,
+ public StatusAreaHost {
public:
// There are 3 ui styles, standard, compact and sidebar.
// Standard uses the same layout as chromium/chrome browser.
@@ -51,8 +51,8 @@ class ChromeosBrowserView : public BrowserView,
SidebarStyle,
};
- explicit ChromeosBrowserView(Browser* browser);
- virtual ~ChromeosBrowserView();
+ explicit BrowserView(Browser* browser);
+ virtual ~BrowserView();
// BrowserView overrides.
virtual void Init();
@@ -122,9 +122,10 @@ class ChromeosBrowserView : public BrowserView,
// Menu button shown in status area when browser is in compact mode.
StatusAreaButton* menu_view_;
- DISALLOW_COPY_AND_ASSIGN(ChromeosBrowserView);
+ DISALLOW_COPY_AND_ASSIGN(BrowserView);
};
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_CHROMEOS_BROWSER_VIEW_H_
+#endif // CHROME_BROWSER_CHROMEOS_BROWSER_VIEW_H_
+
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index e02d3d5..5eb03d3 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -38,7 +38,7 @@
#include "chrome/browser/views/chrome_views_delegate.h"
#include "chrome/browser/views/download_shelf_view.h"
#include "chrome/browser/views/extensions/extension_shelf.h"
-#include "chrome/browser/views/frame/chrome_browser_view_layout_manager.h"
+#include "chrome/browser/views/frame/browser_view_layout.h"
#include "chrome/browser/views/frame/browser_extender.h"
#include "chrome/browser/views/frame/browser_frame.h"
#include "chrome/browser/views/fullscreen_exit_bubble.h"
@@ -524,7 +524,7 @@ bool BrowserView::ShouldFindBarBlendWithBookmarksBar() const {
}
gfx::Rect BrowserView::GetFindBarBoundingBox() const {
- return GetBrowserViewLayoutManager()->GetFindBarBoundingBox();
+ return GetBrowserViewLayout()->GetFindBarBoundingBox();
}
int BrowserView::GetTabStripHeight() const {
@@ -658,7 +658,7 @@ void BrowserView::DetachBrowserBubble(BrowserBubble* bubble) {
}
bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) {
- return GetBrowserViewLayoutManager()->IsPositionInWindowCaption(point);
+ return GetBrowserViewLayout()->IsPositionInWindowCaption(point);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1532,11 +1532,11 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
}
#endif
- return GetBrowserViewLayoutManager()->NonClientHitTest(point);
+ return GetBrowserViewLayout()->NonClientHitTest(point);
}
gfx::Size BrowserView::GetMinimumSize() {
- return GetBrowserViewLayoutManager()->GetMinimumSize();
+ return GetBrowserViewLayout()->GetMinimumSize();
}
///////////////////////////////////////////////////////////////////////////////
@@ -1590,7 +1590,7 @@ void BrowserView::SetAccessibleName(const std::wstring& name) {
}
views::LayoutManager* BrowserView::CreateLayoutManager() const {
- return new ChromeBrowserViewLayoutManager();
+ return new BrowserViewLayout;
}
TabStrip* BrowserView::CreateTabStrip(TabStripModel* model) {
@@ -1692,8 +1692,8 @@ void BrowserView::InitSystemMenu() {
}
#endif
-BrowserViewLayoutManager* BrowserView::GetBrowserViewLayoutManager() const {
- return static_cast<BrowserViewLayoutManager*>(GetLayoutManager());
+BrowserViewLayout* BrowserView::GetBrowserViewLayout() const {
+ return static_cast<BrowserViewLayout*>(GetLayoutManager());
}
void BrowserView::LayoutStatusBubble(int top) {
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 516e9bf..32b4491 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -36,7 +36,7 @@ class BookmarkBarView;
class Browser;
class BrowserBubble;
class BrowserExtender;
-class BrowserViewLayoutManager;
+class BrowserViewLayout;
class DownloadShelfView;
class EncodingMenuModel;
class ExtensionShelf;
@@ -388,8 +388,9 @@ class BrowserView : public BrowserWindow,
// Creates the system menu.
void InitSystemMenu();
#endif
- // Returns the BrowserViewLayoutManager.
- BrowserViewLayoutManager* GetBrowserViewLayoutManager() const;
+
+ // Returns the BrowserViewLayout.
+ BrowserViewLayout* GetBrowserViewLayout() const;
// Prepare to show the Bookmark Bar for the specified TabContents. Returns
// true if the Bookmark Bar can be shown (i.e. it's supported for this
diff --git a/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc b/chrome/browser/views/frame/browser_view_layout.cc
index 8994f75..e2c5ae1 100644
--- a/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc
+++ b/chrome/browser/views/frame/browser_view_layout.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/views/frame/chrome_browser_view_layout_manager.h"
+#include "chrome/browser/views/frame/browser_view_layout.h"
#include "app/gfx/scrollbar_size.h"
#include "chrome/browser/find_bar.h"
@@ -22,16 +22,23 @@
#include "views/window/hit_test.h"
#endif
+namespace {
+
// The visible height of the shadow above the tabs. Clicks in this area are
// treated as clicks to the frame, rather than clicks to the tab.
-static const int kTabShadowSize = 2;
+const int kTabShadowSize = 2;
// The vertical overlap between the TabStrip and the Toolbar.
-static const int kToolbarTabStripVerticalOverlap = 3;
+const int kToolbarTabStripVerticalOverlap = 3;
// An offset distance between certain toolbars and the toolbar that preceded
// them in layout.
-static const int kSeparationLineHeight = 1;
+const int kSeparationLineHeight = 1;
+
+} // namespace
+
+////////////////////////////////////////////////////////////////////////////////
+// BrowserViewLayout, public:
-ChromeBrowserViewLayoutManager::ChromeBrowserViewLayoutManager()
+BrowserViewLayout::BrowserViewLayout()
: tabstrip_(NULL),
toolbar_(NULL),
contents_split_(NULL),
@@ -44,90 +51,7 @@ ChromeBrowserViewLayoutManager::ChromeBrowserViewLayoutManager()
find_bar_y_(0) {
}
-//////////////////////////////////////////////////////////////////////////////
-// Overridden from LayoutManager.
-
-void ChromeBrowserViewLayoutManager::Installed(views::View* host) {
- toolbar_ = NULL;
- contents_split_ = NULL;
- contents_container_ = NULL;
- infobar_container_ = NULL;
- download_shelf_ = NULL;
- extension_shelf_ = NULL;
- active_bookmark_bar_ = NULL;
- tabstrip_ = NULL;
- browser_view_ = static_cast<BrowserView*>(host);
-}
-
-void ChromeBrowserViewLayoutManager::Uninstalled(views::View* host) {}
-
-void ChromeBrowserViewLayoutManager::ViewAdded(views::View* host,
- views::View* view) {
- switch (view->GetID()) {
- case VIEW_ID_CONTENTS_SPLIT:
- contents_split_ = view;
- contents_container_ = contents_split_->GetChildViewAt(0);
- break;
- case VIEW_ID_INFO_BAR_CONTAINER:
- infobar_container_ = view;
- break;
- case VIEW_ID_DOWNLOAD_SHELF:
- download_shelf_ = static_cast<DownloadShelfView*>(view);
- break;
- case VIEW_ID_DEV_EXTENSION_SHELF:
- extension_shelf_ = static_cast<ExtensionShelf*>(view);
- break;
- case VIEW_ID_BOOKMARK_BAR:
- active_bookmark_bar_ = static_cast<BookmarkBarView*>(view);
- break;
- case VIEW_ID_TOOLBAR:
- toolbar_ = static_cast<ToolbarView*>(view);
- break;
- case VIEW_ID_TAB_STRIP:
- tabstrip_ = static_cast<TabStrip*>(view);
- break;
- }
-}
-
-void ChromeBrowserViewLayoutManager::ViewRemoved(views::View* host,
- views::View* view) {
- switch (view->GetID()) {
- case VIEW_ID_BOOKMARK_BAR:
- active_bookmark_bar_ = NULL;
- break;
- }
-}
-
-void ChromeBrowserViewLayoutManager::Layout(views::View* host) {
- int top = LayoutTabStrip();
- top = LayoutToolbar(top);
- top = LayoutBookmarkAndInfoBars(top);
- int bottom = LayoutExtensionAndDownloadShelves();
- LayoutTabContents(top, bottom);
- // This must be done _after_ we lay out the TabContents since this
- // code calls back into us to find the bounding box the find bar
- // must be laid out within, and that code depends on the
- // TabContentsContainer's bounds being up to date.
- if (browser()->HasFindBarController()) {
- browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
- gfx::Rect(), true);
- }
- // Align status bubble with the bottom of the contents_container.
- browser_view_->LayoutStatusBubble(
- top + contents_container_->bounds().height());
- browser_view_->SchedulePaint();
-}
-
-// Return the preferred size which is the size required to give each
-// children their respective preferred size.
-gfx::Size ChromeBrowserViewLayoutManager::GetPreferredSize(views::View* host) {
- return gfx::Size();
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// Overridden from BrowserViewLayoutManager.
-
-gfx::Size ChromeBrowserViewLayoutManager::GetMinimumSize() {
+gfx::Size BrowserViewLayout::GetMinimumSize() {
// TODO(noname): In theory the tabstrip width should probably be
// (OTR + tabstrip + caption buttons) width.
gfx::Size tabstrip_size(
@@ -158,7 +82,7 @@ gfx::Size ChromeBrowserViewLayoutManager::GetMinimumSize() {
return gfx::Size(min_width, min_height);
}
-gfx::Rect ChromeBrowserViewLayoutManager::GetFindBarBoundingBox() const {
+gfx::Rect BrowserViewLayout::GetFindBarBoundingBox() const {
// This function returns the area the Find Bar can be laid out
// within. This basically implies the "user-perceived content
// area" of the browser window excluding the vertical
@@ -192,14 +116,14 @@ gfx::Rect ChromeBrowserViewLayoutManager::GetFindBarBoundingBox() const {
return bounding_box;
}
-bool ChromeBrowserViewLayoutManager::IsPositionInWindowCaption(
+bool BrowserViewLayout::IsPositionInWindowCaption(
const gfx::Point& point) {
gfx::Point tabstrip_point(point);
views::View::ConvertPointToView(browser_view_, tabstrip_, &tabstrip_point);
return tabstrip_->IsPositionInWindowCaption(tabstrip_point);
}
-int ChromeBrowserViewLayoutManager::NonClientHitTest(
+int BrowserViewLayout::NonClientHitTest(
const gfx::Point& point) {
// Since the TabStrip only renders in some parts of the top of the window,
// the un-obscured area is considered to be part of the non-client caption
@@ -268,9 +192,87 @@ int ChromeBrowserViewLayoutManager::NonClientHitTest(
}
//////////////////////////////////////////////////////////////////////////////
-// Overridden from ChromeBrowserViewLayoutManager, private:
+// BrowserViewLayout, views::LayoutManager implementation:
+
+void BrowserViewLayout::Installed(views::View* host) {
+ toolbar_ = NULL;
+ contents_split_ = NULL;
+ contents_container_ = NULL;
+ infobar_container_ = NULL;
+ download_shelf_ = NULL;
+ extension_shelf_ = NULL;
+ active_bookmark_bar_ = NULL;
+ tabstrip_ = NULL;
+ browser_view_ = static_cast<BrowserView*>(host);
+}
+
+void BrowserViewLayout::Uninstalled(views::View* host) {}
+
+void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) {
+ switch (view->GetID()) {
+ case VIEW_ID_CONTENTS_SPLIT:
+ contents_split_ = view;
+ contents_container_ = contents_split_->GetChildViewAt(0);
+ break;
+ case VIEW_ID_INFO_BAR_CONTAINER:
+ infobar_container_ = view;
+ break;
+ case VIEW_ID_DOWNLOAD_SHELF:
+ download_shelf_ = static_cast<DownloadShelfView*>(view);
+ break;
+ case VIEW_ID_DEV_EXTENSION_SHELF:
+ extension_shelf_ = static_cast<ExtensionShelf*>(view);
+ break;
+ case VIEW_ID_BOOKMARK_BAR:
+ active_bookmark_bar_ = static_cast<BookmarkBarView*>(view);
+ break;
+ case VIEW_ID_TOOLBAR:
+ toolbar_ = static_cast<ToolbarView*>(view);
+ break;
+ case VIEW_ID_TAB_STRIP:
+ tabstrip_ = static_cast<TabStrip*>(view);
+ break;
+ }
+}
+
+void BrowserViewLayout::ViewRemoved(views::View* host, views::View* view) {
+ switch (view->GetID()) {
+ case VIEW_ID_BOOKMARK_BAR:
+ active_bookmark_bar_ = NULL;
+ break;
+ }
+}
+
+void BrowserViewLayout::Layout(views::View* host) {
+ int top = LayoutTabStrip();
+ top = LayoutToolbar(top);
+ top = LayoutBookmarkAndInfoBars(top);
+ int bottom = LayoutExtensionAndDownloadShelves();
+ LayoutTabContents(top, bottom);
+ // This must be done _after_ we lay out the TabContents since this
+ // code calls back into us to find the bounding box the find bar
+ // must be laid out within, and that code depends on the
+ // TabContentsContainer's bounds being up to date.
+ if (browser()->HasFindBarController()) {
+ browser()->GetFindBarController()->find_bar()->MoveWindowIfNecessary(
+ gfx::Rect(), true);
+ }
+ // Align status bubble with the bottom of the contents_container.
+ browser_view_->LayoutStatusBubble(
+ top + contents_container_->bounds().height());
+ browser_view_->SchedulePaint();
+}
+
+// Return the preferred size which is the size required to give each
+// children their respective preferred size.
+gfx::Size BrowserViewLayout::GetPreferredSize(views::View* host) {
+ return gfx::Size();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BrowserViewLayout, private:
-int ChromeBrowserViewLayoutManager::LayoutTabStrip() {
+int BrowserViewLayout::LayoutTabStrip() {
if (!browser_view_->IsTabStripVisible()) {
tabstrip_->SetVisible(false);
tabstrip_->SetBounds(0, 0, 0, 0);
@@ -292,9 +294,7 @@ int ChromeBrowserViewLayoutManager::LayoutTabStrip() {
}
}
-// Layout the following controls, starting at |top|, returns the coordinate
-// of the bottom of the control, for laying out the next control.
-int ChromeBrowserViewLayoutManager::LayoutToolbar(int top) {
+int BrowserViewLayout::LayoutToolbar(int top) {
int browser_view_width = browser_view_->width();
bool visible = browser_view_->IsToolbarVisible();
toolbar_->location_bar()->SetFocusable(visible);
@@ -307,7 +307,7 @@ int ChromeBrowserViewLayoutManager::LayoutToolbar(int top) {
return y + height;
}
-int ChromeBrowserViewLayoutManager::LayoutBookmarkAndInfoBars(int top) {
+int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top) {
find_bar_y_ = top + browser_view_->y() - 1;
if (active_bookmark_bar_) {
// If we're showing the Bookmark bar in detached style, then we
@@ -322,7 +322,7 @@ int ChromeBrowserViewLayoutManager::LayoutBookmarkAndInfoBars(int top) {
return LayoutInfoBar(top);
}
-int ChromeBrowserViewLayoutManager::LayoutTopBar(int top) {
+int BrowserViewLayout::LayoutTopBar(int top) {
// This method lays out the the bookmark bar, and, if required,
// the extension shelf by its side. The bookmark bar appears on
// the right of the extension shelf. If there are too many
@@ -378,7 +378,7 @@ int ChromeBrowserViewLayoutManager::LayoutTopBar(int top) {
return y + bookmark_bar_height;
}
-int ChromeBrowserViewLayoutManager::LayoutInfoBar(int top) {
+int BrowserViewLayout::LayoutInfoBar(int top) {
bool visible = browser()->SupportsWindowFeature(Browser::FEATURE_INFOBAR);
int height = visible ? infobar_container_->GetPreferredSize().height() : 0;
infobar_container_->SetVisible(visible);
@@ -388,11 +388,11 @@ int ChromeBrowserViewLayoutManager::LayoutInfoBar(int top) {
// Layout the TabContents container, between the coordinates |top| and
// |bottom|.
-void ChromeBrowserViewLayoutManager::LayoutTabContents(int top, int bottom) {
+void BrowserViewLayout::LayoutTabContents(int top, int bottom) {
contents_split_->SetBounds(0, top, browser_view_->width(), bottom - top);
}
-int ChromeBrowserViewLayoutManager::LayoutExtensionAndDownloadShelves() {
+int BrowserViewLayout::LayoutExtensionAndDownloadShelves() {
// If we're showing the Extension bar in detached style, then we
// need to show Download shelf _above_ the Extension bar, since
// the Extension bar is styled to look like it's part of the page.
@@ -410,9 +410,7 @@ int ChromeBrowserViewLayoutManager::LayoutExtensionAndDownloadShelves() {
return LayoutDownloadShelf(bottom);
}
-// Layout the Download Shelf, returns the coordinate of the top of the
-// control, for laying out the previous control.
-int ChromeBrowserViewLayoutManager::LayoutDownloadShelf(int bottom) {
+int BrowserViewLayout::LayoutDownloadShelf(int bottom) {
// Re-layout the shelf either if it is visible or if it's close animation
// is currently running.
if (browser_view_->IsDownloadShelfVisible() ||
@@ -430,9 +428,7 @@ int ChromeBrowserViewLayoutManager::LayoutDownloadShelf(int bottom) {
return bottom;
}
-// Layout the Extension Shelf, returns the coordinate of the top of the
-// control, for laying out the previous control.
-int ChromeBrowserViewLayoutManager::LayoutExtensionShelf(int bottom) {
+int BrowserViewLayout::LayoutExtensionShelf(int bottom) {
if (!extension_shelf_ || extension_shelf_->IsOnTop())
return bottom;
diff --git a/chrome/browser/views/frame/chrome_browser_view_layout_manager.h b/chrome/browser/views/frame/browser_view_layout.h
index 19334a4..33333fa 100644
--- a/chrome/browser/views/frame/chrome_browser_view_layout_manager.h
+++ b/chrome/browser/views/frame/browser_view_layout.h
@@ -2,20 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_FRAME_CHROME_BROWSER_VIEW_LAYOUT_MANAGER_H_
-#define CHROME_BROWSER_VIEWS_FRAME_CHROME_BROWSER_VIEW_LAYOUT_MANAGER_H_
+#ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
+#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
-#include "chrome/browser/views/frame/browser_view_layout_manager.h"
#include "chrome/browser/views/frame/browser_view.h"
+#include "views/layout_manager.h"
// The layout manager used in chrome browser.
-class ChromeBrowserViewLayoutManager : public BrowserViewLayoutManager {
+class BrowserViewLayout : public views::LayoutManager {
public:
- ChromeBrowserViewLayoutManager();
- virtual ~ChromeBrowserViewLayoutManager() {}
+ BrowserViewLayout();
+ virtual ~BrowserViewLayout() {}
- //////////////////////////////////////////////////////////////////////////////
- // Overridden from LayoutManager.
+ // Returns the minimum size of the browser view.
+ virtual gfx::Size GetMinimumSize();
+
+ // Returns the bounding box for the find bar.
+ virtual gfx::Rect GetFindBarBoundingBox() const;
+
+ // Returns true if the specified point(BrowserView coordinates) is in
+ // in the window caption area of the browser window.
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point);
+
+ // Tests to see if the specified |point| (in nonclient view's coordinates)
+ // is within the views managed by the laymanager. Returns one of
+ // HitTestCompat enum defined in views/window/hit_test.h.
+ // See also ClientView::NonClientHitTest.
+ virtual int NonClientHitTest(const gfx::Point& point);
+
+ // views::LayoutManager overrides:
virtual void Installed(views::View* host);
virtual void Uninstalled(views::View* host);
virtual void ViewAdded(views::View* host, views::View* view);
@@ -23,13 +38,6 @@ class ChromeBrowserViewLayoutManager : public BrowserViewLayoutManager {
virtual void Layout(views::View* host);
virtual gfx::Size GetPreferredSize(views::View* host);
- //////////////////////////////////////////////////////////////////////////////
- // Overridden from BrowserLayoutManager.
- virtual gfx::Size GetMinimumSize();
- virtual gfx::Rect GetFindBarBoundingBox() const;
- virtual bool IsPositionInWindowCaption(const gfx::Point& point);
- virtual int NonClientHitTest(const gfx::Point& point);
-
protected:
Browser* browser() {
return browser_view_->browser();
@@ -74,7 +82,8 @@ class ChromeBrowserViewLayoutManager : public BrowserViewLayoutManager {
// The distance the FindBar is from the top of the window, in pixels.
int find_bar_y_;
- DISALLOW_COPY_AND_ASSIGN(ChromeBrowserViewLayoutManager);
+ DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout);
};
-#endif // CHROME_BROWSER_VIEWS_FRAME_CHROME_BROWSER_VIEW_LAYOUT_MANAGER_H_
+#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_
+
diff --git a/chrome/browser/views/frame/browser_view_layout_manager.h b/chrome/browser/views/frame/browser_view_layout_manager.h
deleted file mode 100644
index f39b877..0000000
--- a/chrome/browser/views/frame/browser_view_layout_manager.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_MANAGER_H_
-#define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_MANAGER_H_
-
-#include "base/gfx/size.h"
-#include "views/layout_manager.h"
-
-// An extended LayoutManager to layout components in
-// BrowserView.
-class BrowserViewLayoutManager : public views::LayoutManager {
- public:
- // Returns the minimum size of the browser view.
- virtual gfx::Size GetMinimumSize() = 0;
-
- // Returns the bounding box for the find bar.
- virtual gfx::Rect GetFindBarBoundingBox() const = 0;
-
- // Returns true if the specified point(BrowserView coordinates) is in
- // in the window caption area of the browser window.
- virtual bool IsPositionInWindowCaption(const gfx::Point& point) = 0;
-
- // Tests to see if the specified |point| (in nonclient view's coordinates)
- // is within the views managed by the laymanager. Returns one of
- // HitTestCompat enum defined in views/window/hit_test.h.
- // See also ClientView::NonClientHitTest.
- virtual int NonClientHitTest(const gfx::Point& point) = 0;
-};
-
-#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_MANAGER_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f2038b5..d8bbd9a 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -259,8 +259,8 @@
'browser/chromeos/browser_extenders.cc',
'browser/chromeos/browser_status_area_view.cc',
'browser/chromeos/browser_status_area_view.h',
- 'browser/chromeos/chromeos_browser_view.cc',
- 'browser/chromeos/chromeos_browser_view.h',
+ 'browser/chromeos/browser_view.cc',
+ 'browser/chromeos/browser_view.h',
'browser/chromeos/clock_menu_button.cc',
'browser/chromeos/clock_menu_button.h',
'browser/chromeos/compact_location_bar_host.cc',
@@ -1815,8 +1815,8 @@
'browser/views/first_run_view.h',
'browser/views/first_run_view_base.cc',
'browser/views/first_run_view_base.h',
- 'browser/views/frame/chrome_browser_view_layout_manager.cc',
- 'browser/views/frame/chrome_browser_view_layout_manager.h',
+ 'browser/views/frame/browser_view_layout.cc',
+ 'browser/views/frame/browser_view_layout.h',
'browser/views/frame/browser_extender.cc',
'browser/views/frame/browser_extender.h',
'browser/views/frame/browser_frame.h',
@@ -1824,7 +1824,6 @@
'browser/views/frame/browser_frame_gtk.h',
'browser/views/frame/browser_frame_win.cc',
'browser/views/frame/browser_frame_win.h',
- 'browser/views/frame/browser_view_layout_manager.h',
'browser/views/frame/browser_non_client_frame_view.h',
'browser/views/frame/browser_root_view.cc',
'browser/views/frame/browser_root_view.h',
@@ -2389,11 +2388,10 @@
['include', '^browser/views/theme_install_bubble_view.h'],
['include', '^browser/views/toolbar_star_toggle.h'],
['include', '^browser/views/toolbar_star_toggle.cc'],
- ['include', '^browser/views/frame/chrome_browser_view_layout_manager.cc'],
- ['include', '^browser/views/frame/chrome_browser_view_layout_manager.h'],
+ ['include', '^browser/views/frame/browser_view_layout.cc'],
+ ['include', '^browser/views/frame/browser_view_layout.h'],
['include', '^browser/views/frame/browser_extender.cc'],
['include', '^browser/views/frame/browser_extender.h'],
- ['include', '^browser/views/frame/browser_view_layout_manager.h'],
['include', '^browser/views/frame/browser_view.cc'],
['include', '^browser/views/frame/browser_view.h'],
['include', '^browser/views/frame/browser_frame_gtk.cc'],