Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ash / frame / custom_frame_view_ash.h
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 "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"
12
13 namespace ash {
14 class FrameBorderHitTestController;
15 class FrameCaptionButtonContainerView;
16 class ImmersiveFullscreenController;
17 }
18 namespace views {
19 class Widget;
20 }
21
22 namespace ash {
23
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[];
34
35   explicit CustomFrameViewAsh(views::Widget* frame);
36   ~CustomFrameViewAsh() override;
37
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);
44
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);
48
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;
59
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;
67
68   // Get the view of the header.
69   views::View* GetHeaderView();
70
71   const views::View* GetAvatarIconViewForTest() const;
72
73  private:
74   class OverlayView;
75   friend class TestWidgetConstraintsDelegate;
76
77   // views::NonClientFrameView:
78   bool DoesIntersectRect(const views::View* target,
79                          const gfx::Rect& rect) const override;
80
81   // Returns the container for the minimize/maximize/close buttons that is held
82   // by the HeaderView. Used in testing.
83   FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest();
84
85   // Height from top of window to top of client area.
86   int NonClientTopBorderHeight() const;
87
88   // Not owned.
89   views::Widget* frame_;
90
91   // View which contains the title and window controls.
92   class HeaderView;
93   HeaderView* header_view_;
94
95   // Updates the hittest bounds overrides based on the window state type.
96   scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_;
97
98   DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh);
99 };
100
101 }  // namespace ash
102
103 #endif  // ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_