| OLD | NEW |
| (Empty) |
| 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_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
| 6 #define ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "ash/ash_export.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "third_party/skia/include/core/SkColor.h" | |
| 13 #include "ui/views/window/non_client_view.h" | |
| 14 | |
| 15 namespace ash { | |
| 16 class FrameBorderHitTestController; | |
| 17 class FrameCaptionButtonContainerView; | |
| 18 class ImmersiveFullscreenController; | |
| 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 ~CustomFrameViewAsh() override; | |
| 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 // Sets the active and inactive frame colors. Note the inactive frame color | |
| 48 // will have some transparency added when the frame is drawn. | |
| 49 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | |
| 50 | |
| 51 // views::NonClientFrameView: | |
| 52 gfx::Rect GetBoundsForClientView() const override; | |
| 53 gfx::Rect GetWindowBoundsForClientBounds( | |
| 54 const gfx::Rect& client_bounds) const override; | |
| 55 int NonClientHitTest(const gfx::Point& point) override; | |
| 56 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | |
| 57 void ResetWindowControls() override; | |
| 58 void UpdateWindowIcon() override; | |
| 59 void UpdateWindowTitle() override; | |
| 60 void SizeConstraintsChanged() override; | |
| 61 | |
| 62 // views::View: | |
| 63 gfx::Size GetPreferredSize() const override; | |
| 64 void Layout() override; | |
| 65 const char* GetClassName() const override; | |
| 66 gfx::Size GetMinimumSize() const override; | |
| 67 gfx::Size GetMaximumSize() const override; | |
| 68 void SchedulePaintInRect(const gfx::Rect& r) override; | |
| 69 void VisibilityChanged(views::View* starting_from, bool is_visible) override; | |
| 70 | |
| 71 // Get the view of the header. | |
| 72 views::View* GetHeaderView(); | |
| 73 | |
| 74 const views::View* GetAvatarIconViewForTest() const; | |
| 75 | |
| 76 private: | |
| 77 class OverlayView; | |
| 78 friend class TestWidgetConstraintsDelegate; | |
| 79 | |
| 80 // views::NonClientFrameView: | |
| 81 bool DoesIntersectRect(const views::View* target, | |
| 82 const gfx::Rect& rect) const override; | |
| 83 | |
| 84 // Returns the container for the minimize/maximize/close buttons that is held | |
| 85 // by the HeaderView. Used in testing. | |
| 86 FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest(); | |
| 87 | |
| 88 // Height from top of window to top of client area. | |
| 89 int NonClientTopBorderHeight() const; | |
| 90 | |
| 91 // Not owned. | |
| 92 views::Widget* frame_; | |
| 93 | |
| 94 // View which contains the title and window controls. | |
| 95 class HeaderView; | |
| 96 HeaderView* header_view_; | |
| 97 | |
| 98 // Updates the hittest bounds overrides based on the window state type. | |
| 99 std::unique_ptr<FrameBorderHitTestController> | |
| 100 frame_border_hit_test_controller_; | |
| 101 | |
| 102 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh); | |
| 103 }; | |
| 104 | |
| 105 } // namespace ash | |
| 106 | |
| 107 #endif // ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
| OLD | NEW |