| 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/scoped_observer.h" |
| 10 #include "base/win/scoped_gdi_object.h" | 11 #include "base/win/scoped_gdi_object.h" |
| 11 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" | 12 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 13 #include "chrome/browser/ui/views/frame/windows_10_caption_button.h" | 14 #include "chrome/browser/ui/views/frame/windows_10_caption_button.h" |
| 14 #include "chrome/browser/ui/views/tab_icon_view.h" | 15 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 15 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 16 #include "chrome/browser/ui/views/tab_icon_view_model.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; |
| 22 class TabStrip; |
| 20 | 23 |
| 21 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 24 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
| 22 public views::ButtonListener, | 25 public views::ButtonListener, |
| 23 public TabIconViewModel { | 26 public TabIconViewModel, |
| 27 public TabStripObserver { |
| 24 public: | 28 public: |
| 25 // Constructs a non-client view for an BrowserFrame. | 29 // Constructs a non-client view for an BrowserFrame. |
| 26 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 30 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 27 ~GlassBrowserFrameView() override; | 31 ~GlassBrowserFrameView() override; |
| 28 | 32 |
| 29 // BrowserNonClientFrameView: | 33 // BrowserNonClientFrameView: |
| 30 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; | 34 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; |
| 31 int GetTopInset(bool restored) const override; | 35 int GetTopInset(bool restored) const override; |
| 32 int GetThemeBackgroundXInset() const override; | 36 int GetThemeBackgroundXInset() const override; |
| 33 void UpdateThrobber(bool running) override; | 37 void UpdateThrobber(bool running) override; |
| 34 gfx::Size GetMinimumSize() const override; | 38 gfx::Size GetMinimumSize() const override; |
| 35 views::View* GetProfileSwitcherView() const override; | 39 views::View* GetProfileSwitcherView() const override; |
| 40 void OnBrowserViewInitViewsComplete() override; |
| 36 | 41 |
| 37 // views::NonClientFrameView: | 42 // views::NonClientFrameView: |
| 38 gfx::Rect GetBoundsForClientView() const override; | 43 gfx::Rect GetBoundsForClientView() const override; |
| 39 gfx::Rect GetWindowBoundsForClientBounds( | 44 gfx::Rect GetWindowBoundsForClientBounds( |
| 40 const gfx::Rect& client_bounds) const override; | 45 const gfx::Rect& client_bounds) const override; |
| 41 int NonClientHitTest(const gfx::Point& point) override; | 46 int NonClientHitTest(const gfx::Point& point) override; |
| 42 void UpdateWindowIcon() override; | 47 void UpdateWindowIcon() override; |
| 43 void UpdateWindowTitle() override; | 48 void UpdateWindowTitle() override; |
| 44 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {} | 49 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {} |
| 45 void ResetWindowControls() override {} | 50 void ResetWindowControls() override {} |
| 46 void SizeConstraintsChanged() override {} | 51 void SizeConstraintsChanged() override {} |
| 47 | 52 |
| 48 // views::ButtonListener: | 53 // views::ButtonListener: |
| 49 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 54 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 50 | 55 |
| 51 // TabIconViewModel: | 56 // TabIconViewModel: |
| 52 bool ShouldTabIconViewAnimate() const override; | 57 bool ShouldTabIconViewAnimate() const override; |
| 53 gfx::ImageSkia GetFaviconForTabIconView() override; | 58 gfx::ImageSkia GetFaviconForTabIconView() override; |
| 54 | 59 |
| 60 // TabStripObserver: |
| 61 void TabStripMaxXChanged(TabStrip* tab_strip) override; |
| 62 void TabStripDeleted(TabStrip* tab_strip) override; |
| 63 void TabStripRemovedTabAt(TabStrip* tab_strip, int index) override; |
| 64 |
| 55 bool IsMaximized() const; | 65 bool IsMaximized() const; |
| 56 | 66 |
| 57 // Visual height of the titlebar when the window is maximized (i.e. excluding | 67 // Visual height of the titlebar when the window is maximized (i.e. excluding |
| 58 // the area above the top of the screen). | 68 // the area above the top of the screen). |
| 59 int TitlebarMaximizedVisualHeight() const; | 69 int TitlebarMaximizedVisualHeight() const; |
| 60 | 70 |
| 61 SkColor GetTitlebarColor() const; | 71 SkColor GetTitlebarColor() const; |
| 62 | 72 |
| 63 protected: | 73 protected: |
| 64 // views::View: | 74 // views::View: |
| 65 void OnPaint(gfx::Canvas* canvas) override; | 75 void OnPaint(gfx::Canvas* canvas) override; |
| 66 void Layout() override; | 76 void Layout() override; |
| 77 void ChildPreferredSizeChanged(views::View* child) override; |
| 67 | 78 |
| 68 // BrowserNonClientFrameView: | 79 // BrowserNonClientFrameView: |
| 69 void UpdateProfileIcons() override; | 80 void UpdateProfileIcons() override; |
| 70 | 81 |
| 71 private: | 82 private: |
| 72 // views::NonClientFrameView: | 83 // views::NonClientFrameView: |
| 73 bool DoesIntersectRect(const views::View* target, | 84 bool DoesIntersectRect(const views::View* target, |
| 74 const gfx::Rect& rect) const override; | 85 const gfx::Rect& rect) const override; |
| 75 | 86 |
| 76 // Returns the thickness of the border around the client area (web content, | 87 // Returns the thickness of the border around the client area (web content, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 Windows10CaptionButton* maximize_button_; | 193 Windows10CaptionButton* maximize_button_; |
| 183 Windows10CaptionButton* restore_button_; | 194 Windows10CaptionButton* restore_button_; |
| 184 Windows10CaptionButton* close_button_; | 195 Windows10CaptionButton* close_button_; |
| 185 | 196 |
| 186 // Whether or not the window throbber is currently animating. | 197 // Whether or not the window throbber is currently animating. |
| 187 bool throbber_running_; | 198 bool throbber_running_; |
| 188 | 199 |
| 189 // The index of the current frame of the throbber animation. | 200 // The index of the current frame of the throbber animation. |
| 190 int throbber_frame_; | 201 int throbber_frame_; |
| 191 | 202 |
| 203 // The window's tabstrip, if any, is observed so we know when to resize any |
| 204 // avatar button. |
| 205 ScopedObserver<TabStrip, GlassBrowserFrameView> tab_strip_observer_; |
| 206 |
| 192 static const int kThrobberIconCount = 24; | 207 static const int kThrobberIconCount = 24; |
| 193 static HICON throbber_icons_[kThrobberIconCount]; | 208 static HICON throbber_icons_[kThrobberIconCount]; |
| 194 static void InitThrobberIcons(); | 209 static void InitThrobberIcons(); |
| 195 | 210 |
| 196 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 211 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 197 }; | 212 }; |
| 198 | 213 |
| 199 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 214 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |