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; |
(...skipping 13 matching lines...) Expand all Loading... |
43 | 40 |
44 protected: | 41 protected: |
45 // views::View: | 42 // views::View: |
46 virtual void OnPaint(gfx::Canvas* canvas) override; | 43 virtual void OnPaint(gfx::Canvas* canvas) override; |
47 virtual void Layout() override; | 44 virtual void Layout() override; |
48 | 45 |
49 // views::ButtonListener: | 46 // views::ButtonListener: |
50 virtual void ButtonPressed(views::Button* sender, | 47 virtual void ButtonPressed(views::Button* sender, |
51 const ui::Event& event) override; | 48 const ui::Event& event) override; |
52 | 49 |
| 50 // BrowserNonClientFrameView: |
| 51 void UpdateNewStyleAvatar() override; |
| 52 |
53 private: | 53 private: |
54 // views::NonClientFrameView: | 54 // views::NonClientFrameView: |
55 virtual bool DoesIntersectRect(const views::View* target, | 55 virtual bool DoesIntersectRect(const views::View* target, |
56 const gfx::Rect& rect) const override; | 56 const gfx::Rect& rect) const override; |
57 | 57 |
58 // Returns the thickness of the border that makes up the window frame edges. | 58 // Returns the thickness of the border that makes up the window frame edges. |
59 // This does not include any client edge. | 59 // This does not include any client edge. |
60 int FrameBorderThickness() const; | 60 int FrameBorderThickness() const; |
61 | 61 |
62 // Returns the thickness of the entire nonclient left, right, and bottom | 62 // Returns the thickness of the entire nonclient left, right, and bottom |
(...skipping 19 matching lines...) Expand all Loading... |
82 // Returns the bounds of the client area for the specified view size. | 82 // Returns the bounds of the client area for the specified view size. |
83 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 83 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
84 | 84 |
85 // Starts/Stops the window throbber running. | 85 // Starts/Stops the window throbber running. |
86 void StartThrobber(); | 86 void StartThrobber(); |
87 void StopThrobber(); | 87 void StopThrobber(); |
88 | 88 |
89 // Displays the next throbber frame. | 89 // Displays the next throbber frame. |
90 void DisplayNextThrobberFrame(); | 90 void DisplayNextThrobberFrame(); |
91 | 91 |
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. | 92 // The layout rect of the avatar icon, if visible. |
98 gfx::Rect avatar_bounds_; | 93 gfx::Rect avatar_bounds_; |
99 | 94 |
100 // The bounds of the ClientView. | 95 // The bounds of the ClientView. |
101 gfx::Rect client_view_bounds_; | 96 gfx::Rect client_view_bounds_; |
102 | 97 |
103 // Whether or not the window throbber is currently animating. | 98 // Whether or not the window throbber is currently animating. |
104 bool throbber_running_; | 99 bool throbber_running_; |
105 | 100 |
106 // The index of the current frame of the throbber animation. | 101 // The index of the current frame of the throbber animation. |
107 int throbber_frame_; | 102 int throbber_frame_; |
108 | 103 |
109 content::NotificationRegistrar registrar_; | |
110 | |
111 static const int kThrobberIconCount = 24; | 104 static const int kThrobberIconCount = 24; |
112 static HICON throbber_icons_[kThrobberIconCount]; | 105 static HICON throbber_icons_[kThrobberIconCount]; |
113 static void InitThrobberIcons(); | 106 static void InitThrobberIcons(); |
114 | 107 |
115 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 108 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
116 }; | 109 }; |
117 | 110 |
118 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 111 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |