| 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; | |
| 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 {} |
| 46 void SizeConstraintsChanged() override {} | 50 void SizeConstraintsChanged() override {} |
| 47 | 51 |
| 48 // views::ButtonListener: | 52 // views::ButtonListener: |
| 49 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 53 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 50 | 54 |
| 51 // TabIconViewModel: | 55 // TabIconViewModel: |
| 52 bool ShouldTabIconViewAnimate() const override; | 56 bool ShouldTabIconViewAnimate() const override; |
| 53 gfx::ImageSkia GetFaviconForTabIconView() override; | 57 gfx::ImageSkia GetFaviconForTabIconView() override; |
| 54 | 58 |
| 59 // TabStripObserver: |
| 60 void TabStripMaxXChanged(TabStrip* tab_strip) override; |
| 61 void TabStripDeleted(TabStrip* tab_strip) override; |
| 62 void TabStripRemovedTabAt(TabStrip* tab_strip, int index) override; |
| 63 |
| 55 bool IsMaximized() const; | 64 bool IsMaximized() const; |
| 56 | 65 |
| 57 // Visual height of the titlebar when the window is maximized (i.e. excluding | 66 // Visual height of the titlebar when the window is maximized (i.e. excluding |
| 58 // the area above the top of the screen). | 67 // the area above the top of the screen). |
| 59 int TitlebarMaximizedVisualHeight() const; | 68 int TitlebarMaximizedVisualHeight() const; |
| 60 | 69 |
| 61 SkColor GetTitlebarColor() const; | 70 SkColor GetTitlebarColor() const; |
| 62 | 71 |
| 63 protected: | 72 protected: |
| 64 // views::View: | 73 // views::View: |
| 65 void OnPaint(gfx::Canvas* canvas) override; | 74 void OnPaint(gfx::Canvas* canvas) override; |
| 66 void Layout() override; | 75 void Layout() override; |
| 76 void ChildPreferredSizeChanged(views::View* child) override; |
| 67 | 77 |
| 68 // BrowserNonClientFrameView: | 78 // BrowserNonClientFrameView: |
| 69 void UpdateProfileIcons() override; | 79 void UpdateProfileIcons() override; |
| 70 | 80 |
| 71 private: | 81 private: |
| 72 // views::NonClientFrameView: | 82 // views::NonClientFrameView: |
| 73 bool DoesIntersectRect(const views::View* target, | 83 bool DoesIntersectRect(const views::View* target, |
| 74 const gfx::Rect& rect) const override; | 84 const gfx::Rect& rect) const override; |
| 75 | 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, |
| (...skipping 105 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 // The window's tabstrip, if any, is observed so we know when to resize any |
| 203 // avatar button. |
| 204 ScopedObserver<TabStrip, GlassBrowserFrameView> tab_strip_observer_; |
| 205 |
| 192 static const int kThrobberIconCount = 24; | 206 static const int kThrobberIconCount = 24; |
| 193 static HICON throbber_icons_[kThrobberIconCount]; | 207 static HICON throbber_icons_[kThrobberIconCount]; |
| 194 static void InitThrobberIcons(); | 208 static void InitThrobberIcons(); |
| 195 | 209 |
| 196 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 210 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 197 }; | 211 }; |
| 198 | 212 |
| 199 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 213 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |