summaryrefslogtreecommitdiffstats
path: root/components/mus/ws/server_window_observer.h
blob: 8c2e628257f59b9258f6ad1b91aebd966650dfaf (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright 2015 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 COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_
#define COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_

#include <stdint.h>

#include <vector>

#include "components/mus/public/interfaces/mus_constants.mojom.h"

namespace gfx {
class Insets;
class Rect;
}

namespace ui {
struct TextInputState;
}

namespace mus {

namespace ws {

class ServerWindow;

// TODO(sky): rename to OnDid and OnWill everywhere.
class ServerWindowObserver {
 public:
  // Invoked when a window is about to be destroyed; before any of the children
  // have been removed and before the window has been removed from its parent.
  virtual void OnWindowDestroying(ServerWindow* window) {}

  // Invoked at the end of the window's destructor (after it has been removed
  // from the hierarchy.
  virtual void OnWindowDestroyed(ServerWindow* window) {}

  virtual void OnWillChangeWindowHierarchy(ServerWindow* window,
                                           ServerWindow* new_parent,
                                           ServerWindow* old_parent) {}

  virtual void OnWindowHierarchyChanged(ServerWindow* window,
                                        ServerWindow* new_parent,
                                        ServerWindow* old_parent) {}

  virtual void OnWindowBoundsChanged(ServerWindow* window,
                                     const gfx::Rect& old_bounds,
                                     const gfx::Rect& new_bounds) {}

  virtual void OnWindowClientAreaChanged(
      ServerWindow* window,
      const gfx::Insets& new_client_area,
      const std::vector<gfx::Rect>& new_additional_client_areas) {}

  virtual void OnWindowReordered(ServerWindow* window,
                                 ServerWindow* relative,
                                 mojom::OrderDirection direction) {}

  virtual void OnWillChangeWindowVisibility(ServerWindow* window) {}
  virtual void OnWindowVisibilityChanged(ServerWindow* window) {}

  virtual void OnWindowPredefinedCursorChanged(ServerWindow* window,
                                               int32_t cursor_id) {}

  virtual void OnWindowTextInputStateChanged(ServerWindow* window,
                                             const ui::TextInputState& state) {}

  virtual void OnWindowSharedPropertyChanged(
      ServerWindow* window,
      const std::string& name,
      const std::vector<uint8_t>* new_data) {}

  // Called when a transient child is added to |window|.
  virtual void OnTransientWindowAdded(ServerWindow* window,
                                      ServerWindow* transient_child) {}

  // Called when a transient child is removed from |window|.
  virtual void OnTransientWindowRemoved(ServerWindow* window,
                                        ServerWindow* transient_child) {}

 protected:
  virtual ~ServerWindowObserver() {}
};

}  // namespace ws

}  // namespace mus

#endif  // COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_