Chromium Code Reviews| Index: ui/views/view.h |
| diff --git a/ui/views/view.h b/ui/views/view.h |
| index bb5ebdf78cb1213e16c4dd0cd41c4ad73e510466..616938e77319e47aa59b81f9f0adac840bf81956 100644 |
| --- a/ui/views/view.h |
| +++ b/ui/views/view.h |
| @@ -74,6 +74,7 @@ class FocusTraversable; |
| class LayoutManager; |
| class NativeViewAccessibility; |
| class ScrollView; |
| +class ViewObserver; |
| class Widget; |
| class WordLookupClient; |
| @@ -1000,6 +1001,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| virtual int GetLineScrollIncrement(ScrollView* scroll_view, |
| bool is_horizontal, bool is_positive); |
| + void AddObserver(ViewObserver* observer); |
| + void RemoveObserver(ViewObserver* observer); |
| + bool HasObserver(const ViewObserver* observer) const; |
| + |
| protected: |
| // Used to track a drag. RootView passes this into |
| // ProcessMousePressed/Dragged. |
| @@ -1435,6 +1440,13 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| const gfx::Point& press_pt, |
| ui::DragDropTypes::DragEventSource source); |
| + // Called after the |child| has been added to its parent. Called on observers |
| + // listening to |child|'s parent. |
| + void NotifyChildViewAdded(View* child); |
|
sky
2016/11/22 04:40:48
You only call these functions from one place, inli
Sarmad Hashmi
2016/11/22 04:47:00
Moved the implementations to where they were calle
|
| + // Called after the |child| has been removed from its |parent|. Called on |
| + // observers listening to |parent|. |
| + void NotifyChildViewRemoved(View* child); |
| + |
| ////////////////////////////////////////////////////////////////////////////// |
| // Creation and lifetime ----------------------------------------------------- |
| @@ -1575,6 +1587,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
| NativeViewAccessibility* native_view_accessibility_; |
| + // Observers ------------------------------------------------------------- |
| + |
| + base::ObserverList<ViewObserver> observers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(View); |
| }; |