| 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" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/window/non_client_view.h" | 13 #include "ui/views/window/non_client_view.h" |
| 14 | 14 |
| 15 class BrowserView; | 15 class BrowserView; |
| 16 | 16 |
| 17 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 17 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
| 18 public views::ButtonListener, | 18 public views::ButtonListener, |
| 19 public content::NotificationObserver { | 19 public content::NotificationObserver { |
| 20 public: | 20 public: |
| 21 // Constructs a non-client view for an BrowserFrame. | 21 // Constructs a non-client view for an BrowserFrame. |
| 22 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 22 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 23 virtual ~GlassBrowserFrameView(); | 23 virtual ~GlassBrowserFrameView(); |
| 24 | 24 |
| 25 // BrowserNonClientFrameView: | 25 // BrowserNonClientFrameView: |
| 26 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; | 26 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; |
| 27 virtual int GetTopInset() const OVERRIDE; | 27 virtual int GetTopInset() const override; |
| 28 virtual int GetThemeBackgroundXInset() const OVERRIDE; | 28 virtual int GetThemeBackgroundXInset() const override; |
| 29 virtual void UpdateThrobber(bool running) OVERRIDE; | 29 virtual void UpdateThrobber(bool running) override; |
| 30 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 30 virtual gfx::Size GetMinimumSize() const override; |
| 31 | 31 |
| 32 // views::NonClientFrameView: | 32 // views::NonClientFrameView: |
| 33 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 33 virtual gfx::Rect GetBoundsForClientView() const override; |
| 34 virtual gfx::Rect GetWindowBoundsForClientBounds( | 34 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 35 const gfx::Rect& client_bounds) const OVERRIDE; | 35 const gfx::Rect& client_bounds) const override; |
| 36 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 36 virtual int NonClientHitTest(const gfx::Point& point) override; |
| 37 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) | 37 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) |
| 38 OVERRIDE {} | 38 override {} |
| 39 virtual void ResetWindowControls() OVERRIDE {} | 39 virtual void ResetWindowControls() override {} |
| 40 virtual void UpdateWindowIcon() OVERRIDE {} | 40 virtual void UpdateWindowIcon() override {} |
| 41 virtual void UpdateWindowTitle() OVERRIDE {} | 41 virtual void UpdateWindowTitle() override {} |
| 42 virtual void SizeConstraintsChanged() OVERRIDE {} | 42 virtual void SizeConstraintsChanged() override {} |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // views::View: | 45 // views::View: |
| 46 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 46 virtual void OnPaint(gfx::Canvas* canvas) override; |
| 47 virtual void Layout() OVERRIDE; | 47 virtual void Layout() override; |
| 48 | 48 |
| 49 // views::ButtonListener: | 49 // views::ButtonListener: |
| 50 virtual void ButtonPressed(views::Button* sender, | 50 virtual void ButtonPressed(views::Button* sender, |
| 51 const ui::Event& event) OVERRIDE; | 51 const ui::Event& event) override; |
| 52 | 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 |
| 63 // borders, including both the window frame and any client edge. | 63 // borders, including both the window frame and any client edge. |
| 64 int NonClientBorderThickness() const; | 64 int NonClientBorderThickness() const; |
| 65 | 65 |
| 66 // Returns the height of the entire nonclient top border, including the window | 66 // Returns the height of the entire nonclient top border, including the window |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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: | 92 // content::NotificationObserver implementation: |
| 93 virtual void Observe(int type, | 93 virtual void Observe(int type, |
| 94 const content::NotificationSource& source, | 94 const content::NotificationSource& source, |
| 95 const content::NotificationDetails& details) OVERRIDE; | 95 const content::NotificationDetails& details) override; |
| 96 | 96 |
| 97 // The layout rect of the avatar icon, if visible. | 97 // The layout rect of the avatar icon, if visible. |
| 98 gfx::Rect avatar_bounds_; | 98 gfx::Rect avatar_bounds_; |
| 99 | 99 |
| 100 // The bounds of the ClientView. | 100 // The bounds of the ClientView. |
| 101 gfx::Rect client_view_bounds_; | 101 gfx::Rect client_view_bounds_; |
| 102 | 102 |
| 103 // Whether or not the window throbber is currently animating. | 103 // Whether or not the window throbber is currently animating. |
| 104 bool throbber_running_; | 104 bool throbber_running_; |
| 105 | 105 |
| 106 // The index of the current frame of the throbber animation. | 106 // The index of the current frame of the throbber animation. |
| 107 int throbber_frame_; | 107 int throbber_frame_; |
| 108 | 108 |
| 109 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
| 110 | 110 |
| 111 static const int kThrobberIconCount = 24; | 111 static const int kThrobberIconCount = 24; |
| 112 static HICON throbber_icons_[kThrobberIconCount]; | 112 static HICON throbber_icons_[kThrobberIconCount]; |
| 113 static void InitThrobberIcons(); | 113 static void InitThrobberIcons(); |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 115 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 118 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |