summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc3
-rw-r--r--chrome/browser/browser.vcproj4
-rw-r--r--chrome/browser/browser_window.h15
-rw-r--r--chrome/browser/views/frame/browser_view.cc120
-rw-r--r--chrome/browser/views/frame/browser_view.h38
-rw-r--r--chrome/browser/views/frame/browser_window_factory.cc52
-rw-r--r--chrome/browser/views/toolbar_view.cc5
-rw-r--r--chrome/browser/views/toolbar_view.h1
-rw-r--r--chrome/browser/vista_frame.cc71
-rw-r--r--chrome/browser/vista_frame.h12
-rw-r--r--chrome/browser/xp_frame.cc72
-rw-r--r--chrome/browser/xp_frame.h12
-rw-r--r--chrome/test/accessibility/accessibility_util.cc8
-rw-r--r--chrome/test/accessibility/accessibility_util.h3
-rw-r--r--chrome/test/accessibility/constants.h6
15 files changed, 272 insertions, 150 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 4b4ddb2..02fe2e2 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -232,7 +232,8 @@ Browser::Browser(const gfx::Rect& initial_bounds,
maximized = true;
if (maximized)
initial_show_command_ = SW_SHOWMAXIMIZED;
- window_ = FrameUtil::CreateBrowserWindow(create_bounds, this);
+ window_ = BrowserWindow::CreateBrowserWindow(this, create_bounds,
+ show_command);
// See note where SIZE_TO_CONTENTS is defined in browser.h for an explanation
// of this hack.
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 5c85727..f635dcc 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -1721,6 +1721,10 @@
>
</File>
<File
+ RelativePath=".\views\frame\browser_window_factory.cc"
+ >
+ </File>
+ <File
RelativePath=".\views\frame\opaque_frame.cc"
>
</File>
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index 713618a..10a173c 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -37,7 +37,9 @@
#include "chrome/views/accelerator.h"
class BookmarkBarView;
+class Browser;
class BrowserList;
+class BrowserView;
namespace ChromeViews {
class RootView;
}
@@ -158,9 +160,6 @@ class BrowserWindow {
// |content_rect|.
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect) = 0;
- // Set the frame bounds. |bounds| is in screen coordinate.
- virtual void SetBounds(const gfx::Rect& bounds) = 0;
-
// Tel this frame to detach from the web browser. The frame should no longer
// notify the browser about anything.
virtual void DetachFromBrowser() = 0;
@@ -191,6 +190,10 @@ class BrowserWindow {
// Returns the Bookmark Bar view.
virtual BookmarkBarView* GetBookmarkBarView() = 0;
+ // Returns the BrowserView.
+ // TODO(beng): remove this! temporary only!
+ virtual BrowserView* GetBrowserView() const = 0;
+
// Updates the toolbar with the state for the specified |contents|.
virtual void Update(TabContents* contents, bool should_restore_state) = 0;
@@ -200,8 +203,14 @@ class BrowserWindow {
// Focuses the toolbar (for accessibility).
virtual void FocusToolbar() = 0;
+ // Construct a BrowserWindow implementation for the specified |browser|.
+ static BrowserWindow* CreateBrowserWindow(Browser* browser,
+ const gfx::Rect& bounds,
+ int show_command);
+
protected:
friend class BrowserList;
+ friend class BrowserView;
virtual void DestroyBrowser() = 0;
};
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index cdbd9c9..c6d73f2 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -29,171 +29,203 @@
#include "chrome/browser/views/frame/browser_view.h"
+#include "chrome/browser/browser.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents.h"
#include "chrome/browser/tabs/tab_strip.h"
+#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/browser/views/go_button.h"
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/browser/views/status_bubble.h"
#include "chrome/browser/views/toolbar_star_toggle.h"
+#include "chrome/browser/views/toolbar_view.h"
+#include "chrome/common/l10n_util.h"
+#include "generated_resources.h"
+
+// Status Bubble metrics.
+static const int kStatusBubbleHeight = 20;
+static const int kStatusBubbleOffset = 2;
///////////////////////////////////////////////////////////////////////////////
// BrowserView, public:
-BrowserView::BrowserView(ChromeViews::Window* window,
+BrowserView::BrowserView(BrowserWindow* frame,
+ Browser* browser,
+ ChromeViews::Window* window,
ChromeViews::View* contents_view)
- : ClientView(window, contents_view) {
+ : frame_(frame),
+ browser_(browser),
+ initialized_(false)
+/* ,
+ ClientView(window, contents_view) */ {
}
BrowserView::~BrowserView() {
}
+void BrowserView::LayoutStatusBubble(int status_bubble_y) {
+ status_bubble_->SetBounds(kStatusBubbleOffset,
+ status_bubble_y - kStatusBubbleHeight +
+ kStatusBubbleOffset,
+ GetWidth() / 3,
+ kStatusBubbleHeight);
+}
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindow implementation:
void BrowserView::Init() {
+ SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
+ toolbar_ = new BrowserToolbarView(browser_->controller(), browser_);
+ AddChildView(toolbar_);
+ toolbar_->SetID(VIEW_ID_TOOLBAR);
+ toolbar_->Init(browser_->profile());
+ toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR));
+
+ status_bubble_.reset(new StatusBubble(GetViewContainer()));
}
void BrowserView::Show(int command, bool adjust_to_fit) {
-
+ frame_->Show(command, adjust_to_fit);
}
void BrowserView::BrowserDidPaint(HRGN region) {
-
+ frame_->BrowserDidPaint(region);
}
void BrowserView::Close() {
-
+ frame_->Close();
}
void* BrowserView::GetPlatformID() {
- return NULL;
+ return frame_->GetPlatformID();
}
TabStrip* BrowserView::GetTabStrip() const {
- return NULL;
+ return frame_->GetTabStrip();
}
StatusBubble* BrowserView::GetStatusBubble() {
- return NULL;
+ return status_bubble_.get();
}
ChromeViews::RootView* BrowserView::GetRootView() {
- return NULL;
+ return frame_->GetRootView();
}
void BrowserView::ShelfVisibilityChanged() {
-
+ frame_->ShelfVisibilityChanged();
}
void BrowserView::SelectedTabToolbarSizeChanged(bool is_animating) {
-
+ frame_->SelectedTabToolbarSizeChanged(is_animating);
}
void BrowserView::UpdateTitleBar() {
-
+ frame_->UpdateTitleBar();
}
void BrowserView::SetWindowTitle(const std::wstring& title) {
-
+ frame_->SetWindowTitle(title);
}
void BrowserView::Activate() {
-
+ frame_->Activate();
}
void BrowserView::FlashFrame() {
-
+ frame_->FlashFrame();
}
void BrowserView::ShowTabContents(TabContents* contents) {
-
+ frame_->ShowTabContents(contents);
}
void BrowserView::ContinueDetachConstrainedWindowDrag(
const gfx::Point& mouse_pt,
int frame_component) {
-
+ frame_->ContinueDetachConstrainedWindowDrag(mouse_pt, frame_component);
}
void BrowserView::SizeToContents(const gfx::Rect& contents_bounds) {
-
+ frame_->SizeToContents(contents_bounds);
}
void BrowserView::SetAcceleratorTable(
std::map<ChromeViews::Accelerator, int>* accelerator_table) {
-
+ frame_->SetAcceleratorTable(accelerator_table);
}
void BrowserView::ValidateThrobber() {
-
+ frame_->ValidateThrobber();
}
gfx::Rect BrowserView::GetNormalBounds() {
- return gfx::Rect();
+ return frame_->GetNormalBounds();
}
bool BrowserView::IsMaximized() {
- return false;
+ return frame_->IsMaximized();
}
gfx::Rect BrowserView::GetBoundsForContentBounds(const gfx::Rect content_rect) {
- return gfx::Rect();
-}
-
-void BrowserView::SetBounds(const gfx::Rect& bounds) {
-
+ return frame_->GetBoundsForContentBounds(content_rect);
}
void BrowserView::DetachFromBrowser() {
-
+ frame_->DetachFromBrowser();
}
void BrowserView::InfoBubbleShowing() {
-
+ frame_->InfoBubbleShowing();
}
void BrowserView::InfoBubbleClosing() {
-
+ frame_->InfoBubbleClosing();
}
ToolbarStarToggle* BrowserView::GetStarButton() const {
- return NULL;
+ return toolbar_->star_button();
}
LocationBarView* BrowserView::GetLocationBarView() const {
- return NULL;
+ return toolbar_->GetLocationBarView();
}
GoButton* BrowserView::GetGoButton() const {
- return NULL;
+ return toolbar_->GetGoButton();
}
BookmarkBarView* BrowserView::GetBookmarkBarView() {
+ return frame_->GetBookmarkBarView();
+}
+
+BrowserView* BrowserView::GetBrowserView() const {
return NULL;
}
void BrowserView::Update(TabContents* contents, bool should_restore_state) {
-
+ toolbar_->Update(contents, should_restore_state);
}
void BrowserView::ProfileChanged(Profile* profile) {
-
+ toolbar_->SetProfile(profile);
}
void BrowserView::FocusToolbar() {
-
+ toolbar_->RequestFocus();
}
void BrowserView::DestroyBrowser() {
-
+ frame_->DestroyBrowser();
}
///////////////////////////////////////////////////////////////////////////////
// BrowserView, ChromeViews::ClientView overrides:
+/*
bool BrowserView::CanClose() const {
return true;
}
@@ -201,17 +233,27 @@ bool BrowserView::CanClose() const {
int BrowserView::NonClientHitTest(const gfx::Point& point) {
return HTCLIENT;
}
+*/
///////////////////////////////////////////////////////////////////////////////
// BrowserView, ChromeViews::View overrides:
void BrowserView::Layout() {
+ toolbar_->SetBounds(0, 0, GetWidth(), GetHeight());
+}
+void BrowserView::DidChangeBounds(const CRect& previous,
+ const CRect& current) {
+ Layout();
}
void BrowserView::ViewHierarchyChanged(bool is_add,
ChromeViews::View* parent,
ChromeViews::View* child) {
-
-
+ if (is_add && child == this && GetViewContainer() && !initialized_) {
+ Init();
+ // Make sure not to call Init() twice if we get inserted into a different
+ // ViewContainer.
+ initialized_ = true;
+ }
}
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 7f59388..5920ed7 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -36,6 +36,9 @@
// NOTE: For more information about the objects and files in this directory,
// view: https://sites.google.com/a/google.com/the-chrome-project/developers/design-documents/browser-window
+class Browser;
+class BrowserToolbarView;
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView
//
@@ -43,11 +46,19 @@
// including the TabStrip, toolbars, download shelves, the content area etc.
//
class BrowserView : public BrowserWindow,
- public ChromeViews::ClientView {
+/* public ChromeViews::ClientView */
+ public ChromeViews::View {
public:
- BrowserView(ChromeViews::Window* window, ChromeViews::View* contents_view);
+ BrowserView(BrowserWindow* frame,
+ Browser* browser,
+ ChromeViews::Window* window,
+ ChromeViews::View* contents_view);
virtual ~BrowserView();
+ // TODO(beng): remove this once all layout is done inside this object.
+ // Layout the Status bubble relative to position.
+ void LayoutStatusBubble(int status_bubble_y);
+
// Overridden from BrowserWindow:
virtual void Init();
virtual void Show(int command, bool adjust_to_fit);
@@ -74,7 +85,6 @@ class BrowserView : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void SetBounds(const gfx::Rect& bounds);
virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual void InfoBubbleClosing();
@@ -82,23 +92,43 @@ class BrowserView : public BrowserWindow,
virtual LocationBarView* GetLocationBarView() const;
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
+ virtual BrowserView* GetBrowserView() const;
virtual void Update(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
virtual void DestroyBrowser();
+ /*
// Overridden from ChromeViews::ClientView:
virtual bool CanClose() const;
virtual int NonClientHitTest(const gfx::Point& point);
+ */
- protected:
// Overridden from ChromeViews::View:
virtual void Layout();
+ virtual void DidChangeBounds(const CRect& previous, const CRect& current);
virtual void ViewHierarchyChanged(bool is_add,
ChromeViews::View* parent,
ChromeViews::View* child);
private:
+ // The Browser object we are associated with.
+ // TODO(beng): (Cleanup) this should become a scoped_ptr.
+ Browser* browser_;
+
+ // The Toolbar containing the navigation buttons, menus and the address bar.
+ BrowserToolbarView* toolbar_;
+
+ // The Status information bubble that appears at the bottom of the window.
+ scoped_ptr<StatusBubble> status_bubble_;
+
+ // Temporary pointer to containing BrowserWindow.
+ // TODO(beng): convert this to a BrowserFrame*.
+ BrowserWindow* frame_;
+
+ // True if we have already been initialized.
+ bool initialized_;
+
DISALLOW_EVIL_CONSTRUCTORS(BrowserView);
};
diff --git a/chrome/browser/views/frame/browser_window_factory.cc b/chrome/browser/views/frame/browser_window_factory.cc
new file mode 100644
index 0000000..0742245
--- /dev/null
+++ b/chrome/browser/views/frame/browser_window_factory.cc
@@ -0,0 +1,52 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/frame_util.h"
+#include "chrome/browser/views/frame/browser_view.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// BrowserWindow, public:
+
+// static
+BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser,
+ const gfx::Rect& bounds,
+ int show_command) {
+ // TODO(beng): fix this hack.
+ // To get us off the ground and allow us to incrementally migrate
+ // BrowserWindow functionality from XP/VistaFrame to BrowserView,
+ // all objects need to implement the BrowserWindow interface.
+ // However BrowserView is the one that Browser has a ref to, and
+ // calls that BrowserView can't perform directly are passed on to
+ // its frame. Eventually this will be better, I promise.
+ BrowserWindow* window = FrameUtil::CreateBrowserWindow(bounds, browser);
+ return window->GetBrowserView();
+}
+
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index cc99296..056cbfe 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -343,6 +343,11 @@ void BrowserToolbarView::Layout() {
page_menu_->GetY(), sz.cx, go_->GetHeight());
}
+void BrowserToolbarView::DidChangeBounds(const CRect& previous,
+ const CRect& current) {
+ Layout();
+}
+
void BrowserToolbarView::DidGainFocus() {
// Find first accessible child (-1 for start search at parent).
int first_acc_child = GetNextAccessibleViewIndex(-1, false);
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index 29d9f19..6869a59 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -72,6 +72,7 @@ class BrowserToolbarView : public ChromeViews::View,
// ChromeViews::View
virtual void Layout();
+ virtual void DidChangeBounds(const CRect& previous, const CRect& current);
virtual void DidGainFocus();
virtual void WillLoseFocus();
virtual bool OnKeyPressed(const ChromeViews::KeyEvent& e);
diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc
index 1ac4d0e..f4b7aa4 100644
--- a/chrome/browser/vista_frame.cc
+++ b/chrome/browser/vista_frame.cc
@@ -51,7 +51,7 @@
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/browser/views/download_shelf_view.h"
-#include "chrome/browser/views/toolbar_view.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/l10n_util.h"
@@ -79,10 +79,6 @@ static const int kResizeBorder = 5;
static const int kTitlebarHeight = 14;
static const int kTabShadowSize = 2;
-// Status Bubble metrics.
-static const int kStatusBubbleHeight = 20;
-static const int kStatusBubbleOffset = 2;
-
// The line drawn to separate tab end contents.
static const int kSeparationLineHeight = 1;
@@ -143,7 +139,6 @@ VistaFrame::VistaFrame(Browser* browser)
: browser_(browser),
root_view_(this, true),
tabstrip_(NULL),
- toolbar_(NULL),
active_bookmark_bar_(NULL),
tab_contents_container_(NULL),
custom_window_enabled_(false),
@@ -157,7 +152,8 @@ VistaFrame::VistaFrame(Browser* browser)
is_off_the_record_(false),
off_the_record_image_(NULL),
ignore_ncactivate_(false),
- should_save_window_placement_(browser->GetType() != BrowserType::BROWSER) {
+ should_save_window_placement_(browser->GetType() != BrowserType::BROWSER),
+ browser_view_(NULL) {
InitializeIfNeeded();
}
@@ -275,18 +271,18 @@ void VistaFrame::Layout() {
int toolbar_bottom;
if (IsToolBarVisible()) {
- toolbar_->SetVisible(true);
- toolbar_->SetBounds(g_bitmaps[CT_LEFT_SIDE]->width(),
- tabstrip_->GetY() + tabstrip_->GetHeight() -
- kToolbarOverlapVertOffset,
- width - g_bitmaps[CT_LEFT_SIDE]->width() -
- g_bitmaps[CT_RIGHT_SIDE]->width(),
- g_bitmaps[CT_TOP_CENTER]->height());
- toolbar_->Layout();
- toolbar_bottom = toolbar_->GetY() + toolbar_->GetHeight();
+ browser_view_->SetVisible(true);
+ browser_view_->SetBounds(g_bitmaps[CT_LEFT_SIDE]->width(),
+ tabstrip_->GetY() + tabstrip_->GetHeight() -
+ kToolbarOverlapVertOffset,
+ width - g_bitmaps[CT_LEFT_SIDE]->width() -
+ g_bitmaps[CT_RIGHT_SIDE]->width(),
+ g_bitmaps[CT_TOP_CENTER]->height());
+ browser_view_->Layout();
+ toolbar_bottom = browser_view_->GetY() + browser_view_->GetHeight();
} else {
- toolbar_->SetBounds(0, 0, 0, 0);
- toolbar_->SetVisible(false);
+ browser_view_->SetBounds(0, 0, 0, 0);
+ browser_view_->SetVisible(false);
toolbar_bottom = tabstrip_->GetY() + tabstrip_->GetHeight();
}
int browser_x, browser_y;
@@ -379,11 +375,7 @@ void VistaFrame::Layout() {
browser_w,
browser_h);
- status_bubble_->SetBounds(browser_x - kStatusBubbleOffset,
- browser_y + browser_h - kStatusBubbleHeight +
- kStatusBubbleOffset,
- width / 3,
- kStatusBubbleHeight);
+ browser_view_->LayoutStatusBubble(browser_y + browser_h);
frame_view_->SchedulePaint();
}
@@ -406,12 +398,9 @@ void VistaFrame::Init() {
root_view_.SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
frame_view_->SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
- toolbar_ = new BrowserToolbarView(browser_->controller(), browser_);
- frame_view_->AddChildView(toolbar_);
- toolbar_->SetID(VIEW_ID_TOOLBAR);
- toolbar_->Init(browser_->profile());
- toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR));
-
+ browser_view_ = new BrowserView(this, browser_, NULL, NULL);
+ frame_view_->AddChildView(browser_view_);
+
tabstrip_ = CreateTabStrip(browser_);
tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
frame_view_->AddChildView(tabstrip_);
@@ -432,8 +421,6 @@ void VistaFrame::Init() {
tab_contents_container_ = new TabContentsContainerView();
frame_view_->AddChildView(tab_contents_container_);
- status_bubble_.reset(new StatusBubble(this));
-
// Add the task manager item to the system menu before the last entry.
task_manager_label_text_ = l10n_util::GetString(IDS_TASKMANAGER);
HMENU system_menu = ::GetSystemMenu(m_hWnd, FALSE);
@@ -604,11 +591,6 @@ gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) {
return r;
}
-void VistaFrame::SetBounds(const gfx::Rect& bounds) {
- SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(),
- SWP_NOZORDER | SWP_NOACTIVATE);
-}
-
void VistaFrame::DetachFromBrowser() {
browser_->tabstrip_model()->RemoveObserver(tabstrip_);
browser_ = NULL;
@@ -619,15 +601,15 @@ void VistaFrame::InfoBubbleShowing() {
}
ToolbarStarToggle* VistaFrame::GetStarButton() const {
- return toolbar_->star_button();
+ return NULL;
}
LocationBarView* VistaFrame::GetLocationBarView() const {
- return toolbar_->GetLocationBarView();
+ return NULL;
}
GoButton* VistaFrame::GetGoButton() const {
- return toolbar_->GetGoButton();
+ return NULL;
}
BookmarkBarView* VistaFrame::GetBookmarkBarView() {
@@ -646,16 +628,17 @@ BookmarkBarView* VistaFrame::GetBookmarkBarView() {
return bookmark_bar_view_.get();
}
+BrowserView* VistaFrame::GetBrowserView() const {
+ return browser_view_;
+}
+
void VistaFrame::Update(TabContents* contents, bool should_restore_state) {
- toolbar_->Update(contents, should_restore_state);
}
void VistaFrame::ProfileChanged(Profile* profile) {
- toolbar_->SetProfile(profile);
}
void VistaFrame::FocusToolbar() {
- toolbar_->RequestFocus();
}
////////////////////////////////////////////////////////////////////////////////
@@ -1391,7 +1374,7 @@ ChromeViews::TooltipManager* VistaFrame::GetTooltipManager() {
}
StatusBubble* VistaFrame::GetStatusBubble() {
- return status_bubble_.get();
+ return NULL;
}
void VistaFrame::InitAfterHWNDCreated() {
@@ -1412,7 +1395,7 @@ void VistaFrame::ResetDWMFrame() {
g_bitmaps[CT_TOP_RIGHT_CORNER]->width(),
kDwmBorderSize +
IsToolBarVisible() ?
- toolbar_->GetY() + kToolbarOverlapVertOffset :
+ browser_view_->GetY() + kToolbarOverlapVertOffset :
tabstrip_->GetHeight(),
kDwmBorderSize +
g_bitmaps[CT_BOTTOM_CENTER]->height()};
diff --git a/chrome/browser/vista_frame.h b/chrome/browser/vista_frame.h
index cb9fdff..40a1dc2 100644
--- a/chrome/browser/vista_frame.h
+++ b/chrome/browser/vista_frame.h
@@ -51,7 +51,7 @@
class BookmarkBarView;
class Browser;
-class BrowserToolbarView;
+class BrowserView;
class TabContentsContainerView;
class ChromeViews::FocusManager;
class SkBitmap;
@@ -201,13 +201,13 @@ class VistaFrame : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void SetBounds(const gfx::Rect& bounds);
virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual ToolbarStarToggle* GetStarButton() const;
virtual LocationBarView* GetLocationBarView() const;
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
+ virtual BrowserView* GetBrowserView() const;
virtual void Update(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
@@ -370,9 +370,6 @@ class VistaFrame : public BrowserWindow,
// The view that contains the tabs and any associated controls.
TabStrip* tabstrip_;
- // The Toolbar containing the navigation buttons, menus and the address bar.
- BrowserToolbarView* toolbar_;
-
// The bookmark bar. This is lazily created.
scoped_ptr<BookmarkBarView> bookmark_bar_view_;
@@ -417,8 +414,6 @@ class VistaFrame : public BrowserWindow,
static bool g_initialized;
static SkBitmap** g_bitmaps;
- scoped_ptr<StatusBubble> status_bubble_;
-
// Instance of accessibility information and handling for MSAA root
CComPtr<IAccessible> accessibility_root_;
@@ -436,6 +431,9 @@ class VistaFrame : public BrowserWindow,
// like unconstrained popups. Defaults to true.
bool should_save_window_placement_;
+ // A view that holds the client-area contents of the browser window.
+ BrowserView* browser_view_;
+
DISALLOW_EVIL_CONSTRUCTORS(VistaFrame);
};
#endif // CHROME_BROWSER_VISTA_FRAME_H__
diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc
index 8ccd5b9..79cd852 100644
--- a/chrome/browser/xp_frame.cc
+++ b/chrome/browser/xp_frame.cc
@@ -46,7 +46,7 @@
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/browser/views/download_shelf_view.h"
-#include "chrome/browser/views/toolbar_view.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/window_clipping_info.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/gfx/chrome_canvas.h"
@@ -114,10 +114,6 @@ static const int kMinTitleBarHeight = 25;
static const int kOTRImageHorizMargin = 2;
static const int kOTRImageVertMargin = 2;
-// Status Bubble metrics.
-static const int kStatusBubbleHeight = 20;
-static const int kStatusBubbleOffset = 2;
-
// The line drawn to separate tab end contents.
static const int kSeparationLineHeight = 1;
static const SkColor kSeparationLineColor = SkColorSetRGB(178, 178, 178);
@@ -343,7 +339,6 @@ XPFrame::XPFrame(Browser* browser)
root_view_(this, true),
frame_view_(NULL),
tabstrip_(NULL),
- toolbar_(NULL),
active_bookmark_bar_(NULL),
tab_contents_container_(NULL),
min_button_(NULL),
@@ -365,7 +360,8 @@ XPFrame::XPFrame(Browser* browser)
title_bar_height_(0),
off_the_record_image_(NULL),
ignore_ncactivate_(false),
- paint_as_active_(false) {
+ paint_as_active_(false),
+ browser_view_(NULL) {
InitializeIfNeeded();
}
@@ -382,7 +378,7 @@ ChromeViews::TooltipManager* XPFrame::GetTooltipManager() {
}
StatusBubble* XPFrame::GetStatusBubble() {
- return status_bubble_.get();
+ return NULL;
}
void XPFrame::InitializeIfNeeded() {
@@ -440,11 +436,8 @@ void XPFrame::Init() {
root_view_.SetBackground(
ChromeViews::Background::CreateSolidBackground(SK_ColorWHITE));
- toolbar_ = new BrowserToolbarView(browser_->controller(), browser_);
- frame_view_->AddChildView(toolbar_);
- toolbar_->SetID(VIEW_ID_TOOLBAR);
- toolbar_->Init(browser_->profile());
- toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR));
+ browser_view_ = new BrowserView(this, browser_, NULL, NULL);
+ frame_view_->AddChildView(browser_view_);
tabstrip_ = CreateTabStrip(browser_);
tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
@@ -515,8 +508,6 @@ void XPFrame::Init() {
l10n_util::GetString(IDS_XPFRAME_CLOSE_TOOLTIP));
frame_view_->AddChildView(close_button_);
- status_bubble_.reset(new StatusBubble(this));
-
// Add the task manager item to the system menu before the last entry.
task_manager_label_text_ = l10n_util::GetString(IDS_TASKMANAGER);
HMENU system_menu = ::GetSystemMenu(m_hWnd, FALSE);
@@ -714,14 +705,14 @@ void XPFrame::Layout() {
}
if (IsToolBarVisible()) {
- toolbar_->SetVisible(true);
- toolbar_->SetBounds(left_margin,
- last_y - kToolbarOverlapVertOffset,
- width - left_margin - right_margin,
- bitmaps[CT_TOP_CENTER]->height());
- toolbar_->Layout();
- title_bar_height_ = toolbar_->GetY();
- last_y = toolbar_->GetY() + toolbar_->GetHeight();
+ browser_view_->SetVisible(true);
+ browser_view_->SetBounds(left_margin,
+ last_y - kToolbarOverlapVertOffset,
+ width - left_margin - right_margin,
+ bitmaps[CT_TOP_CENTER]->height());
+ browser_view_->Layout();
+ title_bar_height_ = browser_view_->GetY();
+ last_y = browser_view_->GetY() + browser_view_->GetHeight();
} else {
// If the tab strip is visible, we need to expose the toolbar for a small
// offset. (kCollapsedToolbarHeight).
@@ -733,7 +724,7 @@ void XPFrame::Layout() {
close_button_->GetY() + close_button_->GetHeight());
title_bar_height_ = last_y;
}
- toolbar_->SetVisible(false);
+ browser_view_->SetVisible(false);
}
int browser_h = height - last_y - bottom_margin;
@@ -812,11 +803,7 @@ void XPFrame::Layout() {
width - left_margin - right_margin,
browser_h);
- status_bubble_->SetBounds(left_margin - kStatusBubbleOffset,
- last_y + browser_h - kStatusBubbleHeight +
- kStatusBubbleOffset,
- width / 3,
- kStatusBubbleHeight);
+ browser_view_->LayoutStatusBubble(last_y + browser_h);
frame_view_->SchedulePaint();
}
@@ -1827,11 +1814,6 @@ gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) {
return r;
}
-void XPFrame::SetBounds(const gfx::Rect& bounds) {
- SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(),
- SWP_NOZORDER | SWP_NOACTIVATE);
-}
-
void XPFrame::DetachFromBrowser() {
browser_->tabstrip_model()->RemoveObserver(tabstrip_);
browser_ = NULL;
@@ -1851,15 +1833,15 @@ void XPFrame::InfoBubbleClosing() {
}
ToolbarStarToggle* XPFrame::GetStarButton() const {
- return toolbar_->star_button();
+ return browser_view_->GetStarButton();
}
LocationBarView* XPFrame::GetLocationBarView() const {
- return toolbar_->GetLocationBarView();
+ return browser_view_->GetLocationBarView();
}
GoButton* XPFrame::GetGoButton() const {
- return toolbar_->GetGoButton();
+ return browser_view_->GetGoButton();
}
BookmarkBarView* XPFrame::GetBookmarkBarView() {
@@ -1878,16 +1860,20 @@ BookmarkBarView* XPFrame::GetBookmarkBarView() {
return bookmark_bar_view_.get();
}
+BrowserView* XPFrame::GetBrowserView() const {
+ return browser_view_;
+}
+
void XPFrame::Update(TabContents* contents, bool should_restore_state) {
- toolbar_->Update(contents, should_restore_state);
+ browser_view_->Update(contents, should_restore_state);
}
void XPFrame::ProfileChanged(Profile* profile) {
- toolbar_->SetProfile(profile);
+ browser_view_->ProfileChanged(profile);
}
void XPFrame::FocusToolbar() {
- toolbar_->RequestFocus();
+ browser_view_->FocusToolbar();
}
void XPFrame::MoveToFront(bool should_activate) {
@@ -2212,7 +2198,7 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) {
int y;
bool should_draw_separator = false;
if (parent_->IsToolBarVisible()) {
- y = parent_->toolbar_->GetY();
+ y = parent_->browser_view_->GetY();
} else if (parent_->IsTabStripVisible()) {
y = parent_->GetContentsYOrigin() - kCollapsedToolbarHeight -
kToolbarOverlapVertOffset;
@@ -2225,8 +2211,8 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) {
PaintFrameBorder(canvas);
int y, height;
if (parent_->IsToolBarVisible()) {
- y = parent_->toolbar_->GetY();
- height = GetHeight() - (parent_->toolbar_->GetY() +
+ y = parent_->browser_view_->GetY();
+ height = GetHeight() - (parent_->browser_view_->GetY() +
kContentBorderVertBottomOffset);
} else {
if (parent_->IsTabStripVisible()) {
diff --git a/chrome/browser/xp_frame.h b/chrome/browser/xp_frame.h
index b5f96ff..6a443e4 100644
--- a/chrome/browser/xp_frame.h
+++ b/chrome/browser/xp_frame.h
@@ -49,9 +49,9 @@
#define XP_FRAME_CLASSNAME L"Chrome_XPFrame"
+class BrowserView;
class BookmarkBarView;
class Browser;
-class BrowserToolbarView;
class TabContentsContainerView;
class TabStrip;
class TemporaryPlaceholder;
@@ -106,7 +106,6 @@ class XPFrame : public BrowserWindow,
virtual gfx::Rect GetNormalBounds();
virtual bool IsMaximized();
virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect);
- virtual void SetBounds(const gfx::Rect& bounds);
virtual void DetachFromBrowser();
virtual void InfoBubbleShowing();
virtual void InfoBubbleClosing();
@@ -114,6 +113,7 @@ class XPFrame : public BrowserWindow,
virtual LocationBarView* GetLocationBarView() const;
virtual GoButton* GetGoButton() const;
virtual BookmarkBarView* GetBookmarkBarView();
+ virtual BrowserView* GetBrowserView() const;
virtual void Update(TabContents* contents, bool should_restore_state);
virtual void ProfileChanged(Profile* profile);
virtual void FocusToolbar();
@@ -493,9 +493,6 @@ class XPFrame : public BrowserWindow,
// The view that contains the tabs and any associated controls.
TabStrip* tabstrip_;
- // The Toolbar containing the navigation buttons, menus and the address bar.
- BrowserToolbarView* toolbar_;
-
// The bookmark bar. This is lazily created.
scoped_ptr<BookmarkBarView> bookmark_bar_view_;
@@ -522,8 +519,6 @@ class XPFrame : public BrowserWindow,
static SkBitmap** g_bitmaps;
static SkBitmap** g_otr_bitmaps;
- scoped_ptr<StatusBubble> status_bubble_;
-
// Instance of accessibility information and handling for MSAA root
CComPtr<IAccessible> accessibility_root_;
@@ -531,6 +526,9 @@ class XPFrame : public BrowserWindow,
bool ignore_ncactivate_;
bool paint_as_active_;
+ // A view that holds the client-area contents of the browser window.
+ BrowserView* browser_view_;
+
DISALLOW_EVIL_CONSTRUCTORS(XPFrame);
};
diff --git a/chrome/test/accessibility/accessibility_util.cc b/chrome/test/accessibility/accessibility_util.cc
index 43a79a8..0f4bbd6 100644
--- a/chrome/test/accessibility/accessibility_util.cc
+++ b/chrome/test/accessibility/accessibility_util.cc
@@ -181,6 +181,8 @@ HRESULT GetChildWndOf(std::wstring parent_name, unsigned int child_index,
IAccessible *pi_parent = NULL;
if (0 == parent_name.compare(BROWSER_STR))
GetChromeBrowserWnd(&pi_parent);
+ if (0 == parent_name.compare(BROWSER_VIEW_STR))
+ GetBrowserViewWnd(&pi_parent);
if (0 == parent_name.compare(TOOLBAR_STR))
GetToolbarWnd(&pi_parent);
if (0 == parent_name.compare(TABSTRIP_STR))
@@ -223,8 +225,12 @@ HRESULT GetTabStripWnd(IAccessible** ppi_access) {
return GetChildWndOf(BROWSER_STR, TABSTRIP_ACC_INDEX, ppi_access, NULL);
}
+HRESULT GetBrowserViewWnd(IAccessible** ppi_access) {
+ return GetChildWndOf(BROWSER_STR, BROWSER_VIEW_ACC_INDEX, ppi_access, NULL);
+}
+
HRESULT GetToolbarWnd(IAccessible** ppi_access) {
- return GetChildWndOf(BROWSER_STR, TOOLBAR_ACC_INDEX, ppi_access, NULL);
+ return GetChildWndOf(BROWSER_VIEW_STR, TOOLBAR_ACC_INDEX, ppi_access, NULL);
}
HRESULT GetBrowserMinimizeButton(IAccessible** ppi_access,
diff --git a/chrome/test/accessibility/accessibility_util.h b/chrome/test/accessibility/accessibility_util.h
index 77d0f03..40ba183 100644
--- a/chrome/test/accessibility/accessibility_util.h
+++ b/chrome/test/accessibility/accessibility_util.h
@@ -54,6 +54,9 @@ HRESULT GetChildWndOf(std::wstring parent_name, unsigned int child_index,
// Returns IAccessible pointer for Tabstrip. It does not have window handle.
HRESULT GetTabStripWnd(IAccessible** ppi_access);
+// Returns IAccessible pointer for BrowserView. It does not have window handle.
+HRESULT GetBrowserViewWnd(IAccessible** ppi_access);
+
// Returns IAccessible pointer for Toolbar. It does not have window handle.
HRESULT GetToolbarWnd(IAccessible** ppi_access);
diff --git a/chrome/test/accessibility/constants.h b/chrome/test/accessibility/constants.h
index bb60d9e..3e2947a 100644
--- a/chrome/test/accessibility/constants.h
+++ b/chrome/test/accessibility/constants.h
@@ -60,13 +60,16 @@
#define CHROME_CLIENT_ACC_INDEX (0)
// Chrome Client chidren.
-#define TOOLBAR_ACC_INDEX (0)
+#define BROWSER_VIEW_ACC_INDEX (0)
#define TABSTRIP_ACC_INDEX (1)
#define CHROME_MIN_ACC_INDEX (3)
#define CHROME_MAX_ACC_INDEX (4)
#define CHROME_RESTORE_ACC_INDEX (5)
#define CHROME_CLOSE_ACC_INDEX (6)
+// Browser View children.
+#define TOOLBAR_ACC_INDEX (0)
+
// Toolbar children.
#define BACK_BTN_INDEX (0)
#define FORWARD_BTN_INDEX (1)
@@ -85,6 +88,7 @@
#define TOOLBAR_STR _T("toolbar")
#define TABSTRIP_STR _T("tabstrip")
#define TAB_STR _T("tab")
+#define BROWSER_VIEW_STR _T("browser_view")
// Enums for keyboard keys. These values are directed to virtual-key values.
enum KEYBD_KEYS {