OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_AERO_GLASS_NON_CLIENT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_FRAME_AERO_GLASS_NON_CLIENT_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/views/frame/aero_glass_frame.h" | 8 #include "chrome/browser/views/frame/browser_frame.h" |
9 #include "chrome/views/non_client_view.h" | 9 #include "chrome/views/non_client_view.h" |
10 #include "chrome/views/button.h" | 10 #include "chrome/views/button.h" |
11 | 11 |
12 class BrowserView; | 12 class BrowserView; |
13 class AeroGlassWindowResources; | 13 class GlassBrowserWindowResources; |
14 | 14 |
15 class AeroGlassNonClientView : public views::NonClientView { | 15 class GlassBrowserFrameView : public BrowserNonClientFrameView { |
16 public: | 16 public: |
17 // Constructs a non-client view for an AeroGlassFrame. | 17 // Constructs a non-client view for an BrowserFrame. |
18 AeroGlassNonClientView(AeroGlassFrame* frame, BrowserView* browser_view); | 18 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
19 virtual ~AeroGlassNonClientView(); | 19 virtual ~GlassBrowserFrameView(); |
20 | 20 |
21 // Retrieve the bounds for the specified |tabstrip|, in the coordinate system | 21 // Overridden from BrowserNonClientFrameView: |
22 // of the non-client view (which whould be window coordinates). | 22 virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const; |
23 gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip); | 23 virtual void UpdateThrobber(bool running); |
24 | 24 |
25 protected: | 25 // Overridden from views::NonClientFrameView: |
26 // Overridden from views::NonClientView: | 26 virtual gfx::Rect GetBoundsForClientView() const; |
27 virtual gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 27 virtual gfx::Rect GetWindowBoundsForClientBounds( |
28 virtual gfx::Size CalculateWindowSizeForClientSize(int width, | 28 const gfx::Rect& client_bounds) const; |
29 int height) const; | |
30 virtual gfx::Point GetSystemMenuPoint() const; | 29 virtual gfx::Point GetSystemMenuPoint() const; |
31 virtual int NonClientHitTest(const gfx::Point& point); | 30 virtual int NonClientHitTest(const gfx::Point& point); |
32 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { } | 31 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) { } |
33 virtual void EnableClose(bool enable) { } | 32 virtual void EnableClose(bool enable) { } |
34 virtual void ResetWindowControls() { } | 33 virtual void ResetWindowControls() { } |
35 | 34 |
| 35 protected: |
36 // Overridden from views::View: | 36 // Overridden from views::View: |
37 virtual void Paint(ChromeCanvas* canvas); | 37 virtual void Paint(ChromeCanvas* canvas); |
38 virtual void Layout(); | 38 virtual void Layout(); |
39 virtual void ViewHierarchyChanged(bool is_add, | |
40 views::View* parent, | |
41 views::View* child); | |
42 | 39 |
43 private: | 40 private: |
44 // Returns the thickness of the border that makes up the window frame edges. | 41 // Returns the thickness of the border that makes up the window frame edges. |
45 // This does not include any client edge. | 42 // This does not include any client edge. |
46 int FrameBorderThickness() const; | 43 int FrameBorderThickness() const; |
47 | 44 |
48 // Returns the thickness of the entire nonclient left, right, and bottom | 45 // Returns the thickness of the entire nonclient left, right, and bottom |
49 // borders, including both the window frame and any client edge. | 46 // borders, including both the window frame and any client edge. |
50 int NonClientBorderThickness() const; | 47 int NonClientBorderThickness() const; |
51 | 48 |
52 // Returns the height of the entire nonclient top border, including the window | 49 // Returns the height of the entire nonclient top border, including the window |
53 // frame, any title area, and any connected client edge. | 50 // frame, any title area, and any connected client edge. |
54 int NonClientTopBorderHeight() const; | 51 int NonClientTopBorderHeight() const; |
55 | 52 |
56 // Paint various sub-components of this view. | 53 // Paint various sub-components of this view. |
57 void PaintDistributorLogo(ChromeCanvas* canvas); | 54 void PaintDistributorLogo(ChromeCanvas* canvas); |
58 void PaintToolbarBackground(ChromeCanvas* canvas); | 55 void PaintToolbarBackground(ChromeCanvas* canvas); |
59 void PaintOTRAvatar(ChromeCanvas* canvas); | 56 void PaintOTRAvatar(ChromeCanvas* canvas); |
60 void PaintClientEdge(ChromeCanvas* canvas); | 57 void PaintClientEdge(ChromeCanvas* canvas); |
61 | 58 |
62 // Layout various sub-components of this view. | 59 // Layout various sub-components of this view. |
63 void LayoutDistributorLogo(); | 60 void LayoutDistributorLogo(); |
64 void LayoutOTRAvatar(); | 61 void LayoutOTRAvatar(); |
65 void LayoutClientView(); | 62 void LayoutClientView(); |
| 63 |
| 64 // Returns the bounds of the client area for the specified view size. |
| 65 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
66 | 66 |
| 67 // Starts/Stops the window throbber running. |
| 68 void StartThrobber(); |
| 69 void StopThrobber(); |
| 70 |
| 71 // Displays the next throbber frame. |
| 72 void DisplayNextThrobberFrame(); |
| 73 |
67 // The layout rect of the distributor logo, if visible. | 74 // The layout rect of the distributor logo, if visible. |
68 gfx::Rect logo_bounds_; | 75 gfx::Rect logo_bounds_; |
69 | 76 |
70 // The layout rect of the OTR avatar icon, if visible. | 77 // The layout rect of the OTR avatar icon, if visible. |
71 gfx::Rect otr_avatar_bounds_; | 78 gfx::Rect otr_avatar_bounds_; |
72 | 79 |
73 // The frame that hosts this view. | 80 // The frame that hosts this view. |
74 AeroGlassFrame* frame_; | 81 BrowserFrame* frame_; |
75 | 82 |
76 // The BrowserView hosted within this View. | 83 // The BrowserView hosted within this View. |
77 BrowserView* browser_view_; | 84 BrowserView* browser_view_; |
78 | 85 |
| 86 // The bounds of the ClientView. |
| 87 gfx::Rect client_view_bounds_; |
| 88 |
| 89 // Whether or not the window throbber is currently animating. |
| 90 bool throbber_running_; |
| 91 |
| 92 // The index of the current frame of the throbber animation. |
| 93 int throbber_frame_; |
| 94 |
79 static void InitClass(); | 95 static void InitClass(); |
80 static SkBitmap* distributor_logo_; | 96 static SkBitmap* distributor_logo_; |
81 static AeroGlassWindowResources* resources_; | 97 static GlassBrowserWindowResources* resources_; |
82 | 98 |
83 DISALLOW_EVIL_CONSTRUCTORS(AeroGlassNonClientView); | 99 static const int kThrobberIconCount = 24; |
| 100 static HICON throbber_icons_[kThrobberIconCount]; |
| 101 static void InitThrobberIcons(); |
| 102 |
| 103 DISALLOW_EVIL_CONSTRUCTORS(GlassBrowserFrameView); |
84 }; | 104 }; |
85 | 105 |
86 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_AERO_GLASS_NON_CLIENT_VIEW_H_ | 106 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
87 | 107 |
OLD | NEW |