Add a FrameHostMsg_BeginNavigation IPC
[chromium-blink-merge.git] / ui / v2 / public / view_observer.h
blob519a6bac086530797d5a7ec974b93d70b4b4a8a6
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_V2_PUBLIC_VIEW_OBSERVER_H_
6 #define UI_V2_PUBLIC_VIEW_OBSERVER_H_
8 #include "ui/v2/public/v2_export.h"
10 namespace gfx {
11 class Rect;
14 namespace v2 {
16 class View;
18 // Observe View disposition changes. -ing methods are called before the change
19 // is committed, -ed methods are called after.
20 class V2_EXPORT ViewObserver {
21 public:
22 // Whether a notification is being sent before or after some property has
23 // changed.
24 enum DispositionChangePhase {
25 DISPOSITION_CHANGING,
26 DISPOSITION_CHANGED
29 // Tree.
30 struct TreeChangeParams {
31 TreeChangeParams();
32 View* target;
33 View* old_parent;
34 View* new_parent;
35 View* receiver;
36 DispositionChangePhase phase;
39 // Called when a node is added or removed. Notifications are sent to the
40 // following hierarchies in this order:
41 // 1. |target|.
42 // 2. |target|'s child hierarchy.
43 // 3. |target|'s parent hierarchy in its |old_parent|
44 // (only for Changing notifications).
45 // 3. |target|'s parent hierarchy in its |new_parent|.
46 // (only for Changed notifications).
47 // This sequence is performed via the OnTreeChange notification below before
48 // and after the change is committed.
49 virtual void OnViewTreeChange(const TreeChangeParams& params) {}
51 // Disposition.
52 virtual void OnViewDestroy(View* view, DispositionChangePhase phase) {}
53 virtual void OnViewBoundsChanged(View* view,
54 const gfx::Rect& old_bounds,
55 const gfx::Rect& new_bounds) {}
56 virtual void OnViewVisibilityChange(View* view,
57 DispositionChangePhase phase) {}
59 protected:
60 virtual ~ViewObserver() {}
63 } // namespace v2
65 #endif // UI_V2_PUBLIC_VIEW_OBSERVER_H_