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