summaryrefslogtreecommitdiffstats
path: root/aura/window_manager.h
blob: 0ed18cd19c1738dcaa538df41574d733f2442853 (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
// Copyright (c) 2011 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 AURA_WINDOW_MANAGER_H_
#define AURA_WINDOW_MANAGER_H_
#pragma once

#include "base/logging.h"
#include "ui/gfx/point.h"

namespace aura {

class Window;
class MouseEvent;

// An object that filters events sent to an owner window, potentially performing
// adjustments to the window's position, size and z-index.
//
// TODO(beng): Make this into an interface so we can have specializations for
//             different types of Window and product.
class WindowManager {
 public:
  explicit WindowManager(Window* owner);
  ~WindowManager();

  // Try to handle |event| (before the owner's delegate gets a chance to).
  // Returns true if the event was handled by the WindowManager and should not
  // be forwarded to the owner's delegate.
  bool OnMouseEvent(MouseEvent* event);

 private:
  // Moves the owner window and all of its parents to the front of their
  // respective z-orders.
  void MoveWindowToFront();

  Window* owner_;
  gfx::Point mouse_down_offset_;
  gfx::Point window_location_;
  int window_component_;

  DISALLOW_COPY_AND_ASSIGN(WindowManager);
};

}  // namespace aura

#endif  // AURA_WINDOW_MANAGER_H_