OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
10 #include "content/public/browser/notification_observer.h" | |
11 #include "content/public/browser/notification_registrar.h" | |
12 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/window/non_client_view.h" | 11 #include "ui/views/window/non_client_view.h" |
14 | 12 |
15 class BrowserView; | 13 class BrowserView; |
16 | 14 |
17 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 15 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
18 public views::ButtonListener, | 16 public views::ButtonListener { |
19 public content::NotificationObserver { | |
20 public: | 17 public: |
21 // Constructs a non-client view for an BrowserFrame. | 18 // Constructs a non-client view for an BrowserFrame. |
22 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 19 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
23 virtual ~GlassBrowserFrameView(); | 20 virtual ~GlassBrowserFrameView(); |
24 | 21 |
25 // BrowserNonClientFrameView: | 22 // BrowserNonClientFrameView: |
26 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; | 23 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; |
27 virtual int GetTopInset() const override; | 24 virtual int GetTopInset() const override; |
28 virtual int GetThemeBackgroundXInset() const override; | 25 virtual int GetThemeBackgroundXInset() const override; |
29 virtual void UpdateThrobber(bool running) override; | 26 virtual void UpdateThrobber(bool running) override; |
30 virtual gfx::Size GetMinimumSize() const override; | 27 virtual gfx::Size GetMinimumSize() const override; |
| 28 void UpdateNewStyleAvatar() override; |
31 | 29 |
32 // views::NonClientFrameView: | 30 // views::NonClientFrameView: |
33 virtual gfx::Rect GetBoundsForClientView() const override; | 31 virtual gfx::Rect GetBoundsForClientView() const override; |
34 virtual gfx::Rect GetWindowBoundsForClientBounds( | 32 virtual gfx::Rect GetWindowBoundsForClientBounds( |
35 const gfx::Rect& client_bounds) const override; | 33 const gfx::Rect& client_bounds) const override; |
36 virtual int NonClientHitTest(const gfx::Point& point) override; | 34 virtual int NonClientHitTest(const gfx::Point& point) override; |
37 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) | 35 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) |
38 override {} | 36 override {} |
39 virtual void ResetWindowControls() override {} | 37 virtual void ResetWindowControls() override {} |
40 virtual void UpdateWindowIcon() override {} | 38 virtual void UpdateWindowIcon() override {} |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Returns the bounds of the client area for the specified view size. | 80 // Returns the bounds of the client area for the specified view size. |
83 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 81 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
84 | 82 |
85 // Starts/Stops the window throbber running. | 83 // Starts/Stops the window throbber running. |
86 void StartThrobber(); | 84 void StartThrobber(); |
87 void StopThrobber(); | 85 void StopThrobber(); |
88 | 86 |
89 // Displays the next throbber frame. | 87 // Displays the next throbber frame. |
90 void DisplayNextThrobberFrame(); | 88 void DisplayNextThrobberFrame(); |
91 | 89 |
92 // content::NotificationObserver implementation: | |
93 virtual void Observe(int type, | |
94 const content::NotificationSource& source, | |
95 const content::NotificationDetails& details) override; | |
96 | |
97 // The layout rect of the avatar icon, if visible. | 90 // The layout rect of the avatar icon, if visible. |
98 gfx::Rect avatar_bounds_; | 91 gfx::Rect avatar_bounds_; |
99 | 92 |
100 // The bounds of the ClientView. | 93 // The bounds of the ClientView. |
101 gfx::Rect client_view_bounds_; | 94 gfx::Rect client_view_bounds_; |
102 | 95 |
103 // Whether or not the window throbber is currently animating. | 96 // Whether or not the window throbber is currently animating. |
104 bool throbber_running_; | 97 bool throbber_running_; |
105 | 98 |
106 // The index of the current frame of the throbber animation. | 99 // The index of the current frame of the throbber animation. |
107 int throbber_frame_; | 100 int throbber_frame_; |
108 | 101 |
109 content::NotificationRegistrar registrar_; | |
110 | |
111 static const int kThrobberIconCount = 24; | 102 static const int kThrobberIconCount = 24; |
112 static HICON throbber_icons_[kThrobberIconCount]; | 103 static HICON throbber_icons_[kThrobberIconCount]; |
113 static void InitThrobberIcons(); | 104 static void InitThrobberIcons(); |
114 | 105 |
115 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 106 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
116 }; | 107 }; |
117 | 108 |
118 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 109 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |