Mac: Add rails for scrolling.
[chromium-blink-merge.git] / ash / frame / custom_frame_view_ash.h
blobde63451c732dffd5086281d4ed134d1f2845634b
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.
5 #ifndef ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_
6 #define ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_
8 #include "ash/ash_export.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/views/window/non_client_view.h"
13 namespace ash {
14 class FrameBorderHitTestController;
15 class FrameCaptionButtonContainerView;
16 class ImmersiveFullscreenController;
18 namespace views {
19 class Widget;
22 namespace ash {
24 // A NonClientFrameView used for packaged apps, dialogs and other non-browser
25 // windows. It supports immersive fullscreen. When in immersive fullscreen, the
26 // client view takes up the entire widget and the window header is an overlay.
27 // The window header overlay slides onscreen when the user hovers the mouse at
28 // the top of the screen. See also views::CustomFrameView and
29 // BrowserNonClientFrameViewAsh.
30 class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView {
31 public:
32 // Internal class name.
33 static const char kViewClassName[];
35 explicit CustomFrameViewAsh(views::Widget* frame);
36 ~CustomFrameViewAsh() override;
38 // Inits |immersive_fullscreen_controller| so that the controller reveals
39 // and hides |header_view_| in immersive fullscreen.
40 // CustomFrameViewAsh does not take ownership of
41 // |immersive_fullscreen_controller|.
42 void InitImmersiveFullscreenControllerForView(
43 ImmersiveFullscreenController* immersive_fullscreen_controller);
45 // Sets the active and inactive frame colors. Note the inactive frame color
46 // will have some transparency added when the frame is drawn.
47 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
49 // views::NonClientFrameView:
50 gfx::Rect GetBoundsForClientView() const override;
51 gfx::Rect GetWindowBoundsForClientBounds(
52 const gfx::Rect& client_bounds) const override;
53 int NonClientHitTest(const gfx::Point& point) override;
54 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
55 void ResetWindowControls() override;
56 void UpdateWindowIcon() override;
57 void UpdateWindowTitle() override;
58 void SizeConstraintsChanged() override;
60 // views::View:
61 gfx::Size GetPreferredSize() const override;
62 const char* GetClassName() const override;
63 gfx::Size GetMinimumSize() const override;
64 gfx::Size GetMaximumSize() const override;
65 void SchedulePaintInRect(const gfx::Rect& r) override;
66 void VisibilityChanged(views::View* starting_from, bool is_visible) override;
68 // Get the view of the header.
69 views::View* GetHeaderView();
71 const views::View* GetAvatarIconViewForTest() const;
73 private:
74 class OverlayView;
75 friend class TestWidgetConstraintsDelegate;
77 // views::NonClientFrameView:
78 bool DoesIntersectRect(const views::View* target,
79 const gfx::Rect& rect) const override;
81 // Returns the container for the minimize/maximize/close buttons that is held
82 // by the HeaderView. Used in testing.
83 FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest();
85 // Height from top of window to top of client area.
86 int NonClientTopBorderHeight() const;
88 // Not owned.
89 views::Widget* frame_;
91 // View which contains the title and window controls.
92 class HeaderView;
93 HeaderView* header_view_;
95 // Updates the hittest bounds overrides based on the window state type.
96 scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_;
98 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh);
101 } // namespace ash
103 #endif // ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_