- add sources.
[platform/framework/web/crosswalk.git] / src / ash / wm / frame_border_hit_test_controller.h
1 // Copyright 2013 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_FRAME_BORDER_HITTEST_CONTROLLER_H_
6 #define ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_
7
8 #include "ash/ash_export.h"
9 #include "ash/wm/window_state_observer.h"
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "ui/aura/window_observer.h"
13
14 namespace gfx {
15 class Point;
16 }
17
18 namespace views {
19 class NonClientFrameView;
20 class Widget;
21 }
22
23 namespace ash {
24 class HeaderPainter;
25
26 // Class which manages the hittest override bounds for |frame|. The override
27 // bounds are used to ensure that the resize cursors are shown when the user
28 // hovers over |frame|'s edges.
29 class ASH_EXPORT FrameBorderHitTestController : public wm::WindowStateObserver,
30                                                 public aura::WindowObserver {
31  public:
32   explicit FrameBorderHitTestController(views::Widget* frame);
33   virtual ~FrameBorderHitTestController();
34
35   // Does the non client hit test on behalf of |view|. |point| must be in the
36   // coordinates of |view|'s widget.
37   static int NonClientHitTest(views::NonClientFrameView* view,
38                               HeaderPainter* header_painter,
39                               const gfx::Point& point);
40
41  private:
42   // Updates the size of the region inside of |window_| in which the resize
43   // handles are shown based on |window_|'s show type.
44   void UpdateHitTestBoundsOverrideInner();
45
46   // WindowStateObserver override:
47   virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
48                                        wm::WindowShowType old_type) OVERRIDE;
49   // WindowObserver override:
50   virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
51
52   // The window whose hittest override bounds are being managed.
53   aura::Window* frame_window_;
54
55   DISALLOW_COPY_AND_ASSIGN(FrameBorderHitTestController);
56 };
57
58 }  // namespace ash
59
60 #endif  // ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_