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.
5 #ifndef ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_
6 #define ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_
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"
19 class NonClientFrameView;
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 {
32 explicit FrameBorderHitTestController(views::Widget* frame);
33 virtual ~FrameBorderHitTestController();
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);
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();
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;
52 // The window whose hittest override bounds are being managed.
53 aura::Window* frame_window_;
55 DISALLOW_COPY_AND_ASSIGN(FrameBorderHitTestController);
60 #endif // ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_