summaryrefslogtreecommitdiffstats
path: root/components/mus/server_view_observer.h
blob: 51c14fa8560be656d38c12cde61f28267658a730 (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
// 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_SERVER_VIEW_OBSERVER_H_
#define COMPONENTS_MUS_SERVER_VIEW_OBSERVER_H_

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

namespace gfx {
class Rect;
}

namespace mojo {
class ViewportMetrics;
}

namespace ui {
struct TextInputState;
}

namespace view_manager {

class ServerView;

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

  // Invoked at the end of the View's destructor (after it has been removed from
  // the hierarchy).
  virtual void OnViewDestroyed(ServerView* view) {}

  virtual void OnWillChangeViewHierarchy(ServerView* view,
                                         ServerView* new_parent,
                                         ServerView* old_parent) {}

  virtual void OnViewHierarchyChanged(ServerView* view,
                                      ServerView* new_parent,
                                      ServerView* old_parent) {}

  virtual void OnViewBoundsChanged(ServerView* view,
                                   const gfx::Rect& old_bounds,
                                   const gfx::Rect& new_bounds) {}

  virtual void OnViewReordered(ServerView* view,
                               ServerView* relative,
                               mojo::OrderDirection direction) {}

  virtual void OnWillChangeViewVisibility(ServerView* view) {}
  virtual void OnViewVisibilityChanged(ServerView* view) {}

  virtual void OnViewTextInputStateChanged(ServerView* view,
                                           const ui::TextInputState& state) {}

  virtual void OnViewSharedPropertyChanged(
      ServerView* view,
      const std::string& name,
      const std::vector<uint8_t>* new_data) {}

 protected:
  virtual ~ServerViewObserver() {}
};

}  // namespace view_manager

#endif  // COMPONENTS_MUS_SERVER_VIEW_OBSERVER_H_