diff options
| author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-11 17:46:17 +0000 |
|---|---|---|
| committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-11 17:46:17 +0000 |
| commit | 00d8cf0a2a9435c64e2421d761cec2ff32baefc5 (patch) | |
| tree | a5193f56be9088f3053ffdca69dfc103b97848c3 /chrome/browser/views | |
| parent | 621adaae105bee50e90d58accbe4d52f6bd8139c (diff) | |
| download | chromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.zip chromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.tar.gz chromium_src-00d8cf0a2a9435c64e2421d761cec2ff32baefc5.tar.bz2 | |
Another Frame Grab-Bag
- makes more stuff in Browser object only happen if you're using the old frames- rename BrowserWindow::Update to BrowserWindow::UpdateToolbar since that's what it does
- add window position save/restore handling to Browser- remove BrowserWindow::BrowserDidPaint
- relic from HaloFrame days- remove BrowserWindow::GetRootView - unused and exposes impl details- remove BrowserWindow::DetachFromBrowser - unused
- store BrowserView2* on HWND's property list so infobubbles can access it later- both frames (Opaque and AeroGlass) notify the BrowserView2 when they're moved so BrowserView2 can reposition the status bubble and close the autocomplete popup
- remove BrowserView2::ShowTabContents - no longer used
- remove BrowserView2::ShelfVisibilityChanged - no longer used
- remove BrowserView2::SetWindowTitle - never used
- remove BrowserView2::ProfileChanged - now called from TabSelectedAt- properly unhook infobars etc when a tab is detached
B=1031854
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
| -rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 3 | ||||
| -rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.cc | 8 | ||||
| -rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.h | 2 | ||||
| -rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 15 | ||||
| -rw-r--r-- | chrome/browser/views/frame/browser_view.h | 5 | ||||
| -rw-r--r-- | chrome/browser/views/frame/browser_view2.cc | 129 | ||||
| -rw-r--r-- | chrome/browser/views/frame/browser_view2.h | 24 | ||||
| -rw-r--r-- | chrome/browser/views/frame/opaque_frame.cc | 8 | ||||
| -rw-r--r-- | chrome/browser/views/frame/opaque_frame.h | 3 | ||||
| -rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 11 | ||||
| -rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.h | 7 |
11 files changed, 92 insertions, 123 deletions
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index fd13b85..f12a41a 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -393,7 +393,8 @@ static const int kThrobberFrameTimeMs = 30; ConstrainedWindowNonClientView::ConstrainedWindowNonClientView( ConstrainedWindowImpl* container, TabContents* owner) - : container_(container), + : NonClientView(), + container_(container), window_delegate_(NULL), close_button_(new ChromeViews::Button), location_bar_(NULL), diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index 96e89f1..6ea83de 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -176,6 +176,14 @@ bool AeroGlassFrame::GetAccelerator(int cmd_id, return browser_view_->GetAccelerator(cmd_id, accelerator); } +void AeroGlassFrame::OnMove(const CPoint& point) { + browser_view_->WindowMoved(); +} + +void AeroGlassFrame::OnMoving(UINT param, const RECT* new_bounds) { + browser_view_->WindowMoved(); +} + /////////////////////////////////////////////////////////////////////////////// // AeroGlassFrame, private: diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h index a08581c..c4b67bd 100644 --- a/chrome/browser/views/frame/aero_glass_frame.h +++ b/chrome/browser/views/frame/aero_glass_frame.h @@ -73,6 +73,8 @@ class AeroGlassFrame : public BrowserFrame, virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, ChromeViews::Accelerator* accelerator); + virtual void OnMove(const CPoint& point); + virtual void OnMoving(UINT param, const RECT* new_bounds); protected: // Overridden from ChromeViews::HWNDViewContainer: diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index c6d73f2..7783549 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -91,10 +91,6 @@ 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(); } @@ -111,10 +107,6 @@ StatusBubble* BrowserView::GetStatusBubble() { return status_bubble_.get(); } -ChromeViews::RootView* BrowserView::GetRootView() { - return frame_->GetRootView(); -} - void BrowserView::ShelfVisibilityChanged() { frame_->ShelfVisibilityChanged(); } @@ -174,10 +166,6 @@ gfx::Rect BrowserView::GetBoundsForContentBounds(const gfx::Rect content_rect) { return frame_->GetBoundsForContentBounds(content_rect); } -void BrowserView::DetachFromBrowser() { - frame_->DetachFromBrowser(); -} - void BrowserView::InfoBubbleShowing() { frame_->InfoBubbleShowing(); } @@ -206,7 +194,8 @@ BrowserView* BrowserView::GetBrowserView() const { return NULL; } -void BrowserView::Update(TabContents* contents, bool should_restore_state) { +void BrowserView::UpdateToolbar(TabContents* contents, + bool should_restore_state) { toolbar_->Update(contents, should_restore_state); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 5920ed7..2e86759 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -62,12 +62,10 @@ class BrowserView : public BrowserWindow, // Overridden from BrowserWindow: virtual void Init(); virtual void Show(int command, bool adjust_to_fit); - virtual void BrowserDidPaint(HRGN region); virtual void Close(); virtual void* GetPlatformID(); virtual TabStrip* GetTabStrip() const; virtual StatusBubble* GetStatusBubble(); - virtual ChromeViews::RootView* GetRootView(); virtual void ShelfVisibilityChanged(); virtual void SelectedTabToolbarSizeChanged(bool is_animating); virtual void UpdateTitleBar(); @@ -85,7 +83,6 @@ class BrowserView : public BrowserWindow, virtual gfx::Rect GetNormalBounds(); virtual bool IsMaximized(); virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect); - virtual void DetachFromBrowser(); virtual void InfoBubbleShowing(); virtual void InfoBubbleClosing(); virtual ToolbarStarToggle* GetStarButton() const; @@ -93,7 +90,7 @@ class BrowserView : public BrowserWindow, virtual GoButton* GetGoButton() const; virtual BookmarkBarView* GetBookmarkBarView(); virtual BrowserView* GetBrowserView() const; - virtual void Update(TabContents* contents, bool should_restore_state); + virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void ProfileChanged(Profile* profile); virtual void FocusToolbar(); virtual void DestroyBrowser(); diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index 076faa0..313652e 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -53,6 +53,7 @@ static const int kStatusBubbleHeight = 20; static const int kStatusBubbleOffset = 2; static const int kSeparationLineHeight = 1; static const SkColor kSeparationLineColor = SkColorSetRGB(178, 178, 178); +static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; /////////////////////////////////////////////////////////////////////////////// // BrowserView2, public: @@ -77,6 +78,14 @@ BrowserView2::~BrowserView2() { browser_->tabstrip_model()->RemoveObserver(this); } +void BrowserView2::WindowMoved() { + status_bubble_->Reposition(); + + // Close the omnibox popup, if any. + if (GetLocationBarView()) + GetLocationBarView()->location_entry()->ClosePopup(); +} + gfx::Rect BrowserView2::GetToolbarBounds() const { CRect bounds; toolbar_->GetBounds(&bounds); @@ -152,6 +161,10 @@ unsigned int BrowserView2::FeaturesForBrowserType(BrowserType::Type type) { // BrowserView2, BrowserWindow implementation: void BrowserView2::Init() { + // Stow a pointer to this object onto the window handle so that we can get + // at it later when all we have is a HWND. + SetProp(GetViewContainer()->GetHWND(), kBrowserWindowKey, this); + LoadAccelerators(); SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); @@ -176,9 +189,6 @@ void BrowserView2::Show(int command, bool adjust_to_fit) { frame_->GetWindow()->Show(); } -void BrowserView2::BrowserDidPaint(HRGN region) { -} - void BrowserView2::Close() { frame_->GetWindow()->Close(); } @@ -195,22 +205,13 @@ StatusBubble* BrowserView2::GetStatusBubble() { return status_bubble_.get(); } -ChromeViews::RootView* BrowserView2::GetRootView() { - // TODO(beng): Get rid of this stupid method. - return View::GetRootView(); -} - -void BrowserView2::ShelfVisibilityChanged() { - UpdateUIForContents(browser_->GetSelectedTabContents()); -} - void BrowserView2::SelectedTabToolbarSizeChanged(bool is_animating) { if (is_animating) { contents_container_->set_fast_resize(true); - ShelfVisibilityChanged(); + UpdateUIForContents(browser_->GetSelectedTabContents()); contents_container_->set_fast_resize(false); } else { - ShelfVisibilityChanged(); + UpdateUIForContents(browser_->GetSelectedTabContents()); contents_container_->UpdateHWNDBounds(); } } @@ -220,9 +221,6 @@ void BrowserView2::UpdateTitleBar() { frame_->GetWindow()->UpdateWindowIcon(); } -void BrowserView2::SetWindowTitle(const std::wstring& title) { -} - void BrowserView2::Activate() { frame_->GetWindow()->Activate(); } @@ -237,17 +235,6 @@ void BrowserView2::FlashFrame() { FlashWindowEx(&fwi); } -void BrowserView2::ShowTabContents(TabContents* contents) { - contents_container_->SetTabContents(contents); - - // Force a LoadingStateChanged notification because the TabContents - // could be loading (such as when the user unconstrains a tab. - if (contents && contents->delegate()) - contents->delegate()->LoadingStateChanged(contents); - - UpdateUIForContents(contents); -} - void BrowserView2::ContinueDetachConstrainedWindowDrag( const gfx::Point& mouse_point, int frame_component) { @@ -311,13 +298,12 @@ gfx::Rect BrowserView2::GetBoundsForContentBounds( return frame_->GetWindowBoundsForClientBounds(content_rect); } -void BrowserView2::DetachFromBrowser() { -} - void BrowserView2::InfoBubbleShowing() { + frame_->GetWindow()->DisableInactiveRendering(true); } void BrowserView2::InfoBubbleClosing() { + frame_->GetWindow()->DisableInactiveRendering(false); } ToolbarStarToggle* BrowserView2::GetStarButton() const { @@ -349,14 +335,11 @@ BrowserView* BrowserView2::GetBrowserView() const { return NULL; } -void BrowserView2::Update(TabContents* contents, bool should_restore_state) { +void BrowserView2::UpdateToolbar(TabContents* contents, + bool should_restore_state) { toolbar_->Update(contents, should_restore_state); } -void BrowserView2::ProfileChanged(Profile* profile) { - toolbar_->SetProfile(profile); -} - void BrowserView2::FocusToolbar() { toolbar_->RequestFocus(); } @@ -382,18 +365,8 @@ void BrowserView2::Observe(NotificationType type, /////////////////////////////////////////////////////////////////////////////// // BrowserView2, TabStripModelObserver implementation: -void BrowserView2::TabClosingAt(TabContents* contents, int index) { +void BrowserView2::TabDetachedAt(TabContents* contents, int index) { if (contents == browser_->GetSelectedTabContents()) { - // TODO(beng): (Cleanup) These should probably eventually live in the - // TabContentsView, then we could skip all this teardown. - ChromeViews::View* shelf = contents->GetDownloadShelfView(); - if (shelf && shelf->GetParent() != NULL) - shelf->GetParent()->RemoveChildView(shelf); - - ChromeViews::View* info_bar = contents->GetInfoBarView(); - if (info_bar && info_bar->GetParent() != NULL) - info_bar->GetParent()->RemoveChildView(info_bar); - // We need to reset the current tab contents to NULL before it gets // freed. This is because the focus manager performs some operations // on the selected TabContents when it is removed. @@ -401,10 +374,6 @@ void BrowserView2::TabClosingAt(TabContents* contents, int index) { } } -void BrowserView2::TabDetachedAt(TabContents* contents, int index) { - // TODO(beng): implement -} - void BrowserView2::TabSelectedAt(TabContents* old_contents, TabContents* new_contents, int index, @@ -420,22 +389,18 @@ void BrowserView2::TabSelectedAt(TabContents* old_contents, if (BrowserList::GetLastActive() == browser_) new_contents->RestoreFocus(); + // Update all the UI bits. UpdateTitleBar(); - // UpdateToolbar(true); - - UpdateUIForContents(new_contents); -} - -void BrowserView2::TabChangedAt(TabContents* old_contents, - TabContents* new_contents, - int index) { + toolbar_->SetProfile(new_contents->profile()); + UpdateToolbar(new_contents, true); UpdateUIForContents(new_contents); } void BrowserView2::TabStripEmpty() { - // We need to reset the frame contents just in case this wasn't done while - // detaching the tab. This happens when dragging out the last tab. - contents_container_->SetTabContents(NULL); + // Make sure all optional UI is removed before we are destroyed, otherwise + // there will be consequences (since our view hierarchy will still have + // references to freed views). + UpdateUIForContents(NULL); } /////////////////////////////////////////////////////////////////////////////// @@ -489,26 +454,23 @@ void BrowserView2::ExecuteWindowsCommand(int command_id) { void BrowserView2::SaveWindowPosition(const CRect& bounds, bool maximized, bool always_on_top) { - // TODO(beng): implement me! - //browser_->SaveWindowPosition(gfx::Rect(bounds), maximized); + browser_->SaveWindowPosition(gfx::Rect(bounds), maximized); } bool BrowserView2::RestoreWindowPosition(CRect* bounds, bool* maximized, bool* always_on_top) { DCHECK(bounds && maximized && always_on_top); - *always_on_top = false; - /* TODO(beng): implement this method in Browser - browser_->RestoreWindowPosition(bounds, maximized); + // TODO(beng): (http://b/1317622) Make these functions take gfx::Rects. + gfx::Rect b; + browser_->RestoreWindowPosition(&b, maximized); + *bounds = b.ToRECT(); // We return true because we can _always_ locate reasonable bounds using the // WindowSizer, and we don't want to trigger the Window's built-in "size to // default" handling because the browser window has no default preferred // size. return true; - */ - // For now, return false to just use whatever was given to us by Browser... - return false; } void BrowserView2::WindowClosing() { @@ -605,6 +567,10 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { /////////////////////////////////////////////////////////////////////////////// // BrowserView2, ChromeViews::View overrides: +void BrowserView2::Paint(ChromeCanvas* canvas) { + //canvas->FillRectInt(SK_ColorRED, 0, 0, GetWidth(), GetHeight()); +} + void BrowserView2::Layout() { int top = LayoutTabStrip(); top = LayoutToolbar(top); @@ -635,9 +601,8 @@ void BrowserView2::ViewHierarchyChanged(bool is_add, int BrowserView2::LayoutTabStrip() { if (IsTabStripVisible()) { gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); - // TODO(beng): account for OTR avatar. tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(), - tabstrip_bounds.width(), tabstrip_bounds.height()); + tabstrip_bounds.width(), tabstrip_bounds.height()); return tabstrip_bounds.bottom(); } return 0; @@ -668,7 +633,6 @@ int BrowserView2::LayoutBookmarkAndInfoBars(int top) { return LayoutBookmarkBar(top); } // Otherwise, Bookmark bar first, Info bar second. - top -= kSeparationLineHeight; top = LayoutBookmarkBar(top); } return LayoutInfoBar(top); @@ -678,6 +642,8 @@ int BrowserView2::LayoutBookmarkBar(int top) { if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && active_bookmark_bar_) { CSize ps; active_bookmark_bar_->GetPreferredSize(&ps); + if (!active_info_bar_ || show_bookmark_bar_pref_.GetValue()) + top -= kSeparationLineHeight; active_bookmark_bar_->SetBounds(0, top, GetWidth(), ps.cy); top += ps.cy; } @@ -722,7 +688,8 @@ void BrowserView2::LayoutStatusBubble(int top) { bool BrowserView2::MaybeShowBookmarkBar(TabContents* contents) { ChromeViews::View* new_bookmark_bar_view = NULL; if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && - contents->IsBookmarkBarAlwaysVisible()) { + (contents && contents->IsBookmarkBarAlwaysVisible() || + show_bookmark_bar_pref_.GetValue())) { new_bookmark_bar_view = GetBookmarkBarView(); } return UpdateChildViewAndLayout(new_bookmark_bar_view, @@ -744,17 +711,11 @@ bool BrowserView2::MaybeShowDownloadShelf(TabContents* contents) { } void BrowserView2::UpdateUIForContents(TabContents* contents) { - // Only do a Layout if the current contents is non-NULL. We assume that if - // the contents is NULL, we're either being destroyed, or ShowTabContents is - // going to be invoked with a non-NULL TabContents again so that there is no - // need to do a Layout now. - if (!contents) - return; - - if (MaybeShowBookmarkBar(contents) || MaybeShowInfoBar(contents) || - MaybeShowDownloadShelf(contents)) { + bool needs_layout = MaybeShowBookmarkBar(contents); + needs_layout |= MaybeShowInfoBar(contents); + needs_layout |= MaybeShowDownloadShelf(contents); + if (needs_layout) Layout(); - } } bool BrowserView2::UpdateChildViewAndLayout(ChromeViews::View* new_view, diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h index 164451c..54f154c 100644 --- a/chrome/browser/views/frame/browser_view2.h +++ b/chrome/browser/views/frame/browser_view2.h @@ -64,6 +64,10 @@ class BrowserView2 : public BrowserWindow, void set_frame(BrowserFrame* frame) { frame_ = frame; } + // Called by the frame to notify the BrowserView2 that it was moved, and that + // any dependent popup windows should be repositioned. + void WindowMoved(); + // Returns the bounds of the toolbar, in BrowserView2 coordinates. gfx::Rect GetToolbarBounds() const; @@ -109,19 +113,14 @@ class BrowserView2 : public BrowserWindow, // Overridden from BrowserWindow: virtual void Init(); virtual void Show(int command, bool adjust_to_fit); - virtual void BrowserDidPaint(HRGN region); virtual void Close(); virtual void* GetPlatformID(); virtual TabStrip* GetTabStrip() const; virtual StatusBubble* GetStatusBubble(); - virtual ChromeViews::RootView* GetRootView(); - virtual void ShelfVisibilityChanged(); virtual void SelectedTabToolbarSizeChanged(bool is_animating); virtual void UpdateTitleBar(); - virtual void SetWindowTitle(const std::wstring& title); virtual void Activate(); virtual void FlashFrame(); - virtual void ShowTabContents(TabContents* contents); virtual void ContinueDetachConstrainedWindowDrag( const gfx::Point& mouse_point, int frame_component); @@ -132,7 +131,6 @@ class BrowserView2 : public BrowserWindow, virtual gfx::Rect GetNormalBounds(); virtual bool IsMaximized(); virtual gfx::Rect GetBoundsForContentBounds(const gfx::Rect content_rect); - virtual void DetachFromBrowser(); virtual void InfoBubbleShowing(); virtual void InfoBubbleClosing(); virtual ToolbarStarToggle* GetStarButton() const; @@ -140,8 +138,7 @@ class BrowserView2 : public BrowserWindow, 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 UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void FocusToolbar(); virtual void DestroyBrowser(); @@ -151,15 +148,11 @@ class BrowserView2 : public BrowserWindow, const NotificationDetails& details); // Overridden from TabStripModelObserver: - virtual void TabClosingAt(TabContents* contents, int index); virtual void TabDetachedAt(TabContents* contents, int index); virtual void TabSelectedAt(TabContents* old_contents, TabContents* new_contents, int index, bool user_gesture); - virtual void TabChangedAt(TabContents* old_contents, - TabContents* new_contents, - int index); virtual void TabStripEmpty(); // Overridden from ChromeViews::WindowDelegate: @@ -188,6 +181,7 @@ class BrowserView2 : public BrowserWindow, virtual int NonClientHitTest(const gfx::Point& point); // Overridden from ChromeViews::View: + virtual void Paint(ChromeCanvas* canvas); virtual void Layout(); virtual void DidChangeBounds(const CRect& previous, const CRect& current); virtual void ViewHierarchyChanged(bool is_add, @@ -216,21 +210,25 @@ class BrowserView2 : public BrowserWindow, // 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 // Browser type) and there should be a subsequent re-layout to show it. + // |contents| can be NULL. bool MaybeShowBookmarkBar(TabContents* contents); // Prepare to show an Info Bar for the specified TabContents. Returns true // if there is an Info Bar to show and one is supported for this Browser // type, and there should be a subsequent re-layout to show it. + // |contents| can be NULL. bool MaybeShowInfoBar(TabContents* contents); // Prepare to show a Download Shelf for the specified TabContents. Returns // true if there is a Download Shelf to show and one is supported for this // Browser type, and there should be a subsequent re-layout to show it. + // |contents| can be NULL. bool MaybeShowDownloadShelf(TabContents* contents); // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the // Download Shelf in response to a change notification from the specified - // |contents|. + // |contents|. |contents| can be NULL. In this case, all optional UI will be + // removed. void UpdateUIForContents(TabContents* contents); // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc index c028624..9e9181c 100644 --- a/chrome/browser/views/frame/opaque_frame.cc +++ b/chrome/browser/views/frame/opaque_frame.cc @@ -98,6 +98,14 @@ bool OpaqueFrame::GetAccelerator(int cmd_id, return browser_view_->GetAccelerator(cmd_id, accelerator); } +void OpaqueFrame::OnMove(const CPoint& point) { + browser_view_->WindowMoved(); +} + +void OpaqueFrame::OnMoving(UINT param, const RECT* new_bounds) { + browser_view_->WindowMoved(); +} + /////////////////////////////////////////////////////////////////////////////// // OpaqueFrame, private: diff --git a/chrome/browser/views/frame/opaque_frame.h b/chrome/browser/views/frame/opaque_frame.h index ebb5a20..34ebd47 100644 --- a/chrome/browser/views/frame/opaque_frame.h +++ b/chrome/browser/views/frame/opaque_frame.h @@ -61,6 +61,7 @@ class OpaqueFrame : public BrowserFrame, gfx::Rect GetToolbarBounds() const; gfx::Rect GetContentsBounds() const; + protected: // Overridden from BrowserFrame: virtual gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds); @@ -72,6 +73,8 @@ class OpaqueFrame : public BrowserFrame, virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator); virtual bool GetAccelerator(int cmd_id, ChromeViews::Accelerator* accelerator); + virtual void OnMove(const CPoint& point); + virtual void OnMoving(UINT param, const RECT* new_bounds); private: // Return a pointer to the concrete type of our non-client view. diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 823014c..410e95a 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -398,7 +398,7 @@ static const int kTitleTopOffset = 6; static const int kTitleBottomSpacing = 6; // The distance between the top edge of the window and the TabStrip when there // is no title-bar showing, and the window is restored. -static const int kNoTitleTopSpacing = 10; +static const int kNoTitleTopSpacing = 15; // The distance between the top edge of the window and the TabStrip when there // is no title-bar showing, and the window is maximized. static const int kNoTitleZoomedTopSpacing = 1; @@ -426,7 +426,8 @@ static const int kDistributorLogoVerticalOffset = 3; // OpaqueNonClientView, public: OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame, bool is_otr) - : minimize_button_(new ChromeViews::Button), + : NonClientView(), + minimize_button_(new ChromeViews::Button), maximize_button_(new ChromeViews::Button), restore_button_(new ChromeViews::Button), close_button_(new ChromeViews::Button), @@ -513,9 +514,9 @@ gfx::Rect OpaqueNonClientView::GetWindowBoundsForClientBounds( gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { int tabstrip_height = tabstrip->GetPreferredHeight(); - int tabstrip_x = frame_->client_view()->GetX() - 4; - return gfx::Rect(tabstrip_x, frame_->client_view()->GetY() - 1, - minimize_button_->GetX() - tabstrip_x, tabstrip_height); + int tabstrip_x = frame_->client_view()->GetX(); + return gfx::Rect(0, 0, minimize_button_->GetX() - tabstrip_x, + tabstrip_height); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h index fbc54a3..3290e26 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.h +++ b/chrome/browser/views/frame/opaque_non_client_view.h @@ -50,7 +50,8 @@ class OpaqueNonClientView : public ChromeViews::NonClientView, // Retrieve the bounds of the window for the specified contents bounds. gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect& client_bounds); - // Retrieve the bounds that the specified |tabstrip| will be laid out within. + // Retrieve the bounds (in ClientView coordinates) that the specified + // |tabstrip| will be laid out within. gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip); protected: @@ -101,8 +102,8 @@ class OpaqueNonClientView : public ChromeViews::NonClientView, // Returns the set of resources to use to paint this view. WindowResources* resources() const { - return frame_->is_active() ? current_active_resources_ - : current_inactive_resources_; + return frame_->is_active() || paint_as_active() ? + current_active_resources_ : current_inactive_resources_; } // The layout rect of the title, if visible. |
