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