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_FRAME_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_ |
6 #define CHROME_BROWSER_VIEWS_FRAME_AERO_GLASS_FRAME_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_ |
7 | 7 |
8 #include "chrome/browser/views/frame/browser_frame.h" | |
9 #include "chrome/views/window.h" | 8 #include "chrome/views/window.h" |
10 | 9 |
11 class AeroGlassNonClientView; | 10 class AeroGlassNonClientView; |
12 class BrowserView; | 11 class BrowserView; |
| 12 class NonClientFrameView; |
| 13 class TabStrip; |
| 14 |
| 15 // A specialization of the NonClientFrameView object that provides additional |
| 16 // Browser-specific methods. |
| 17 class BrowserNonClientFrameView : public views::NonClientFrameView { |
| 18 public: |
| 19 BrowserNonClientFrameView() : NonClientFrameView() {} |
| 20 virtual ~BrowserNonClientFrameView() {} |
| 21 |
| 22 // Returns the bounds within which the TabStrip should be laid out. |
| 23 virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const = 0; |
| 24 |
| 25 // Updates the throbber. |
| 26 virtual void UpdateThrobber(bool running) = 0; |
| 27 }; |
13 | 28 |
14 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
15 // AeroGlassFrame | 30 // BrowserFrame |
16 // | 31 // |
17 // AeroGlassFrame is a Window subclass that provides the window frame on | 32 // BrowserFrame is a Window subclass that provides the window frame for the |
18 // Windows Vista with DWM desktop compositing enabled. The window's non-client | 33 // Chrome browser window. |
19 // areas are drawn by the system. | |
20 // | 34 // |
21 class AeroGlassFrame : public BrowserFrame, | 35 class BrowserFrame : public views::Window { |
22 public views::Window { | |
23 public: | 36 public: |
24 explicit AeroGlassFrame(BrowserView* browser_view); | 37 explicit BrowserFrame(BrowserView* browser_view); |
25 virtual ~AeroGlassFrame(); | 38 virtual ~BrowserFrame(); |
26 | 39 |
| 40 // Initialize the frame. Creates the Window. |
27 void Init(); | 41 void Init(); |
28 | 42 |
29 // Determine the distance of the left edge of the minimize button from the | 43 // Determine the distance of the left edge of the minimize button from the |
30 // left edge of the window. Used in our Non-Client View's Layout. | 44 // left edge of the window. Used in our Non-Client View's Layout. |
31 int GetMinimizeButtonOffset() const; | 45 int GetMinimizeButtonOffset() const; |
32 | 46 |
33 // Overridden from BrowserFrame: | 47 // Retrieves the bounds, in non-client view coordinates for the specified |
34 virtual gfx::Rect GetWindowBoundsForClientBounds( | 48 // TabStrip. |
35 const gfx::Rect& client_bounds); | 49 gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const; |
36 virtual void SizeToContents(const gfx::Rect& contents_bounds) {} | 50 |
37 virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const; | 51 // Tells the frame to update the throbber. |
38 virtual void UpdateThrobber(bool running); | 52 void UpdateThrobber(bool running); |
39 virtual views::Window* GetWindow(); | |
40 virtual const views::Window* GetWindow() const; | |
41 | 53 |
42 protected: | 54 protected: |
43 // Overridden from views::WidgetWin: | 55 // Overridden from views::WidgetWin: |
44 virtual bool AcceleratorPressed(views::Accelerator* accelerator); | 56 virtual bool AcceleratorPressed(views::Accelerator* accelerator); |
45 virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); | 57 virtual bool GetAccelerator(int cmd_id, views::Accelerator* accelerator); |
46 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); | 58 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); |
47 virtual void OnEnterSizeMove(); | 59 virtual void OnEnterSizeMove(); |
48 virtual void OnEndSession(BOOL ending, UINT logoff); | 60 virtual void OnEndSession(BOOL ending, UINT logoff); |
49 virtual LRESULT OnMouseActivate(HWND window, | 61 virtual LRESULT OnMouseActivate(HWND window, |
50 UINT hittest_code, | 62 UINT hittest_code, |
51 UINT message); | 63 UINT message); |
52 virtual void OnMove(const CPoint& point); | 64 virtual void OnMove(const CPoint& point); |
53 virtual void OnMoving(UINT param, const RECT* new_bounds); | 65 virtual void OnMoving(UINT param, const RECT* new_bounds); |
54 virtual LRESULT OnNCActivate(BOOL active); | 66 virtual LRESULT OnNCActivate(BOOL active); |
55 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); | 67 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); |
56 virtual LRESULT OnNCHitTest(const CPoint& pt); | 68 virtual LRESULT OnNCHitTest(const CPoint& pt); |
57 | 69 |
58 // Overridden from views::Window: | 70 // Overridden from views::Window: |
59 virtual int GetShowState() const; | 71 virtual int GetShowState() const; |
60 virtual bool IsAppWindow() const { return true; } | 72 virtual bool IsAppWindow() const { return true; } |
| 73 virtual views::NonClientFrameView* CreateFrameViewForWindow(); |
| 74 virtual void UpdateFrameAfterFrameChange(); |
61 | 75 |
62 private: | 76 private: |
63 // Updates the DWM with the frame bounds. | 77 // Updates the DWM with the frame bounds. |
64 void UpdateDWMFrame(); | 78 void UpdateDWMFrame(); |
65 | 79 |
66 // Return a pointer to the concrete type of our non-client view. | |
67 AeroGlassNonClientView* GetAeroGlassNonClientView() const; | |
68 | |
69 // Starts/Stops the window throbber running. | |
70 void StartThrobber(); | |
71 void StopThrobber(); | |
72 | |
73 // Displays the next throbber frame. | |
74 void DisplayNextThrobberFrame(); | |
75 | |
76 // The BrowserView is our ClientView. This is a pointer to it. | 80 // The BrowserView is our ClientView. This is a pointer to it. |
77 BrowserView* browser_view_; | 81 BrowserView* browser_view_; |
78 | 82 |
| 83 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. |
| 84 BrowserNonClientFrameView* browser_frame_view_; |
| 85 |
79 bool frame_initialized_; | 86 bool frame_initialized_; |
80 | 87 |
81 // Whether or not the window throbber is currently animating. | 88 DISALLOW_EVIL_CONSTRUCTORS(BrowserFrame); |
82 bool throbber_running_; | |
83 | |
84 // The index of the current frame of the throbber animation. | |
85 int throbber_frame_; | |
86 | |
87 static const int kThrobberIconCount = 24; | |
88 static HICON throbber_icons_[kThrobberIconCount]; | |
89 static void InitThrobberIcons(); | |
90 | |
91 DISALLOW_EVIL_CONSTRUCTORS(AeroGlassFrame); | |
92 }; | 89 }; |
93 | 90 |
94 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_AERO_GLASS_FRAME_H_ | 91 #endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_FRAME_ |
95 | 92 |
OLD | NEW |