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"
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
{
22 // Whether a notification is being sent before or after some property has
24 enum DispositionChangePhase
{
30 struct TreeChangeParams
{
36 DispositionChangePhase phase
;
39 // Called when a node is added or removed. Notifications are sent to the
40 // following hierarchies in this order:
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
) {}
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
) {}
60 virtual ~ViewObserver() {}
65 #endif // UI_V2_PUBLIC_VIEW_OBSERVER_H_