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" |
11 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" | 11 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" |
12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
13 #include "chrome/browser/ui/views/frame/windows_10_caption_button.h" | 13 #include "chrome/browser/ui/views/frame/windows_10_caption_button.h" |
14 #include "chrome/browser/ui/views/tab_icon_view.h" | 14 #include "chrome/browser/ui/views/tab_icon_view.h" |
15 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 15 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
16 #include "chrome/browser/ui/views/tabs/tab_strip.h" | |
17 #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" | |
16 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/window/non_client_view.h" | 19 #include "ui/views/window/non_client_view.h" |
18 | 20 |
19 class BrowserView; | 21 class BrowserView; |
20 | 22 |
21 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 23 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
22 public views::ButtonListener, | 24 public views::ButtonListener, |
23 public TabIconViewModel { | 25 public TabIconViewModel, |
26 public TabStripObserver { | |
24 public: | 27 public: |
25 // Constructs a non-client view for an BrowserFrame. | 28 // Constructs a non-client view for an BrowserFrame. |
26 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 29 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
27 ~GlassBrowserFrameView() override; | 30 ~GlassBrowserFrameView() override; |
28 | 31 |
29 // BrowserNonClientFrameView: | 32 // BrowserNonClientFrameView: |
30 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; | 33 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; |
31 int GetTopInset(bool restored) const override; | 34 int GetTopInset(bool restored) const override; |
32 int GetThemeBackgroundXInset() const override; | 35 int GetThemeBackgroundXInset() const override; |
33 void UpdateThrobber(bool running) override; | 36 void UpdateThrobber(bool running) override; |
34 gfx::Size GetMinimumSize() const override; | 37 gfx::Size GetMinimumSize() const override; |
35 views::View* GetProfileSwitcherView() const override; | 38 views::MenuButton* GetProfileSwitcherButton() const override; |
39 void OnBrowserViewInitViewsComplete() override; | |
36 | 40 |
37 // views::NonClientFrameView: | 41 // views::NonClientFrameView: |
38 gfx::Rect GetBoundsForClientView() const override; | 42 gfx::Rect GetBoundsForClientView() const override; |
39 gfx::Rect GetWindowBoundsForClientBounds( | 43 gfx::Rect GetWindowBoundsForClientBounds( |
40 const gfx::Rect& client_bounds) const override; | 44 const gfx::Rect& client_bounds) const override; |
41 int NonClientHitTest(const gfx::Point& point) override; | 45 int NonClientHitTest(const gfx::Point& point) override; |
42 void UpdateWindowIcon() override; | 46 void UpdateWindowIcon() override; |
43 void UpdateWindowTitle() override; | 47 void UpdateWindowTitle() override; |
44 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {} | 48 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {} |
45 void ResetWindowControls() override {} | 49 void ResetWindowControls() override {} |
(...skipping 20 matching lines...) Expand all Loading... | |
66 void Layout() override; | 70 void Layout() override; |
67 | 71 |
68 // BrowserNonClientFrameView: | 72 // BrowserNonClientFrameView: |
69 void UpdateProfileIcons() override; | 73 void UpdateProfileIcons() override; |
70 | 74 |
71 private: | 75 private: |
72 // views::NonClientFrameView: | 76 // views::NonClientFrameView: |
73 bool DoesIntersectRect(const views::View* target, | 77 bool DoesIntersectRect(const views::View* target, |
74 const gfx::Rect& rect) const override; | 78 const gfx::Rect& rect) const override; |
75 | 79 |
80 // TabStripObserver: | |
81 void TabStripMaxXChanged(TabStrip* tab_strip) override; | |
82 void TabStripDeleted(TabStrip* tab_strip) override; | |
83 void TabStripRemovedTabAt(TabStrip* tab_strip, int index) override; | |
84 | |
76 // Returns the thickness of the border around the client area (web content, | 85 // Returns the thickness of the border around the client area (web content, |
77 // toolbar, and tabs) that separates it from the frame border. If |restored| | 86 // toolbar, and tabs) that separates it from the frame border. If |restored| |
78 // is true, this is calculated as if the window was restored, regardless of | 87 // is true, this is calculated as if the window was restored, regardless of |
79 // its current state. | 88 // its current state. |
80 int ClientBorderThickness(bool restored) const; | 89 int ClientBorderThickness(bool restored) const; |
81 | 90 |
82 // Returns the thickness of the window border for the left, right, and bottom | 91 // Returns the thickness of the window border for the left, right, and bottom |
83 // edges of the frame. On Windows 10 this is a mostly-transparent handle that | 92 // edges of the frame. On Windows 10 this is a mostly-transparent handle that |
84 // allows you to resize the window. | 93 // allows you to resize the window. |
85 int FrameBorderThickness() const; | 94 int FrameBorderThickness() const; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 Windows10CaptionButton* maximize_button_; | 191 Windows10CaptionButton* maximize_button_; |
183 Windows10CaptionButton* restore_button_; | 192 Windows10CaptionButton* restore_button_; |
184 Windows10CaptionButton* close_button_; | 193 Windows10CaptionButton* close_button_; |
185 | 194 |
186 // Whether or not the window throbber is currently animating. | 195 // Whether or not the window throbber is currently animating. |
187 bool throbber_running_; | 196 bool throbber_running_; |
188 | 197 |
189 // The index of the current frame of the throbber animation. | 198 // The index of the current frame of the throbber animation. |
190 int throbber_frame_; | 199 int throbber_frame_; |
191 | 200 |
201 // TabStrip, which we need to watch for changes to resize the avatar button | |
msarda
2017/04/21 09:43:28
It is not clear what "we" means in this context:
*
emx
2017/04/24 16:23:10
Done.
| |
202 TabStrip* tab_strip_; | |
203 | |
192 static const int kThrobberIconCount = 24; | 204 static const int kThrobberIconCount = 24; |
193 static HICON throbber_icons_[kThrobberIconCount]; | 205 static HICON throbber_icons_[kThrobberIconCount]; |
194 static void InitThrobberIcons(); | 206 static void InitThrobberIcons(); |
195 | 207 |
196 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 208 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
197 }; | 209 }; |
198 | 210 |
199 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 211 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |