| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_VIEW_OBSERVER_H_ | 5 #ifndef UI_VIEWS_VIEW_OBSERVER_H_ |
| 6 #define UI_VIEWS_VIEW_OBSERVER_H_ | 6 #define UI_VIEWS_VIEW_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "ui/views/views_export.h" | 8 #include "ui/views/views_export.h" |
| 9 | 9 |
| 10 namespace ui { |
| 11 class NativeTheme; |
| 12 } |
| 13 |
| 10 namespace views { | 14 namespace views { |
| 11 | 15 |
| 12 class View; | 16 class View; |
| 13 | 17 |
| 14 // Observer can listen to various events on the Views. | 18 // Observer can listen to various events on the Views. |
| 15 class VIEWS_EXPORT ViewObserver { | 19 class VIEWS_EXPORT ViewObserver { |
| 16 public: | 20 public: |
| 17 // Called when |child| is added to its parent. Invoked on the parent which has | 21 // Called when |child| is added to its parent. Invoked on the parent which has |
| 18 // the |child| added to it. | 22 // the |child| added to it. |
| 19 virtual void OnChildViewAdded(View* child) {} | 23 virtual void OnChildViewAdded(View* child) {} |
| 20 | 24 |
| 21 // Called when |child| is removed from its |parent|. | 25 // Called when |child| is removed from its |parent|. |
| 22 virtual void OnChildViewRemoved(View* child, View* parent) {} | 26 virtual void OnChildViewRemoved(View* child, View* parent) {} |
| 23 | 27 |
| 24 // Called when View::SetVisible() is called with a new value. | 28 // Called when View::SetVisible() is called with a new value. |
| 25 // The |view| may still be hidden at this point. | 29 // The |view| may still be hidden at this point. |
| 26 virtual void OnViewVisibilityChanged(View* view) {} | 30 virtual void OnViewVisibilityChanged(View* view) {} |
| 27 | 31 |
| 28 virtual void OnViewEnabledChanged(View* view) {} | 32 virtual void OnViewEnabledChanged(View* view) {} |
| 29 | 33 |
| 30 virtual void OnViewBoundsChanged(View* view) {} | 34 virtual void OnViewBoundsChanged(View* view) {} |
| 31 | 35 |
| 32 // Invoked whenever a child is moved to another index. This is called on the | 36 // Invoked whenever a child is moved to another index. This is called on the |
| 33 // parent view. |view| is the child view being moved. | 37 // parent view. |view| is the child view being moved. |
| 34 virtual void OnChildViewReordered(View* view) {} | 38 virtual void OnChildViewReordered(View* view) {} |
| 35 | 39 |
| 40 virtual void OnThemeChanged(View* view) {} |
| 41 |
| 42 virtual void OnNativeThemeChanged(View* view, const ui::NativeTheme* theme) {} |
| 43 |
| 36 protected: | 44 protected: |
| 37 virtual ~ViewObserver() {} | 45 virtual ~ViewObserver() {} |
| 38 }; | 46 }; |
| 39 | 47 |
| 40 } // namespace views | 48 } // namespace views |
| 41 | 49 |
| 42 #endif // UI_VIEWS_VIEW_OBSERVER_H_ | 50 #endif // UI_VIEWS_VIEW_OBSERVER_H_ |
| OLD | NEW |