| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/views/frame/browser_frame.h" | 9 #include "chrome/browser/views/frame/browser_frame.h" |
| 10 #include "chrome/browser/views/frame/browser_non_client_frame_view.h" | 10 #include "chrome/browser/views/frame/browser_non_client_frame_view.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, | 26 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
| 27 public views::ButtonListener, | 27 public views::ButtonListener, |
| 28 public TabIconView::TabIconViewModel { | 28 public TabIconView::TabIconViewModel { |
| 29 public: | 29 public: |
| 30 // Constructs a non-client view for an BrowserFrame. | 30 // Constructs a non-client view for an BrowserFrame. |
| 31 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 31 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 32 virtual ~OpaqueBrowserFrameView(); | 32 virtual ~OpaqueBrowserFrameView(); |
| 33 | 33 |
| 34 // Overridden from BrowserNonClientFrameView: | 34 // Overridden from BrowserNonClientFrameView: |
| 35 virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const; | 35 virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const; |
| 36 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const; |
| 36 virtual void UpdateThrobber(bool running); | 37 virtual void UpdateThrobber(bool running); |
| 37 virtual gfx::Size GetMinimumSize(); | 38 virtual gfx::Size GetMinimumSize(); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 // Overridden from views::NonClientFrameView: | 41 // Overridden from views::NonClientFrameView: |
| 41 virtual gfx::Rect GetBoundsForClientView() const; | 42 virtual gfx::Rect GetBoundsForClientView() const; |
| 42 virtual bool AlwaysUseNativeFrame() const; | 43 virtual bool AlwaysUseNativeFrame() const; |
| 43 virtual bool AlwaysUseCustomFrame() const; | 44 virtual bool AlwaysUseCustomFrame() const; |
| 44 virtual gfx::Rect GetWindowBoundsForClientBounds( | 45 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 45 const gfx::Rect& client_bounds) const; | 46 const gfx::Rect& client_bounds) const; |
| 46 virtual int NonClientHitTest(const gfx::Point& point); | 47 virtual int NonClientHitTest(const gfx::Point& point); |
| 47 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); | 48 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); |
| 48 virtual void EnableClose(bool enable); | 49 virtual void EnableClose(bool enable); |
| 49 virtual void ResetWindowControls(); | 50 virtual void ResetWindowControls(); |
| 50 | 51 |
| 51 // Overridden from views::View: | 52 // Overridden from views::View: |
| 52 virtual void Paint(gfx::Canvas* canvas); | 53 virtual void Paint(gfx::Canvas* canvas); |
| 53 virtual void PaintChildren(gfx::Canvas* canvas); | |
| 54 virtual void Layout(); | 54 virtual void Layout(); |
| 55 virtual bool HitTest(const gfx::Point& l) const; | 55 virtual bool HitTest(const gfx::Point& l) const; |
| 56 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); | 56 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 57 | 57 |
| 58 // Overridden from views::ButtonListener: | 58 // Overridden from views::ButtonListener: |
| 59 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 59 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 60 | 60 |
| 61 // Overridden from TabIconView::TabIconViewModel: | 61 // Overridden from TabIconView::TabIconViewModel: |
| 62 virtual bool ShouldTabIconViewAnimate() const; | 62 virtual bool ShouldTabIconViewAnimate() const; |
| 63 virtual SkBitmap GetFavIconForTabIconView(); | 63 virtual SkBitmap GetFavIconForTabIconView(); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // Returns the thickness of the border that makes up the window frame edges. | 66 // Returns the thickness of the border that makes up the window frame edges. |
| 67 // This does not include any client edge. | 67 // This does not include any client edge. If |restored| is true, acts as if |
| 68 int FrameBorderThickness() const; | 68 // the window is restored regardless of the real mode. |
| 69 int FrameBorderThickness(bool restored) const; |
| 69 | 70 |
| 70 // Returns the height of the top resize area. This is smaller than the frame | 71 // Returns the height of the top resize area. This is smaller than the frame |
| 71 // border height in order to increase the window draggable area. | 72 // border height in order to increase the window draggable area. |
| 72 int TopResizeHeight() const; | 73 int TopResizeHeight() const; |
| 73 | 74 |
| 74 // Returns the thickness of the entire nonclient left, right, and bottom | 75 // Returns the thickness of the entire nonclient left, right, and bottom |
| 75 // borders, including both the window frame and any client edge. | 76 // borders, including both the window frame and any client edge. |
| 76 int NonClientBorderThickness() const; | 77 int NonClientBorderThickness() const; |
| 77 | 78 |
| 78 // Returns the height of the entire nonclient top border, including the window | 79 // Returns the height of the entire nonclient top border, including the window |
| 79 // frame, any title area, and any connected client edge. | 80 // frame, any title area, and any connected client edge. If |restored| is |
| 80 int NonClientTopBorderHeight() const; | 81 // true, acts as if the window is restored regardless of the real mode. If |
| 82 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless |
| 83 // of the real state. |
| 84 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; |
| 81 | 85 |
| 82 // Returns the y-coordinate of the caption buttons. | 86 // Returns the y-coordinate of the caption buttons. If |restored| is true, |
| 83 int CaptionButtonY() const; | 87 // acts as if the window is restored regardless of the real mode. |
| 88 int CaptionButtonY(bool restored) const; |
| 84 | 89 |
| 85 // Returns the thickness of the nonclient portion of the 3D edge along the | 90 // Returns the thickness of the 3D edge along the bottom of the titlebar. If |
| 86 // bottom of the titlebar. | 91 // |restored| is true, acts as if the window is restored regardless of the |
| 87 int TitlebarBottomThickness() const; | 92 // real mode. |
| 93 int TitlebarBottomThickness(bool restored) const; |
| 88 | 94 |
| 89 // Returns the size of the titlebar icon. This is used even when the icon is | 95 // Returns the size of the titlebar icon. This is used even when the icon is |
| 90 // not shown, e.g. to set the titlebar height. | 96 // not shown, e.g. to set the titlebar height. |
| 91 int IconSize() const; | 97 int IconSize() const; |
| 92 | 98 |
| 93 // Returns the bounds of the titlebar icon (or where the icon would be if | 99 // Returns the bounds of the titlebar icon (or where the icon would be if |
| 94 // there was one). | 100 // there was one). |
| 95 gfx::Rect IconBounds() const; | 101 gfx::Rect IconBounds() const; |
| 96 | 102 |
| 97 // Paint various sub-components of this view. The *FrameBorder() functions | 103 // Paint various sub-components of this view. The *FrameBorder() functions |
| 98 // also paint the background of the titlebar area, since the top frame border | 104 // also paint the background of the titlebar area, since the top frame border |
| 99 // and titlebar background are a contiguous component. | 105 // and titlebar background are a contiguous component. |
| 100 void PaintRestoredFrameBorder(gfx::Canvas* canvas); | 106 void PaintRestoredFrameBorder(gfx::Canvas* canvas); |
| 101 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); | 107 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); |
| 102 void PaintTitleBar(gfx::Canvas* canvas); | 108 void PaintTitleBar(gfx::Canvas* canvas); |
| 103 void PaintToolbarBackground(gfx::Canvas* canvas); | 109 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 110 void PaintOTRAvatar(gfx::Canvas* canvas); |
| 104 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 111 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
| 105 | 112 |
| 106 // Layout various sub-components of this view. | 113 // Layout various sub-components of this view. |
| 107 void LayoutWindowControls(); | 114 void LayoutWindowControls(); |
| 108 void LayoutTitleBar(); | 115 void LayoutTitleBar(); |
| 109 void LayoutOTRAvatar(); | 116 void LayoutOTRAvatar(); |
| 110 | 117 |
| 111 // Returns the bounds of the client area for the specified view size. | 118 // Returns the bounds of the client area for the specified view size. |
| 112 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 119 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 113 | 120 |
| 114 // Returns the bounds of |src| in the coordinate system of |dst|. | |
| 115 // TODO(sky): promote this to view. | |
| 116 static gfx::Rect GetViewBounds(views::View* src, views::View* dst); | |
| 117 | |
| 118 // The layout rect of the title, if visible. | 121 // The layout rect of the title, if visible. |
| 119 gfx::Rect title_bounds_; | 122 gfx::Rect title_bounds_; |
| 120 | 123 |
| 121 // Off the record avatar icon. | 124 // The layout rect of the OTR avatar icon, if visible. |
| 122 views::ImageView* otr_avatar_icon_; | 125 gfx::Rect otr_avatar_bounds_; |
| 123 | 126 |
| 124 // Window controls. | 127 // Window controls. |
| 125 views::ImageButton* minimize_button_; | 128 views::ImageButton* minimize_button_; |
| 126 views::ImageButton* maximize_button_; | 129 views::ImageButton* maximize_button_; |
| 127 views::ImageButton* restore_button_; | 130 views::ImageButton* restore_button_; |
| 128 views::ImageButton* close_button_; | 131 views::ImageButton* close_button_; |
| 129 | 132 |
| 130 // The Window icon. | 133 // The Window icon. |
| 131 TabIconView* window_icon_; | 134 TabIconView* window_icon_; |
| 132 | 135 |
| 133 // The frame that hosts this view. | 136 // The frame that hosts this view. |
| 134 BrowserFrame* frame_; | 137 BrowserFrame* frame_; |
| 135 | 138 |
| 136 // The BrowserView hosted within this View. | 139 // The BrowserView hosted within this View. |
| 137 BrowserView* browser_view_; | 140 BrowserView* browser_view_; |
| 138 | 141 |
| 139 // The bounds of the ClientView. | 142 // The bounds of the ClientView. |
| 140 gfx::Rect client_view_bounds_; | 143 gfx::Rect client_view_bounds_; |
| 141 | 144 |
| 142 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); | 145 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); |
| 143 }; | 146 }; |
| 144 | 147 |
| 145 #endif // CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 148 #endif // CHROME_BROWSER_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |