summaryrefslogtreecommitdiffstats
path: root/chromium/ash/wm/frame_border_hit_test_controller.h
blob: 21fe9cf0305ee99120f356465941f73a5571e0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_
#define ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_

#include "ash/ash_export.h"
#include "ash/wm/window_state_observer.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/window_observer.h"

namespace gfx {
class Point;
}

namespace views {
class NonClientFrameView;
class Widget;
}

namespace ash {
class HeaderPainter;

// Class which manages the hittest override bounds for |frame|. The override
// bounds are used to ensure that the resize cursors are shown when the user
// hovers over |frame|'s edges.
class ASH_EXPORT FrameBorderHitTestController : public wm::WindowStateObserver,
                                                public aura::WindowObserver {
 public:
  explicit FrameBorderHitTestController(views::Widget* frame);
  virtual ~FrameBorderHitTestController();

  // Does the non client hit test on behalf of |view|. |point| must be in the
  // coordinates of |view|'s widget.
  static int NonClientHitTest(views::NonClientFrameView* view,
                              HeaderPainter* header_painter,
                              const gfx::Point& point);

 private:
  // Updates the size of the region inside of |window_| in which the resize
  // handles are shown based on |window_|'s show type.
  void UpdateHitTestBoundsOverrideInner();

  // WindowStateObserver override:
  virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
                                       wm::WindowShowType old_type) OVERRIDE;
  // WindowObserver override:
  virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;

  // The window whose hittest override bounds are being managed.
  aura::Window* frame_window_;

  DISALLOW_COPY_AND_ASSIGN(FrameBorderHitTestController);
};

}  // namespace ash

#endif  // ASH_WM_FRAME_BORDER_HITTEST_CONTROLLER_H_