summaryrefslogtreecommitdiffstats
path: root/ash/wm/panels/attached_panel_window_targeter.h
blob: d5e8196474872e867558e976eb581c9431910c37 (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
// Copyright 2014 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_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_
#define ASH_WM_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_

#include "ash/shell_observer.h"
#include "ui/wm/core/easy_resize_window_targeter.h"

namespace ash {

class PanelLayoutManager;

// A window targeter installed on a panel container to disallow touch
// hit-testing of attached panel edges that are adjacent to the shelf. This
// makes it significantly easier to correctly target shelf buttons with touch.
class AttachedPanelWindowTargeter : public ::wm::EasyResizeWindowTargeter,
                                    public ShellObserver {
 public:
  AttachedPanelWindowTargeter(aura::Window* container,
                              const gfx::Insets& default_mouse_extend,
                              const gfx::Insets& default_touch_extend,
                              PanelLayoutManager* panel_layout_manager);
  virtual ~AttachedPanelWindowTargeter();

  // ShellObserver:
  virtual void OnShelfCreatedForRootWindow(aura::Window* root_window) OVERRIDE;
  virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE;

 private:
  void UpdateTouchExtend(aura::Window* root_window);

  aura::Window* panel_container_;
  PanelLayoutManager* panel_layout_manager_;
  gfx::Insets default_touch_extend_;

  DISALLOW_COPY_AND_ASSIGN(AttachedPanelWindowTargeter);
};

}  // namespace ash

#endif  // ASH_WM_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_