| 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 (web content, |
| 56 // and bottom frame edges. This does not include any client edge. | 56 // toolbar, and tabs) that separates it from the frame border. If |restored| |
| 57 // is true, this is calculated as if the window was restored, regardless of |
| 58 // its current state. |
| 59 int ClientBorderThickness(bool restored) const; |
| 60 |
| 61 // Returns the thickness of the window border for the left, right, and bottom |
| 62 // edges of the frame. On Windows 10 this is a mostly-transparent handle that |
| 63 // allows you to resize the window. |
| 57 int FrameBorderThickness() const; | 64 int FrameBorderThickness() const; |
| 58 | 65 |
| 59 // Returns the height of the window top frame edge. If |restored| is true, | 66 // Returns the thickness of the window border for the top edge of the frame, |
| 60 // this is calculated as if the window was restored, regardless of its current | 67 // which is sometimes different than FrameBorderThickness(). Does not include |
| 61 // state. | 68 // the titlebar/tabstrip area. If |restored| is true, this is calculated as if |
| 62 int FrameTopBorderHeight(bool restored) const; | 69 // the window was restored, regardless of its current state. |
| 70 int FrameTopBorderThickness(bool restored) const; |
| 63 | 71 |
| 64 // Returns the thickness of the entire nonclient left, right, and bottom | 72 // Returns the height of everything above the tabstrip's hit-test region, |
| 65 // borders, including both the window frame and any client edge. If |restored| | 73 // including both the window border (i.e. FrameTopBorderThickness()) and any |
| 66 // is true, this is calculated as if the window was restored, regardless of | 74 // additional draggable area that's considered part of the window frame rather |
| 67 // its current state. | 75 // than the tabstrip. If |restored| is true, this is calculated as if the |
| 68 int NonClientBorderThickness(bool restored) const; | 76 // window was restored, regardless of its current state. |
| 77 int TopAreaHeight(bool restored) const; |
| 69 | 78 |
| 70 // Returns the height of the entire nonclient top border, including the window | 79 // Returns the y coordinate for the top of the frame, which in maximized mode |
| 71 // frame, any title area, and any connected client edge. If |restored| is | 80 // is the top of the screen and in restored mode is 1 pixel below the top of |
| 72 // true, this is calculated as if the window was restored, regardless of its | 81 // the window to leave room for the visual border that Windows draws. |
| 73 // current state. | 82 int WindowTopY() const; |
| 74 int NonClientTopBorderHeight(bool restored) const; | |
| 75 | 83 |
| 76 // Returns whether the toolbar is currently visible. | 84 // Returns whether the toolbar is currently visible. |
| 77 bool IsToolbarVisible() const; | 85 bool IsToolbarVisible() const; |
| 78 | 86 |
| 87 // Returns whether the caption buttons are drawn at the leading edge (i.e. the |
| 88 // left in LTR mode, or the right in RTL mode). |
| 89 bool CaptionButtonsOnLeadingEdge() const; |
| 90 |
| 79 // Paint various sub-components of this view. | 91 // Paint various sub-components of this view. |
| 80 void PaintToolbarBackground(gfx::Canvas* canvas) const; | 92 void PaintToolbarBackground(gfx::Canvas* canvas) const; |
| 81 void PaintClientEdge(gfx::Canvas* canvas) const; | 93 void PaintClientEdge(gfx::Canvas* canvas) const; |
| 82 void FillClientEdgeRects(int x, | 94 void FillClientEdgeRects(int x, |
| 83 int y, | 95 int y, |
| 84 int right, | 96 int right, |
| 85 int bottom, | 97 int bottom, |
| 86 SkColor color, | 98 SkColor color, |
| 87 gfx::Canvas* canvas) const; | 99 gfx::Canvas* canvas) const; |
| 88 | 100 |
| 89 // Layout various sub-components of this view. | 101 // Layout various sub-components of this view. |
| 90 void LayoutIncognitoIcon(); | 102 void LayoutIncognitoIcon(); |
| 91 void LayoutNewStyleAvatar(); | 103 void LayoutProfileSwitcher(); |
| 92 void LayoutClientView(); | 104 void LayoutClientView(); |
| 93 | 105 |
| 94 // Returns the insets of the client area. If |restored| is true, this is | 106 // 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. | 107 // calculated as if the window was restored, regardless of its current state. |
| 96 gfx::Insets GetClientAreaInsets(bool restored) const; | 108 gfx::Insets GetClientAreaInsets(bool restored) const; |
| 97 | 109 |
| 98 // Returns the bounds of the client area for the specified view size. | 110 // Returns the bounds of the client area for the specified view size. |
| 99 gfx::Rect CalculateClientAreaBounds() const; | 111 gfx::Rect CalculateClientAreaBounds() const; |
| 100 | 112 |
| 101 // Starts/Stops the window throbber running. | 113 // Starts/Stops the window throbber running. |
| 102 void StartThrobber(); | 114 void StartThrobber(); |
| 103 void StopThrobber(); | 115 void StopThrobber(); |
| 104 | 116 |
| 105 // Displays the next throbber frame. | 117 // Displays the next throbber frame. |
| 106 void DisplayNextThrobberFrame(); | 118 void DisplayNextThrobberFrame(); |
| 107 | 119 |
| 108 // The layout rect of the incognito icon, if visible. | 120 // The layout rect of the incognito icon, if visible. |
| 109 gfx::Rect incognito_bounds_; | 121 gfx::Rect incognito_bounds_; |
| 110 | 122 |
| 111 // The bounds of the ClientView. | 123 // The bounds of the ClientView. |
| 112 gfx::Rect client_view_bounds_; | 124 gfx::Rect client_view_bounds_; |
| 113 | 125 |
| 114 // The small icon created from the bitmap image of the window icon. | 126 // The small icon created from the bitmap image of the window icon. |
| 115 base::win::ScopedHICON small_window_icon_; | 127 base::win::ScopedHICON small_window_icon_; |
| 116 | 128 |
| 117 // The big icon created from the bitmap image of the window icon. | 129 // The big icon created from the bitmap image of the window icon. |
| 118 base::win::ScopedHICON big_window_icon_; | 130 base::win::ScopedHICON big_window_icon_; |
| 119 | 131 |
| 120 // Wrapper around the in-frame avatar switcher. | 132 // Wrapper around the in-frame profile switcher. |
| 121 AvatarButtonManager profile_switcher_; | 133 AvatarButtonManager profile_switcher_; |
| 122 | 134 |
| 123 // Whether or not the window throbber is currently animating. | 135 // Whether or not the window throbber is currently animating. |
| 124 bool throbber_running_; | 136 bool throbber_running_; |
| 125 | 137 |
| 126 // The index of the current frame of the throbber animation. | 138 // The index of the current frame of the throbber animation. |
| 127 int throbber_frame_; | 139 int throbber_frame_; |
| 128 | 140 |
| 129 static const int kThrobberIconCount = 24; | 141 static const int kThrobberIconCount = 24; |
| 130 static HICON throbber_icons_[kThrobberIconCount]; | 142 static HICON throbber_icons_[kThrobberIconCount]; |
| 131 static void InitThrobberIcons(); | 143 static void InitThrobberIcons(); |
| 132 | 144 |
| 133 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 145 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 134 }; | 146 }; |
| 135 | 147 |
| 136 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 148 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |