Chromium Code Reviews| Index: ui/views/view_observer.h |
| diff --git a/ui/views/view_observer.h b/ui/views/view_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..59bb921d8920bb38987a99ef7c94b69a2abffa44 |
| --- /dev/null |
| +++ b/ui/views/view_observer.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2016 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 UI_VIEWS_VIEW_OBSERVER_H_ |
| +#define UI_VIEWS_VIEW_OBSERVER_H_ |
| + |
| +#include "ui/views/view.h" |
| + |
| +namespace gfx { |
| +class Rect; |
| +} |
| + |
| +namespace views { |
| + |
| +// Observer can listen to various events on the Views. |
| +class VIEWS_EXPORT ViewObserver { |
| + public: |
| + // Called whenever target |view| is being moved. If |old_parent| is NULL, |
|
sky
2016/11/21 16:33:37
NULL -> null for all cases.
Sarmad Hashmi
2016/11/21 17:09:53
Done.
|
| + // the target is being added. If the |new_parent| is NULL, then the target |
| + // is being removed. |
| + virtual void OnViewParentChanged(View* target, |
| + View* old_parent, |
| + View* new_parent) {} |
| + |
| + // Called when the visibile property is changed (the |view| may still be |
|
sky
2016/11/21 16:33:37
How about: Called when View::SetEnabled() is calle
Sarmad Hashmi
2016/11/21 17:09:53
Done.
|
| + // hidden at this point) |
| + virtual void OnViewVisibilityChanged(View* view) {} |
| + |
| + virtual void OnViewEnabledChanged(View* view) {} |
| + |
| + virtual void OnViewBoundsChanged(View* view) {} |
| + |
| + // Invoked whenever a child is moved to another index. This is called on the |
| + // parent view. |view| is the child view being reordered to the index. |
| + virtual void OnChildViewReordered(View* view, int index) {} |
| + |
| + protected: |
| + virtual ~ViewObserver() {} |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_VIEW_OBSERVER_H_ |