| 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_CUSTOM_FRAME_VIEW_ASH_H_ | 5 #ifndef ASH_WM_CUSTOM_FRAME_VIEW_ASH_H_ |
| 6 #define ASH_WM_CUSTOM_FRAME_VIEW_ASH_H_ | 6 #define ASH_WM_CUSTOM_FRAME_VIEW_ASH_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/views/window/non_client_view.h" | 10 #include "ui/views/window/non_client_view.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 class FrameBorderHitTestController; | 13 class FrameBorderHitTestController; |
| 14 class HeaderPainter; | 14 class HeaderPainter; |
| 15 class ImmersiveFullscreenController; |
| 15 } | 16 } |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class Font; | 18 class Font; |
| 18 } | 19 } |
| 19 namespace views { | 20 namespace views { |
| 20 class Widget; | 21 class Widget; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 | 25 |
| 25 class FrameCaptionButtonContainerView; | 26 class FrameCaptionButtonContainerView; |
| 26 | 27 |
| 27 // A NonClientFrameView used for dialogs and other non-browser windows. | 28 // A NonClientFrameView used for packaged apps, dialogs and other non-browser |
| 28 // See also views::CustomFrameView and BrowserNonClientFrameViewAsh. | 29 // windows. It supports immersive fullscreen. When in immersive fullscreen, the |
| 30 // client view takes up the entire widget and the window header is an overlay. |
| 31 // The window header overlay slides onscreen when the user hovers the mouse at |
| 32 // the top of the screen. See also views::CustomFrameView and |
| 33 // BrowserNonClientFrameViewAsh. |
| 29 class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView { | 34 class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView { |
| 30 public: | 35 public: |
| 31 // Internal class name. | 36 // Internal class name. |
| 32 static const char kViewClassName[]; | 37 static const char kViewClassName[]; |
| 33 | 38 |
| 34 explicit CustomFrameViewAsh(views::Widget* frame); | 39 explicit CustomFrameViewAsh(views::Widget* frame); |
| 35 virtual ~CustomFrameViewAsh(); | 40 virtual ~CustomFrameViewAsh(); |
| 36 | 41 |
| 42 // Inits |immersive_fullscreen_controller| so that the controller reveals |
| 43 // and hides |header_view_| in immersive fullscreen. |
| 44 // CustomFrameViewAsh does not take ownership of |
| 45 // |immersive_fullscreen_controller|. |
| 46 void InitImmersiveFullscreenControllerForView( |
| 47 ImmersiveFullscreenController* immersive_fullscreen_controller); |
| 48 |
| 37 // views::NonClientFrameView overrides: | 49 // views::NonClientFrameView overrides: |
| 38 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 50 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| 39 virtual gfx::Rect GetWindowBoundsForClientBounds( | 51 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 40 const gfx::Rect& client_bounds) const OVERRIDE; | 52 const gfx::Rect& client_bounds) const OVERRIDE; |
| 41 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 53 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
| 42 virtual void GetWindowMask(const gfx::Size& size, | 54 virtual void GetWindowMask(const gfx::Size& size, |
| 43 gfx::Path* window_mask) OVERRIDE; | 55 gfx::Path* window_mask) OVERRIDE; |
| 44 virtual void ResetWindowControls() OVERRIDE; | 56 virtual void ResetWindowControls() OVERRIDE; |
| 45 virtual void UpdateWindowIcon() OVERRIDE; | 57 virtual void UpdateWindowIcon() OVERRIDE; |
| 46 virtual void UpdateWindowTitle() OVERRIDE; | 58 virtual void UpdateWindowTitle() OVERRIDE; |
| 59 virtual void ShouldPaintAsActiveChanged() OVERRIDE; |
| 47 | 60 |
| 48 // views::View overrides: | 61 // views::View overrides: |
| 49 virtual gfx::Size GetPreferredSize() OVERRIDE; | 62 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 50 virtual void Layout() OVERRIDE; | |
| 51 virtual const char* GetClassName() const OVERRIDE; | 63 virtual const char* GetClassName() const OVERRIDE; |
| 52 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 53 virtual gfx::Size GetMinimumSize() OVERRIDE; | 64 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 54 virtual gfx::Size GetMaximumSize() OVERRIDE; | 65 virtual gfx::Size GetMaximumSize() OVERRIDE; |
| 66 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 55 | 67 |
| 56 private: | 68 private: |
| 69 class OverlayView; |
| 70 |
| 57 // Height from top of window to top of client area. | 71 // Height from top of window to top of client area. |
| 58 int NonClientTopBorderHeight() const; | 72 int NonClientTopBorderHeight() const; |
| 59 | 73 |
| 60 // Not owned. | 74 // Not owned. |
| 61 views::Widget* frame_; | 75 views::Widget* frame_; |
| 62 | 76 |
| 63 // View which contains the window controls. | 77 // View which contains the title and window controls. |
| 64 FrameCaptionButtonContainerView* caption_button_container_; | 78 class HeaderView; |
| 65 | 79 HeaderView* header_view_; |
| 66 // Helper class for painting the header. | |
| 67 scoped_ptr<HeaderPainter> header_painter_; | |
| 68 | 80 |
| 69 // Updates the hittest bounds overrides based on the window show type. | 81 // Updates the hittest bounds overrides based on the window show type. |
| 70 scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_; | 82 scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_; |
| 71 | 83 |
| 72 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh); | 84 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh); |
| 73 }; | 85 }; |
| 74 | 86 |
| 75 } // namespace ash | 87 } // namespace ash |
| 76 | 88 |
| 77 #endif // ASH_WM_CUSTOM_FRAME_VIEW_ASH_H_ | 89 #endif // ASH_WM_CUSTOM_FRAME_VIEW_ASH_H_ |
| OLD | NEW |