| 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 ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ | 5 #ifndef ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ |
| 6 #define ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ | 6 #define ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/common/shell_observer.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "ui/views/window/non_client_view.h" | 13 #include "ui/views/window/non_client_view.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 class ImageView; | 16 class ImageView; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 class DefaultHeaderPainter; | 20 class DefaultHeaderPainter; |
| 20 class FrameCaptionButtonContainerView; | 21 class FrameCaptionButtonContainerView; |
| 21 class FrameBorderHitTestController; | 22 class FrameBorderHitTestController; |
| 22 | 23 |
| 23 class ASH_EXPORT PanelFrameView : public views::NonClientFrameView { | 24 class ASH_EXPORT PanelFrameView : public views::NonClientFrameView, |
| 25 public ShellObserver { |
| 24 public: | 26 public: |
| 25 // Internal class name. | 27 // Internal class name. |
| 26 static const char kViewClassName[]; | 28 static const char kViewClassName[]; |
| 27 | 29 |
| 28 enum FrameType { FRAME_NONE, FRAME_ASH }; | 30 enum FrameType { FRAME_NONE, FRAME_ASH }; |
| 29 | 31 |
| 30 PanelFrameView(views::Widget* frame, FrameType frame_type); | 32 PanelFrameView(views::Widget* frame, FrameType frame_type); |
| 31 ~PanelFrameView() override; | 33 ~PanelFrameView() override; |
| 32 | 34 |
| 33 // Sets the active and inactive frame colors. Note the inactive frame color | 35 // Sets the active and inactive frame colors. Note the inactive frame color |
| 34 // will have some transparency added when the frame is drawn. | 36 // will have some transparency added when the frame is drawn. |
| 35 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | 37 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); |
| 36 | 38 |
| 37 // Overridden from views::View: | 39 // views::View: |
| 38 const char* GetClassName() const override; | 40 const char* GetClassName() const override; |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 void InitHeaderPainter(); | 43 void InitHeaderPainter(); |
| 42 | 44 |
| 43 // Height from top of window to top of client area. | 45 // Height from top of window to top of client area. |
| 44 int NonClientTopBorderHeight() const; | 46 int NonClientTopBorderHeight() const; |
| 45 | 47 |
| 46 // Overridden from views::NonClientFrameView: | 48 // views::NonClientFrameView: |
| 47 gfx::Rect GetBoundsForClientView() const override; | 49 gfx::Rect GetBoundsForClientView() const override; |
| 48 gfx::Rect GetWindowBoundsForClientBounds( | 50 gfx::Rect GetWindowBoundsForClientBounds( |
| 49 const gfx::Rect& client_bounds) const override; | 51 const gfx::Rect& client_bounds) const override; |
| 50 int NonClientHitTest(const gfx::Point& point) override; | 52 int NonClientHitTest(const gfx::Point& point) override; |
| 51 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | 53 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; |
| 52 void ResetWindowControls() override; | 54 void ResetWindowControls() override; |
| 53 void UpdateWindowIcon() override; | 55 void UpdateWindowIcon() override; |
| 54 void UpdateWindowTitle() override; | 56 void UpdateWindowTitle() override; |
| 55 void SizeConstraintsChanged() override; | 57 void SizeConstraintsChanged() override; |
| 56 | 58 |
| 57 // Overridden from views::View: | 59 // views::View: |
| 58 gfx::Size GetMinimumSize() const override; | 60 gfx::Size GetMinimumSize() const override; |
| 59 void Layout() override; | 61 void Layout() override; |
| 60 void OnPaint(gfx::Canvas* canvas) override; | 62 void OnPaint(gfx::Canvas* canvas) override; |
| 61 | 63 |
| 64 // ShellObserver: |
| 65 void OnOverviewModeStarting() override; |
| 66 void OnOverviewModeEnded() override; |
| 67 |
| 62 // Child View class describing the panel's title bar behavior | 68 // Child View class describing the panel's title bar behavior |
| 63 // and buttons, owned by the view hierarchy | 69 // and buttons, owned by the view hierarchy |
| 64 views::Widget* frame_; | 70 views::Widget* frame_; |
| 65 FrameCaptionButtonContainerView* caption_button_container_; | 71 FrameCaptionButtonContainerView* caption_button_container_; |
| 66 views::ImageView* window_icon_; | 72 views::ImageView* window_icon_; |
| 67 gfx::Rect client_view_bounds_; | 73 gfx::Rect client_view_bounds_; |
| 68 | 74 |
| 69 // Helper class for painting the header. | 75 // Helper class for painting the header. |
| 70 std::unique_ptr<DefaultHeaderPainter> header_painter_; | 76 std::unique_ptr<DefaultHeaderPainter> header_painter_; |
| 71 | 77 |
| 72 // Updates the hittest bounds overrides based on the window state type. | 78 // Updates the hittest bounds overrides based on the window state type. |
| 73 std::unique_ptr<FrameBorderHitTestController> | 79 std::unique_ptr<FrameBorderHitTestController> |
| 74 frame_border_hit_test_controller_; | 80 frame_border_hit_test_controller_; |
| 75 | 81 |
| 76 DISALLOW_COPY_AND_ASSIGN(PanelFrameView); | 82 DISALLOW_COPY_AND_ASSIGN(PanelFrameView); |
| 77 }; | 83 }; |
| 78 } | 84 } |
| 79 | 85 |
| 80 #endif // ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ | 86 #endif // ASH_WM_PANELS_PANEL_FRAME_VIEW_H_ |
| OLD | NEW |