| 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_frame_win.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame_win.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/window/non_client_view.h" | 14 #include "ui/views/window/non_client_view.h" |
| 15 | 15 |
| 16 class BrowserView; | 16 class BrowserView; |
| 17 | 17 |
| 18 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 18 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
| 19 public views::ButtonListener, |
| 19 public content::NotificationObserver { | 20 public content::NotificationObserver { |
| 20 public: | 21 public: |
| 21 // Constructs a non-client view for an BrowserFrame. | 22 // Constructs a non-client view for an BrowserFrame. |
| 22 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 23 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 23 virtual ~GlassBrowserFrameView(); | 24 virtual ~GlassBrowserFrameView(); |
| 24 | 25 |
| 25 // Overridden from BrowserNonClientFrameView: | 26 // Overridden from BrowserNonClientFrameView: |
| 26 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; | 27 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; |
| 27 virtual TabStripInsets GetTabStripInsets(bool restored) const OVERRIDE; | 28 virtual TabStripInsets GetTabStripInsets(bool restored) const OVERRIDE; |
| 28 virtual int GetThemeBackgroundXInset() const OVERRIDE; | 29 virtual int GetThemeBackgroundXInset() const OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 virtual void ResetWindowControls() OVERRIDE {} | 40 virtual void ResetWindowControls() OVERRIDE {} |
| 40 virtual void UpdateWindowIcon() OVERRIDE {} | 41 virtual void UpdateWindowIcon() OVERRIDE {} |
| 41 virtual void UpdateWindowTitle() OVERRIDE {} | 42 virtual void UpdateWindowTitle() OVERRIDE {} |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 // Overridden from views::View: | 45 // Overridden from views::View: |
| 45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 46 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 46 virtual void Layout() OVERRIDE; | 47 virtual void Layout() OVERRIDE; |
| 47 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 48 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 48 | 49 |
| 50 // Overidden from views::ButtonListener: |
| 51 virtual void ButtonPressed(views::Button* sender, |
| 52 const ui::Event& event) OVERRIDE; |
| 53 |
| 49 private: | 54 private: |
| 50 // Returns the thickness of the border that makes up the window frame edges. | 55 // Returns the thickness of the border that makes up the window frame edges. |
| 51 // This does not include any client edge. | 56 // This does not include any client edge. |
| 52 int FrameBorderThickness() const; | 57 int FrameBorderThickness() const; |
| 53 | 58 |
| 54 // Returns the thickness of the entire nonclient left, right, and bottom | 59 // Returns the thickness of the entire nonclient left, right, and bottom |
| 55 // borders, including both the window frame and any client edge. | 60 // borders, including both the window frame and any client edge. |
| 56 int NonClientBorderThickness() const; | 61 int NonClientBorderThickness() const; |
| 57 | 62 |
| 58 // Returns the height of the entire nonclient top border, including the window | 63 // Returns the height of the entire nonclient top border, including the window |
| 59 // frame, any title area, and any connected client edge. If |restored| is | 64 // frame, any title area, and any connected client edge. If |restored| is |
| 60 // true, acts as if the window is restored regardless of the real mode. | 65 // true, acts as if the window is restored regardless of the real mode. |
| 61 int NonClientTopBorderHeight(bool restored) const; | 66 int NonClientTopBorderHeight(bool restored) const; |
| 62 | 67 |
| 63 // Paint various sub-components of this view. | 68 // Paint various sub-components of this view. |
| 64 void PaintToolbarBackground(gfx::Canvas* canvas); | 69 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 65 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 70 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
| 66 | 71 |
| 67 // Layout various sub-components of this view. | 72 // Layout various sub-components of this view. |
| 68 void LayoutAvatar(); | 73 void LayoutAvatar(); |
| 74 void LayoutNewStyleAvatar(); |
| 69 void LayoutClientView(); | 75 void LayoutClientView(); |
| 70 | 76 |
| 71 // Returns the insets of the client area. | 77 // Returns the insets of the client area. |
| 72 gfx::Insets GetClientAreaInsets() const; | 78 gfx::Insets GetClientAreaInsets() const; |
| 73 | 79 |
| 74 // 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. |
| 75 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 81 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 76 | 82 |
| 77 // Starts/Stops the window throbber running. | 83 // Starts/Stops the window throbber running. |
| 78 void StartThrobber(); | 84 void StartThrobber(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 content::NotificationRegistrar registrar_; | 107 content::NotificationRegistrar registrar_; |
| 102 | 108 |
| 103 static const int kThrobberIconCount = 24; | 109 static const int kThrobberIconCount = 24; |
| 104 static HICON throbber_icons_[kThrobberIconCount]; | 110 static HICON throbber_icons_[kThrobberIconCount]; |
| 105 static void InitThrobberIcons(); | 111 static void InitThrobberIcons(); |
| 106 | 112 |
| 107 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 113 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 108 }; | 114 }; |
| 109 | 115 |
| 110 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |