diff options
Diffstat (limited to 'chrome/browser')
17 files changed, 160 insertions, 213 deletions
diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc index 2224068..f403694 100644 --- a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc +++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc @@ -29,11 +29,6 @@ BrowserFrameChromeos::~BrowserFrameChromeos() { } void BrowserFrameChromeos::InitBrowserFrame() { - // NOTE: This logic supersedes the logic in BrowserFrameGtk::Init() - // by always setting browser_frame_view_. - set_browser_frame_view( - browser::CreateBrowserNonClientFrameView(this, browser_view())); - BrowserFrameGtk::InitBrowserFrame(); if (!browser_view()->IsBrowserTypePopup()) { diff --git a/chrome/browser/chromeos/frame/panel_browser_view.cc b/chrome/browser/chromeos/frame/panel_browser_view.cc index 657039e..9a601f9 100644 --- a/chrome/browser/chromeos/frame/panel_browser_view.cc +++ b/chrome/browser/chromeos/frame/panel_browser_view.cc @@ -96,8 +96,8 @@ bool PanelBrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { return res; } -void PanelBrowserView::OnWindowActivate(bool active) { - ::BrowserView::OnWindowActivate(active); +void PanelBrowserView::OnWindowActivationChanged(bool active) { + ::BrowserView::OnWindowActivationChanged(active); if (panel_controller_.get()) { if (active) panel_controller_->OnFocusIn(); diff --git a/chrome/browser/chromeos/frame/panel_browser_view.h b/chrome/browser/chromeos/frame/panel_browser_view.h index cb51c3e..eec101d 100644 --- a/chrome/browser/chromeos/frame/panel_browser_view.h +++ b/chrome/browser/chromeos/frame/panel_browser_view.h @@ -32,7 +32,7 @@ class PanelBrowserView : public ::BrowserView, virtual void UpdateTitleBar(); virtual void SetCreatorView(PanelBrowserView* creator); virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const; - virtual void OnWindowActivate(bool active); + virtual void OnWindowActivationChanged(bool active); // PanelController::Delegate overrides virtual string16 GetPanelTitle(); diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc index 97b68ed..a151502 100644 --- a/chrome/browser/chromeos/login/user_controller.cc +++ b/chrome/browser/chromeos/login/user_controller.cc @@ -268,7 +268,7 @@ void UserController::UpdateUserCount(int index, int total_user_count) { //////////////////////////////////////////////////////////////////////////////// // UserController, WidgetDelegate implementation: // -void UserController::IsActiveChanged(bool active) { +void UserController::OnWidgetActivated(bool active) { is_user_selected_ = active; if (active) { delegate_->OnUserSelected(this); diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h index bab0971..28250a1 100644 --- a/chrome/browser/chromeos/login/user_controller.h +++ b/chrome/browser/chromeos/login/user_controller.h @@ -103,22 +103,22 @@ class UserController : public views::WidgetDelegate, void UpdateUserCount(int index, int total_user_count); // views::WidgetDelegate implementation: - virtual void IsActiveChanged(bool active); + virtual void OnWidgetActivated(bool active) OVERRIDE; // NewUserView::Delegate implementation: virtual void OnLogin(const std::string& username, - const std::string& password); - virtual void OnLoginAsGuest(); - virtual void OnCreateAccount(); - virtual void ClearErrors(); - virtual void NavigateAway(); + const std::string& password) OVERRIDE; + virtual void OnLoginAsGuest() OVERRIDE; + virtual void OnCreateAccount() OVERRIDE; + virtual void ClearErrors() OVERRIDE; + virtual void NavigateAway() OVERRIDE; // UserView::Delegate implementation: - virtual void OnRemoveUser(); - virtual bool IsUserSelected() const { return is_user_selected_; } + virtual void OnRemoveUser() OVERRIDE; + virtual bool IsUserSelected() const OVERRIDE { return is_user_selected_; } // UsernameView::Delegate implementation: - virtual void OnLocaleChanged(); + virtual void OnLocaleChanged() OVERRIDE; // Padding between the user windows. static const int kPadding; diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index 9bc3a02..94d0fa7 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -4,7 +4,12 @@ #include "chrome/browser/ui/views/frame/browser_frame.h" +#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" +#include "chrome/browser/ui/views/frame/browser_root_view.h" +#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/native_browser_frame.h" +#include "views/widget/native_widget.h" +#include "views/widget/widget.h" #include "views/window/native_window.h" #include "views/window/window.h" @@ -23,15 +28,15 @@ int BrowserFrame::GetMinimizeButtonOffset() const { } gfx::Rect BrowserFrame::GetBoundsForTabStrip(views::View* tabstrip) const { - return native_browser_frame_->GetBoundsForTabStrip(tabstrip); + return browser_frame_view_->GetBoundsForTabStrip(tabstrip); } int BrowserFrame::GetHorizontalTabStripVerticalOffset(bool restored) const { - return native_browser_frame_->GetHorizontalTabStripVerticalOffset(restored); + return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored); } void BrowserFrame::UpdateThrobber(bool running) { - native_browser_frame_->UpdateThrobber(running); + browser_frame_view_->UpdateThrobber(running); } ui::ThemeProvider* BrowserFrame::GetThemeProviderForFrame() const { @@ -43,7 +48,7 @@ bool BrowserFrame::AlwaysUseNativeFrame() const { } views::View* BrowserFrame::GetFrameView() const { - return native_browser_frame_->GetFrameView(); + return browser_frame_view_; } void BrowserFrame::TabStripDisplayModeChanged() { @@ -51,7 +56,28 @@ void BrowserFrame::TabStripDisplayModeChanged() { } //////////////////////////////////////////////////////////////////////////////// +// BrowserFrame, NativeBrowserFrameDelegate implementation: + +views::RootView* BrowserFrame::DelegateCreateRootView() { + root_view_ = new BrowserRootView( + browser_view_, + native_browser_frame_->AsNativeWindow()->AsNativeWidget()->GetWidget()); + return root_view_; +} + +views::NonClientFrameView* BrowserFrame::DelegateCreateFrameViewForWindow() { + browser_frame_view_ = + native_browser_frame_->CreateBrowserNonClientFrameView(); + return browser_frame_view_; +} + + +//////////////////////////////////////////////////////////////////////////////// // BrowserFrame, protected: -BrowserFrame::BrowserFrame() : native_browser_frame_(NULL) { +BrowserFrame::BrowserFrame(BrowserView* browser_view) + : native_browser_frame_(NULL), + root_view_(NULL), + browser_frame_view_(NULL), + browser_view_(browser_view) { } diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h index d58a16a..2a7ae13 100644 --- a/chrome/browser/ui/views/frame/browser_frame.h +++ b/chrome/browser/ui/views/frame/browser_frame.h @@ -6,12 +6,17 @@ #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ #pragma once +#include "base/compiler_specific.h" #include "base/logging.h" #include "build/build_config.h" #include "chrome/browser/ui/views/frame/native_browser_frame_delegate.h" +class AeroGlassNonClientView; +class BrowserNonClientFrameView; +class BrowserRootView; class BrowserView; class NativeBrowserFrame; +class NonClientFrameView; class Profile; namespace gfx { @@ -75,17 +80,33 @@ class BrowserFrame : public NativeBrowserFrameDelegate { void TabStripDisplayModeChanged(); protected: + // Overridden from NativeBrowserFrameDelegate: + virtual views::RootView* DelegateCreateRootView() OVERRIDE; + virtual views::NonClientFrameView* DelegateCreateFrameViewForWindow() + OVERRIDE; + // TODO(beng): Temporarily provided as a way to associate the subclass' // implementation of NativeBrowserFrame with this. void set_native_browser_frame(NativeBrowserFrame* native_browser_frame) { native_browser_frame_ = native_browser_frame; } - BrowserFrame(); + explicit BrowserFrame(BrowserView* browser_view); private: NativeBrowserFrame* native_browser_frame_; + // A weak reference to the root view associated with the window. We save a + // copy as a BrowserRootView to avoid evil casting later, when we need to call + // functions that only exist on BrowserRootView (versus RootView). + BrowserRootView* root_view_; + + // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. + BrowserNonClientFrameView* browser_frame_view_; + + // The BrowserView is our ClientView. This is a pointer to it. + BrowserView* browser_view_; + DISALLOW_COPY_AND_ASSIGN(BrowserFrame); }; diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.cc b/chrome/browser/ui/views/frame/browser_frame_gtk.cc index 5c4d964..c56e0fc 100644 --- a/chrome/browser/ui/views/frame/browser_frame_gtk.cc +++ b/chrome/browser/ui/views/frame/browser_frame_gtk.cc @@ -33,41 +33,23 @@ const gfx::Font& BrowserFrame::GetTitleFont() { } BrowserFrameGtk::BrowserFrameGtk(BrowserView* browser_view, Profile* profile) - : WindowGtk(browser_view), - browser_view_(browser_view), - browser_frame_view_(NULL), - root_view_(NULL), - profile_(profile) { + : BrowserFrame(browser_view), + WindowGtk(browser_view), + ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)), + browser_view_(browser_view) { set_native_browser_frame(this); browser_view_->set_frame(this); + non_client_view()->SetFrameView(CreateFrameViewForWindow()); } BrowserFrameGtk::~BrowserFrameGtk() { } void BrowserFrameGtk::InitBrowserFrame() { - if (browser_frame_view_ == NULL) - browser_frame_view_ = - browser::CreateBrowserNonClientFrameView(this, browser_view_); - - non_client_view()->SetFrameView(browser_frame_view_); WindowGtk::InitWindow(NULL, gfx::Rect()); // Don't focus anything on creation, selecting a tab will set the focus. } -ThemeProvider* BrowserFrameGtk::GetThemeProvider() const { - return profile_->GetThemeProvider(); -} - -views::RootView* BrowserFrameGtk::CreateRootView() { - root_view_ = new BrowserRootView(browser_view_, this); - return root_view_; -} - -void BrowserFrameGtk::SetInitialFocus() { - browser_view_->RestoreFocus(); -} - //////////////////////////////////////////////////////////////////////////////// // BrowserFrameGtk, NativeBrowserFrame implementation: @@ -79,23 +61,15 @@ const views::NativeWindow* BrowserFrameGtk::AsNativeWindow() const { return this; } +BrowserNonClientFrameView* BrowserFrameGtk::CreateBrowserNonClientFrameView() { + return browser::CreateBrowserNonClientFrameView(this, browser_view_); +} + int BrowserFrameGtk::GetMinimizeButtonOffset() const { NOTIMPLEMENTED(); return 0; } -gfx::Rect BrowserFrameGtk::GetBoundsForTabStrip(views::View* tabstrip) const { - return browser_frame_view_->GetBoundsForTabStrip(tabstrip); -} - -int BrowserFrameGtk::GetHorizontalTabStripVerticalOffset(bool restored) const { - return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored); -} - -void BrowserFrameGtk::UpdateThrobber(bool running) { - browser_frame_view_->UpdateThrobber(running); -} - ThemeProvider* BrowserFrameGtk::GetThemeProviderForFrame() const { // This is implemented for a different interface than GetThemeProvider is, // but they mean the same things. @@ -106,10 +80,6 @@ bool BrowserFrameGtk::AlwaysUseNativeFrame() const { return false; } -views::View* BrowserFrameGtk::GetFrameView() const { - return browser_frame_view_; -} - void BrowserFrameGtk::TabStripDisplayModeChanged() { if (GetRootView()->has_children()) { // Make sure the child of the root view gets Layout again. @@ -119,13 +89,29 @@ void BrowserFrameGtk::TabStripDisplayModeChanged() { } //////////////////////////////////////////////////////////////////////////////// -// BrowserFrameGtk, private: +// BrowserFrameGtk, WindowGtk overrides : + +ThemeProvider* BrowserFrameGtk::GetThemeProvider() const { + return browser_view_->browser()->profile()->GetThemeProvider(); +} + +void BrowserFrameGtk::SetInitialFocus() { + browser_view_->RestoreFocus(); +} + +views::RootView* BrowserFrameGtk::CreateRootView() { + return delegate_->DelegateCreateRootView(); +} bool BrowserFrameGtk::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { return browser_view_->GetAccelerator(cmd_id, accelerator); } +views::NonClientFrameView* BrowserFrameGtk::CreateFrameViewForWindow() { + return delegate_->DelegateCreateFrameViewForWindow(); +} + gboolean BrowserFrameGtk::OnWindowStateEvent(GtkWidget* widget, GdkEventWindowState* event) { bool was_full_screen = IsFullscreen(); diff --git a/chrome/browser/ui/views/frame/browser_frame_gtk.h b/chrome/browser/ui/views/frame/browser_frame_gtk.h index 78c8400..14536a1 100644 --- a/chrome/browser/ui/views/frame/browser_frame_gtk.h +++ b/chrome/browser/ui/views/frame/browser_frame_gtk.h @@ -29,56 +29,37 @@ class BrowserFrameGtk : public BrowserFrame, // constructor. virtual void InitBrowserFrame(); - // Overridden from views::Widget: - virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; - virtual void SetInitialFocus() OVERRIDE; - protected: // Overridden from NativeBrowserFrame: virtual views::NativeWindow* AsNativeWindow() OVERRIDE; virtual const views::NativeWindow* AsNativeWindow() const OVERRIDE; + virtual BrowserNonClientFrameView* CreateBrowserNonClientFrameView() OVERRIDE; virtual int GetMinimizeButtonOffset() const OVERRIDE; - virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; - virtual int GetHorizontalTabStripVerticalOffset(bool restored) const OVERRIDE; - virtual void UpdateThrobber(bool running) OVERRIDE; virtual ui::ThemeProvider* GetThemeProviderForFrame() const OVERRIDE; virtual bool AlwaysUseNativeFrame() const OVERRIDE; - virtual views::View* GetFrameView() const OVERRIDE; virtual void TabStripDisplayModeChanged() OVERRIDE; - void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) { - browser_frame_view_ = browser_frame_view; - } - - // Overridden from views::WidgetGtk: + // Overridden from views::WindowGtk: + virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; + virtual void SetInitialFocus() OVERRIDE; virtual views::RootView* CreateRootView(); virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); - - // Overriden from views::WindowGtk: + virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; virtual gboolean OnWindowStateEvent(GtkWidget* widget, GdkEventWindowState* event); virtual gboolean OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event); - protected: BrowserView* browser_view() const { return browser_view_; } private: + NativeBrowserFrameDelegate* delegate_; + // The BrowserView is our ClientView. This is a pointer to it. BrowserView* browser_view_; - // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. - BrowserNonClientFrameView* browser_frame_view_; - - // An unowning reference to the root view associated with the window. We save - // a copy as a BrowserRootView to avoid evil casting later, when we need to - // call functions that only exist on BrowserRootView (versus RootView). - BrowserRootView* root_view_; - - Profile* profile_; - DISALLOW_COPY_AND_ASSIGN(BrowserFrameGtk); }; diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index e646969..831a9c3 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -14,14 +14,13 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/themes/browser_theme_provider.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" -#include "chrome/browser/ui/views/frame/browser_root_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" #include "grit/theme_resources.h" #include "ui/gfx/font.h" #include "views/screen.h" +#include "views/widget/root_view.h" #include "views/widget/widget_win.h" -#include "views/window/window_delegate.h" #include "views/window/window_win.h" // static @@ -46,8 +45,8 @@ BrowserFrame* BrowserFrame::Create(BrowserView* browser_view, BrowserFrameWin::BrowserFrameWin(BrowserView* browser_view, Profile* profile) : WindowWin(browser_view), + BrowserFrame(browser_view), browser_view_(browser_view), - root_view_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)) { set_native_browser_frame(this); browser_view_->set_frame(this); @@ -109,39 +108,11 @@ void BrowserFrameWin::OnEndSession(BOOL ending, UINT logoff) { BrowserList::SessionEnding(); } -void BrowserFrameWin::OnEnterSizeMove() { - browser_view_->WindowMoveOrResizeStarted(); -} - -void BrowserFrameWin::OnExitSizeMove() { - views::WidgetWin::OnExitSizeMove(); -} - void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) { browser_view_->PrepareToRunSystemMenu(menu); } -void BrowserFrameWin::OnMove(const CPoint& point) { - browser_view_->WindowMoved(); -} - -void BrowserFrameWin::OnMoving(UINT param, LPRECT new_bounds) { - browser_view_->WindowMoved(); -} - -LRESULT BrowserFrameWin::OnNCHitTest(const CPoint& pt) { - // Only do DWM hit-testing when we are using the native frame. - if (non_client_view()->UseNativeFrame()) { - LRESULT result; - if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0, - MAKELPARAM(pt.x, pt.y), &result)) { - return result; - } - } - return WindowWin::OnNCHitTest(pt); -} - void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) { WindowWin::OnWindowPosChanged(window_pos); UpdateDWMFrame(); @@ -185,15 +156,6 @@ void BrowserFrameWin::Activate() { WindowWin::Activate(); } -views::NonClientFrameView* BrowserFrameWin::CreateFrameViewForWindow() { - if (AlwaysUseNativeFrame()) - browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_); - else - browser_frame_view_ = - browser::CreateBrowserNonClientFrameView(this, browser_view_); - return browser_frame_view_; -} - void BrowserFrameWin::UpdateFrameAfterFrameChange() { // We need to update the glass region on or off before the base class adjusts // the window region. @@ -202,8 +164,11 @@ void BrowserFrameWin::UpdateFrameAfterFrameChange() { } views::RootView* BrowserFrameWin::CreateRootView() { - root_view_ = new BrowserRootView(browser_view_, this); - return root_view_; + return delegate_->DelegateCreateRootView(); +} + +views::NonClientFrameView* BrowserFrameWin::CreateFrameViewForWindow() { + return delegate_->DelegateCreateFrameViewForWindow(); } //////////////////////////////////////////////////////////////////////////////// @@ -217,6 +182,12 @@ const views::NativeWindow* BrowserFrameWin::AsNativeWindow() const { return this; } +BrowserNonClientFrameView* BrowserFrameWin::CreateBrowserNonClientFrameView() { + if (AlwaysUseNativeFrame()) + return new GlassBrowserFrameView(this, browser_view_); + return browser::CreateBrowserNonClientFrameView(this, browser_view_); +} + int BrowserFrameWin::GetMinimizeButtonOffset() const { TITLEBARINFOEX titlebar_info; titlebar_info.cbSize = sizeof(TITLEBARINFOEX); @@ -229,18 +200,6 @@ int BrowserFrameWin::GetMinimizeButtonOffset() const { return minimize_button_corner.x; } -gfx::Rect BrowserFrameWin::GetBoundsForTabStrip(views::View* tabstrip) const { - return browser_frame_view_->GetBoundsForTabStrip(tabstrip); -} - -int BrowserFrameWin::GetHorizontalTabStripVerticalOffset(bool restored) const { - return browser_frame_view_->GetHorizontalTabStripVerticalOffset(restored); -} - -void BrowserFrameWin::UpdateThrobber(bool running) { - browser_frame_view_->UpdateThrobber(running); -} - ui::ThemeProvider* BrowserFrameWin::GetThemeProviderForFrame() const { // This is implemented for a different interface than GetThemeProvider is, // but they mean the same things. @@ -264,10 +223,6 @@ bool BrowserFrameWin::AlwaysUseNativeFrame() const { return GetThemeProvider()->ShouldUseNativeFrame(); } -views::View* BrowserFrameWin::GetFrameView() const { - return browser_frame_view_; -} - void BrowserFrameWin::TabStripDisplayModeChanged() { if (GetRootView()->has_children()) { // Make sure the child of the root view gets Layout again. diff --git a/chrome/browser/ui/views/frame/browser_frame_win.h b/chrome/browser/ui/views/frame/browser_frame_win.h index dbbd55a..4a3aa34 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.h +++ b/chrome/browser/ui/views/frame/browser_frame_win.h @@ -11,11 +11,7 @@ #include "chrome/browser/ui/views/frame/native_browser_frame.h" #include "views/window/window_win.h" -class AeroGlassNonClientView; -class BrowserNonClientFrameView; -class BrowserRootView; class BrowserView; -class NonClientFrameView; class Profile; /////////////////////////////////////////////////////////////////////////////// @@ -51,14 +47,9 @@ class BrowserFrameWin : public BrowserFrame, virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) OVERRIDE; virtual void OnEndSession(BOOL ending, UINT logoff) OVERRIDE; - virtual void OnEnterSizeMove() OVERRIDE; - virtual void OnExitSizeMove() OVERRIDE; virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) OVERRIDE; - virtual void OnMove(const CPoint& point) OVERRIDE; - virtual void OnMoving(UINT param, LPRECT new_bounds) OVERRIDE; - virtual LRESULT OnNCHitTest(const CPoint& pt) OVERRIDE; virtual void OnWindowPosChanged(WINDOWPOS* window_pos) OVERRIDE; virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; virtual void OnScreenReaderDetected() OVERRIDE; @@ -66,39 +57,28 @@ class BrowserFrameWin : public BrowserFrame, // Overridden from views::Window: virtual void Activate() OVERRIDE; virtual bool IsAppWindow() const OVERRIDE { return true; } - virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; virtual void UpdateFrameAfterFrameChange() OVERRIDE; virtual views::RootView* CreateRootView() OVERRIDE; + virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE; // Overridden from NativeBrowserFrame: virtual views::NativeWindow* AsNativeWindow() OVERRIDE; virtual const views::NativeWindow* AsNativeWindow() const OVERRIDE; + virtual BrowserNonClientFrameView* CreateBrowserNonClientFrameView() OVERRIDE; virtual int GetMinimizeButtonOffset() const OVERRIDE; - virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; - virtual int GetHorizontalTabStripVerticalOffset(bool restored) const OVERRIDE; - virtual void UpdateThrobber(bool running) OVERRIDE; virtual ui::ThemeProvider* GetThemeProviderForFrame() const OVERRIDE; virtual bool AlwaysUseNativeFrame() const OVERRIDE; - virtual views::View* GetFrameView() const OVERRIDE; virtual void TabStripDisplayModeChanged() OVERRIDE; private: // Updates the DWM with the frame bounds. void UpdateDWMFrame(); + NativeBrowserFrameDelegate* delegate_; + // The BrowserView is our ClientView. This is a pointer to it. BrowserView* browser_view_; - // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. - BrowserNonClientFrameView* browser_frame_view_; - - // A weak reference to the root view associated with the window. We save a - // copy as a BrowserRootView to avoid evil casting later, when we need to call - // functions that only exist on BrowserRootView (versus RootView). - BrowserRootView* root_view_; - - NativeBrowserFrameDelegate* delegate_; - DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); }; diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index ec2bf14..ad83930 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -500,29 +500,6 @@ BrowserView* BrowserView::GetBrowserViewForNativeWindow( return NULL; } -void BrowserView::WindowMoved() { - // Cancel any tabstrip animations, some of them may be invalidated by the - // window being repositioned. - // Comment out for one cycle to see if this fixes dist tests. - // tabstrip_->DestroyDragController(); - - status_bubble_->Reposition(); - - BrowserBubbleHost::WindowMoved(); - - browser::HideBookmarkBubbleView(); - - // Close the omnibox popup, if any. - if (toolbar_->location_bar()) - toolbar_->location_bar()->location_entry()->ClosePopup(); -} - -void BrowserView::WindowMoveOrResizeStarted() { - TabContents* tab_contents = GetSelectedTabContents(); - if (tab_contents) - tab_contents->WindowMoveOrResizeStarted(); -} - gfx::Rect BrowserView::GetToolbarBounds() const { gfx::Rect toolbar_bounds(toolbar_->bounds()); if (toolbar_bounds.IsEmpty()) @@ -1650,11 +1627,34 @@ views::ClientView* BrowserView::CreateClientView(views::Window* window) { return this; } -void BrowserView::OnWindowActivate(bool active) { +void BrowserView::OnWindowActivationChanged(bool active) { if (active) BrowserList::SetLastActive(browser_.get()); } +void BrowserView::OnWindowBeginUserBoundsChange() { + TabContents* tab_contents = GetSelectedTabContents(); + if (tab_contents) + tab_contents->WindowMoveOrResizeStarted(); +} + +void BrowserView::OnWidgetMove() { + // Cancel any tabstrip animations, some of them may be invalidated by the + // window being repositioned. + // Comment out for one cycle to see if this fixes dist tests. + // tabstrip_->DestroyDragController(); + + status_bubble_->Reposition(); + + BrowserBubbleHost::WindowMoved(); + + browser::HideBookmarkBubbleView(); + + // Close the omnibox popup, if any. + if (toolbar_->location_bar()) + toolbar_->location_bar()->location_entry()->ClosePopup(); +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, views::ClientView overrides: diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 4ede546..b84dbc9 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -102,14 +102,6 @@ class BrowserView : public BrowserBubbleHost, // Returns a Browser instance of this view. Browser* browser() const { return browser_.get(); } - // Called by the frame to notify the BrowserView that it was moved, and that - // any dependent popup windows should be repositioned. - void WindowMoved(); - - // Called by the frame to notify the BrowserView that a move or resize was - // initiated. - void WindowMoveOrResizeStarted(); - // Returns the apparent bounds of the toolbar, in BrowserView coordinates. // These differ from |toolbar_.bounds()| in that they match where the toolbar // background image is drawn -- slightly outside the "true" bounds @@ -372,7 +364,9 @@ class BrowserView : public BrowserBubbleHost, virtual bool GetSavedMaximizedState(bool* maximized) const OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; virtual views::ClientView* CreateClientView(views::Window* window) OVERRIDE; - virtual void OnWindowActivate(bool active) OVERRIDE; + virtual void OnWindowActivationChanged(bool active) OVERRIDE; + virtual void OnWindowBeginUserBoundsChange() OVERRIDE; + virtual void OnWidgetMove() OVERRIDE; // Overridden from views::ClientView: virtual bool CanClose() OVERRIDE; diff --git a/chrome/browser/ui/views/frame/native_browser_frame.h b/chrome/browser/ui/views/frame/native_browser_frame.h index 1759e55..f72ec29 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame.h +++ b/chrome/browser/ui/views/frame/native_browser_frame.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_H_ #pragma once +class BrowserNonClientFrameView; + namespace gfx { class Rect; } @@ -29,15 +31,13 @@ class NativeBrowserFrame { protected: friend class BrowserFrame; + virtual BrowserNonClientFrameView* CreateBrowserNonClientFrameView() = 0; + // BrowserFrame pass-thrus --------------------------------------------------- // See browser_frame.h for documentation: virtual int GetMinimizeButtonOffset() const = 0; - virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; - virtual int GetHorizontalTabStripVerticalOffset(bool restored) const = 0; - virtual void UpdateThrobber(bool running) = 0; virtual ui::ThemeProvider* GetThemeProviderForFrame() const = 0; virtual bool AlwaysUseNativeFrame() const = 0; - virtual views::View* GetFrameView() const = 0; virtual void TabStripDisplayModeChanged() = 0; }; diff --git a/chrome/browser/ui/views/frame/native_browser_frame_delegate.h b/chrome/browser/ui/views/frame/native_browser_frame_delegate.h index 10c32dd..cacd34a 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_delegate.h +++ b/chrome/browser/ui/views/frame/native_browser_frame_delegate.h @@ -6,10 +6,19 @@ #define CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_DELEGATE_H_ #pragma once +namespace views { +class NonClientFrameView; +class RootView; +} + class NativeBrowserFrameDelegate { public: virtual ~NativeBrowserFrameDelegate() {} + // TODO(beng): Remove these once BrowserFrame is-a Window is-a Widget, at + // which point BrowserFrame can just override Widget's method. + virtual views::RootView* DelegateCreateRootView() = 0; + virtual views::NonClientFrameView* DelegateCreateFrameViewForWindow() = 0; }; #endif // CHROME_BROWSER_UI_VIEWS_FRAME_NATIVE_BROWSER_FRAME_DELEGATE_H_ diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 3fdb610..26bee52 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -139,11 +139,11 @@ void BalloonViewImpl::RunMenu(views::View* source, const gfx::Point& pt) { RunOptionsMenu(pt); } -void BalloonViewImpl::DisplayChanged() { +void BalloonViewImpl::OnDisplayChanged() { collection_->DisplayChanged(); } -void BalloonViewImpl::WorkAreaChanged() { +void BalloonViewImpl::OnWorkAreaChanged() { collection_->DisplayChanged(); } diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h index a956d6a..46e866e 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.h +++ b/chrome/browser/ui/views/notifications/balloon_view.h @@ -74,8 +74,8 @@ class BalloonViewImpl : public BalloonView, virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; // views::WidgetDelegate interface. - virtual void DisplayChanged() OVERRIDE; - virtual void WorkAreaChanged() OVERRIDE; + virtual void OnDisplayChanged() OVERRIDE; + virtual void OnWorkAreaChanged() OVERRIDE; // views::ButtonListener interface. virtual void ButtonPressed( |