Chromium Code Reviews| 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::View* GetProfileSwitcherView() 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 11 matching lines...) Expand all Loading... | |
| 57 // Visual height of the titlebar when the window is maximized (i.e. excluding | 61 // Visual height of the titlebar when the window is maximized (i.e. excluding |
| 58 // the area above the top of the screen). | 62 // the area above the top of the screen). |
| 59 int TitlebarMaximizedVisualHeight() const; | 63 int TitlebarMaximizedVisualHeight() const; |
| 60 | 64 |
| 61 SkColor GetTitlebarColor() const; | 65 SkColor GetTitlebarColor() const; |
| 62 | 66 |
| 63 protected: | 67 protected: |
| 64 // views::View: | 68 // views::View: |
| 65 void OnPaint(gfx::Canvas* canvas) override; | 69 void OnPaint(gfx::Canvas* canvas) override; |
| 66 void Layout() override; | 70 void Layout() override; |
| 71 void ChildPreferredSizeChanged(views::View* child) override; | |
| 67 | 72 |
| 68 // BrowserNonClientFrameView: | 73 // BrowserNonClientFrameView: |
| 69 void UpdateProfileIcons() override; | 74 void UpdateProfileIcons() override; |
| 70 | 75 |
| 71 private: | 76 private: |
| 72 // views::NonClientFrameView: | 77 // views::NonClientFrameView: |
| 73 bool DoesIntersectRect(const views::View* target, | 78 bool DoesIntersectRect(const views::View* target, |
| 74 const gfx::Rect& rect) const override; | 79 const gfx::Rect& rect) const override; |
| 75 | 80 |
| 81 // TabStripObserver: | |
|
Peter Kasting
2017/05/06 02:23:08
Per recent discussion on chromium-dev, overrides s
emx
2017/05/09 16:26:52
Done.
| |
| 82 void TabStripMaxXChanged(TabStrip* tab_strip) override; | |
| 83 void TabStripDeleted(TabStrip* tab_strip) override; | |
| 84 void TabStripRemovedTabAt(TabStrip* tab_strip, int index) override; | |
| 85 | |
| 76 // Returns the thickness of the border around the client area (web content, | 86 // 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| | 87 // 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 | 88 // is true, this is calculated as if the window was restored, regardless of |
| 79 // its current state. | 89 // its current state. |
| 80 int ClientBorderThickness(bool restored) const; | 90 int ClientBorderThickness(bool restored) const; |
| 81 | 91 |
| 82 // Returns the thickness of the window border for the left, right, and bottom | 92 // 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 | 93 // edges of the frame. On Windows 10 this is a mostly-transparent handle that |
| 84 // allows you to resize the window. | 94 // allows you to resize the window. |
| 85 int FrameBorderThickness() const; | 95 int FrameBorderThickness() const; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 Windows10CaptionButton* maximize_button_; | 192 Windows10CaptionButton* maximize_button_; |
| 183 Windows10CaptionButton* restore_button_; | 193 Windows10CaptionButton* restore_button_; |
| 184 Windows10CaptionButton* close_button_; | 194 Windows10CaptionButton* close_button_; |
| 185 | 195 |
| 186 // Whether or not the window throbber is currently animating. | 196 // Whether or not the window throbber is currently animating. |
| 187 bool throbber_running_; | 197 bool throbber_running_; |
| 188 | 198 |
| 189 // The index of the current frame of the throbber animation. | 199 // The index of the current frame of the throbber animation. |
| 190 int throbber_frame_; | 200 int throbber_frame_; |
| 191 | 201 |
| 202 // Tab strip to watch for changes to resize the avatar button. | |
|
Peter Kasting
2017/05/06 02:23:08
Nit: "The window's tabstrip, if any. Observed so
emx
2017/05/09 16:26:51
Done.
| |
| 203 TabStrip* tab_strip_; | |
| 204 | |
| 192 static const int kThrobberIconCount = 24; | 205 static const int kThrobberIconCount = 24; |
| 193 static HICON throbber_icons_[kThrobberIconCount]; | 206 static HICON throbber_icons_[kThrobberIconCount]; |
| 194 static void InitThrobberIcons(); | 207 static void InitThrobberIcons(); |
| 195 | 208 |
| 196 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 209 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 197 }; | 210 }; |
| 198 | 211 |
| 199 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 212 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |