| 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_GLASS_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/views/frame/browser_frame_win.h" | 8 #include "chrome/browser/views/frame/browser_frame_win.h" |
| 9 #include "chrome/browser/views/frame/browser_non_client_frame_view.h" | 9 #include "chrome/browser/views/frame/browser_non_client_frame_view.h" |
| 10 #include "views/controls/button/button.h" | 10 #include "views/controls/button/button.h" |
| 11 #include "views/window/non_client_view.h" | 11 #include "views/window/non_client_view.h" |
| 12 | 12 |
| 13 class BrowserView; | 13 class BrowserView; |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 | 15 |
| 16 class GlassBrowserFrameView : public BrowserNonClientFrameView { | 16 class GlassBrowserFrameView : public BrowserNonClientFrameView { |
| 17 public: | 17 public: |
| 18 // Constructs a non-client view for an BrowserFrame. | 18 // Constructs a non-client view for an BrowserFrame. |
| 19 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 19 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 20 virtual ~GlassBrowserFrameView(); | 20 virtual ~GlassBrowserFrameView(); |
| 21 | 21 |
| 22 // Overridden from BrowserNonClientFrameView: | 22 // Overridden from BrowserNonClientFrameView: |
| 23 virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const; | 23 virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const; |
| 24 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const; |
| 24 virtual void UpdateThrobber(bool running); | 25 virtual void UpdateThrobber(bool running); |
| 25 | 26 |
| 26 // Overridden from views::NonClientFrameView: | 27 // Overridden from views::NonClientFrameView: |
| 27 virtual gfx::Rect GetBoundsForClientView() const; | 28 virtual gfx::Rect GetBoundsForClientView() const; |
| 28 virtual bool AlwaysUseNativeFrame() const; | 29 virtual bool AlwaysUseNativeFrame() const; |
| 29 virtual gfx::Rect GetWindowBoundsForClientBounds( | 30 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 30 const gfx::Rect& client_bounds) const; | 31 const gfx::Rect& client_bounds) const; |
| 31 virtual int NonClientHitTest(const gfx::Point& point); | 32 virtual int NonClientHitTest(const gfx::Point& point); |
| 32 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { } | 33 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { } |
| 33 virtual void EnableClose(bool enable) { } | 34 virtual void EnableClose(bool enable) { } |
| 34 virtual void ResetWindowControls() { } | 35 virtual void ResetWindowControls() { } |
| 35 | 36 |
| 36 protected: | 37 protected: |
| 37 // Overridden from views::View: | 38 // Overridden from views::View: |
| 38 virtual void Paint(gfx::Canvas* canvas); | 39 virtual void Paint(gfx::Canvas* canvas); |
| 39 virtual void Layout(); | 40 virtual void Layout(); |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 // Returns the thickness of the border that makes up the window frame edges. | 43 // Returns the thickness of the border that makes up the window frame edges. |
| 43 // This does not include any client edge. | 44 // This does not include any client edge. |
| 44 int FrameBorderThickness() const; | 45 int FrameBorderThickness() const; |
| 45 | 46 |
| 46 // Returns the thickness of the entire nonclient left, right, and bottom | 47 // Returns the thickness of the entire nonclient left, right, and bottom |
| 47 // borders, including both the window frame and any client edge. | 48 // borders, including both the window frame and any client edge. |
| 48 int NonClientBorderThickness() const; | 49 int NonClientBorderThickness() const; |
| 49 | 50 |
| 50 // Returns the height of the entire nonclient top border, including the window | 51 // Returns the height of the entire nonclient top border, including the window |
| 51 // frame, any title area, and any connected client edge. | 52 // frame, any title area, and any connected client edge. If |restored| is |
| 52 int NonClientTopBorderHeight() const; | 53 // true, acts as if the window is restored regardless of the real mode. If |
| 54 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless |
| 55 // of the real state. |
| 56 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; |
| 53 | 57 |
| 54 // Paint various sub-components of this view. | 58 // Paint various sub-components of this view. |
| 55 void PaintToolbarBackground(gfx::Canvas* canvas); | 59 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 56 void PaintOTRAvatar(gfx::Canvas* canvas); | 60 void PaintOTRAvatar(gfx::Canvas* canvas); |
| 57 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 61 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
| 58 | 62 |
| 59 // Layout various sub-components of this view. | 63 // Layout various sub-components of this view. |
| 60 void LayoutOTRAvatar(); | 64 void LayoutOTRAvatar(); |
| 61 void LayoutClientView(); | 65 void LayoutClientView(); |
| 62 | 66 |
| 63 // Returns the bounds of the client area for the specified view size. | 67 // Returns the bounds of the client area for the specified view size. |
| 64 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 68 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 65 | 69 |
| 66 // Starts/Stops the window throbber running. | 70 // Starts/Stops the window throbber running. |
| 67 void StartThrobber(); | 71 void StartThrobber(); |
| 68 void StopThrobber(); | 72 void StopThrobber(); |
| 69 | 73 |
| 70 // Displays the next throbber frame. | 74 // Displays the next throbber frame. |
| 71 void DisplayNextThrobberFrame(); | 75 void DisplayNextThrobberFrame(); |
| 72 | 76 |
| 73 // The layout rect of the distributor logo, if visible. | |
| 74 gfx::Rect logo_bounds_; | |
| 75 | |
| 76 // The layout rect of the OTR avatar icon, if visible. | 77 // The layout rect of the OTR avatar icon, if visible. |
| 77 gfx::Rect otr_avatar_bounds_; | 78 gfx::Rect otr_avatar_bounds_; |
| 78 | 79 |
| 79 // The frame that hosts this view. | 80 // The frame that hosts this view. |
| 80 BrowserFrame* frame_; | 81 BrowserFrame* frame_; |
| 81 | 82 |
| 82 // The BrowserView hosted within this View. | 83 // The BrowserView hosted within this View. |
| 83 BrowserView* browser_view_; | 84 BrowserView* browser_view_; |
| 84 | 85 |
| 85 // The bounds of the ClientView. | 86 // The bounds of the ClientView. |
| 86 gfx::Rect client_view_bounds_; | 87 gfx::Rect client_view_bounds_; |
| 87 | 88 |
| 88 // Whether or not the window throbber is currently animating. | 89 // Whether or not the window throbber is currently animating. |
| 89 bool throbber_running_; | 90 bool throbber_running_; |
| 90 | 91 |
| 91 // The index of the current frame of the throbber animation. | 92 // The index of the current frame of the throbber animation. |
| 92 int throbber_frame_; | 93 int throbber_frame_; |
| 93 | 94 |
| 94 static const int kThrobberIconCount = 24; | 95 static const int kThrobberIconCount = 24; |
| 95 static HICON throbber_icons_[kThrobberIconCount]; | 96 static HICON throbber_icons_[kThrobberIconCount]; |
| 96 static void InitThrobberIcons(); | 97 static void InitThrobberIcons(); |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 99 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 #endif // CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 102 #endif // CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |