| 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 "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/win/scoped_gdi_object.h" | 10 #include "base/win/scoped_gdi_object.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void Layout() override; | 45 void Layout() override; |
| 46 | 46 |
| 47 // BrowserNonClientFrameView: | 47 // BrowserNonClientFrameView: |
| 48 void UpdateAvatar() override; | 48 void UpdateAvatar() override; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // views::NonClientFrameView: | 51 // views::NonClientFrameView: |
| 52 bool DoesIntersectRect(const views::View* target, | 52 bool DoesIntersectRect(const views::View* target, |
| 53 const gfx::Rect& rect) const override; | 53 const gfx::Rect& rect) const override; |
| 54 | 54 |
| 55 // Returns the thickness of the border that makes up the window left, right, | 55 // Returns the thickness of the border around the client area that separates |
| 56 // and bottom frame edges. This does not include any client edge. | 56 // it from the non-client area. If |restored| is true, this is calculated as |
| 57 int FrameBorderThickness() const; | 57 // if the window was restored, regardless of its current state. |
| 58 int ClientBorderThickness(bool restored) const; |
| 58 | 59 |
| 59 // Returns the height of the window top frame edge. If |restored| is true, | 60 // Returns the thickness of the window border for the left, right, and bottom |
| 60 // this is calculated as if the window was restored, regardless of its current | 61 // edges of the frame. On Windows 10 this is a mostly-transparent handle that |
| 61 // state. | 62 // allows you to resize the window. |
| 62 int FrameTopBorderHeight(bool restored) const; | 63 int NonClientBorderThickness() const; |
| 63 | 64 |
| 64 // Returns the thickness of the entire nonclient left, right, and bottom | 65 // Returns the thickness of the window border for the top edge of the frame, |
| 65 // borders, including both the window frame and any client edge. If |restored| | 66 // which is sometimes different than NonClientBorderThickness(). Does not |
| 66 // is true, this is calculated as if the window was restored, regardless of | 67 // include the titlebar/tabstrip area. If |restored| is true, this is |
| 67 // its current state. | 68 // calculated as if the window was restored, regardless of its current state. |
| 68 int NonClientBorderThickness(bool restored) const; | 69 int NonClientTopBorderThickness(bool restored) const; |
| 69 | 70 |
| 70 // Returns the height of the entire nonclient top border, including the window | 71 // Returns the height of the entire nonclient top border, from the edge of the |
| 71 // frame, any title area, and any connected client edge. If |restored| is | 72 // window to the top of the tabs. If |restored| is true, this is calculated as |
| 72 // true, this is calculated as if the window was restored, regardless of its | 73 // if the window was restored, regardless of its current state. |
| 73 // current state. | 74 int NonClientTopHeight(bool restored) const; |
| 74 int NonClientTopBorderHeight(bool restored) const; | 75 |
| 76 // Returns the y coordinate for the Windows caption buttons. |
| 77 int CaptionButtonY() const; |
| 75 | 78 |
| 76 // Returns whether the toolbar is currently visible. | 79 // Returns whether the toolbar is currently visible. |
| 77 bool IsToolbarVisible() const; | 80 bool IsToolbarVisible() const; |
| 78 | 81 |
| 82 // Returns whether the caption buttons are drawn at the leading edge (i.e. the |
| 83 // left in LTR mode, or the right in RTL mode). |
| 84 bool CaptionButtonsOnLeadingEdge() const; |
| 85 |
| 79 // Paint various sub-components of this view. | 86 // Paint various sub-components of this view. |
| 80 void PaintToolbarBackground(gfx::Canvas* canvas) const; | 87 void PaintToolbarBackground(gfx::Canvas* canvas) const; |
| 81 void PaintClientEdge(gfx::Canvas* canvas) const; | 88 void PaintClientEdge(gfx::Canvas* canvas) const; |
| 82 void FillClientEdgeRects(int x, | 89 void FillClientEdgeRects(int x, |
| 83 int y, | 90 int y, |
| 84 int right, | 91 int right, |
| 85 int bottom, | 92 int bottom, |
| 86 SkColor color, | 93 SkColor color, |
| 87 gfx::Canvas* canvas) const; | 94 gfx::Canvas* canvas) const; |
| 88 | 95 |
| 89 // Layout various sub-components of this view. | 96 // Layout various sub-components of this view. |
| 90 void LayoutIncognitoIcon(); | 97 void LayoutIncognitoIcon(); |
| 91 void LayoutNewStyleAvatar(); | 98 void LayoutProfileSwitcher(); |
| 92 void LayoutClientView(); | 99 void LayoutClientView(); |
| 93 | 100 |
| 94 // Returns the insets of the client area. If |restored| is true, this is | 101 // Returns the insets of the client area. If |restored| is true, this is |
| 95 // calculated as if the window was restored, regardless of its current state. | 102 // calculated as if the window was restored, regardless of its current state. |
| 96 gfx::Insets GetClientAreaInsets(bool restored) const; | 103 gfx::Insets GetClientAreaInsets(bool restored) const; |
| 97 | 104 |
| 98 // Returns the bounds of the client area for the specified view size. | 105 // Returns the bounds of the client area for the specified view size. |
| 99 gfx::Rect CalculateClientAreaBounds() const; | 106 gfx::Rect CalculateClientAreaBounds() const; |
| 100 | 107 |
| 101 // Starts/Stops the window throbber running. | 108 // Starts/Stops the window throbber running. |
| 102 void StartThrobber(); | 109 void StartThrobber(); |
| 103 void StopThrobber(); | 110 void StopThrobber(); |
| 104 | 111 |
| 105 // Displays the next throbber frame. | 112 // Displays the next throbber frame. |
| 106 void DisplayNextThrobberFrame(); | 113 void DisplayNextThrobberFrame(); |
| 107 | 114 |
| 108 // The layout rect of the incognito icon, if visible. | 115 // The layout rect of the incognito icon, if visible. |
| 109 gfx::Rect incognito_bounds_; | 116 gfx::Rect incognito_bounds_; |
| 110 | 117 |
| 111 // The bounds of the ClientView. | 118 // The bounds of the ClientView. |
| 112 gfx::Rect client_view_bounds_; | 119 gfx::Rect client_view_bounds_; |
| 113 | 120 |
| 114 // The small icon created from the bitmap image of the window icon. | 121 // The small icon created from the bitmap image of the window icon. |
| 115 base::win::ScopedHICON small_window_icon_; | 122 base::win::ScopedHICON small_window_icon_; |
| 116 | 123 |
| 117 // The big icon created from the bitmap image of the window icon. | 124 // The big icon created from the bitmap image of the window icon. |
| 118 base::win::ScopedHICON big_window_icon_; | 125 base::win::ScopedHICON big_window_icon_; |
| 119 | 126 |
| 120 // Wrapper around the in-frame avatar switcher. | 127 // Wrapper around the in-frame profile switcher. |
| 121 AvatarButtonManager profile_switcher_; | 128 AvatarButtonManager profile_switcher_; |
| 122 | 129 |
| 123 // Whether or not the window throbber is currently animating. | 130 // Whether or not the window throbber is currently animating. |
| 124 bool throbber_running_; | 131 bool throbber_running_; |
| 125 | 132 |
| 126 // The index of the current frame of the throbber animation. | 133 // The index of the current frame of the throbber animation. |
| 127 int throbber_frame_; | 134 int throbber_frame_; |
| 128 | 135 |
| 129 static const int kThrobberIconCount = 24; | 136 static const int kThrobberIconCount = 24; |
| 130 static HICON throbber_icons_[kThrobberIconCount]; | 137 static HICON throbber_icons_[kThrobberIconCount]; |
| 131 static void InitThrobberIcons(); | 138 static void InitThrobberIcons(); |
| 132 | 139 |
| 133 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 140 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 134 }; | 141 }; |
| 135 | 142 |
| 136 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 143 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |