| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ |
| 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
| 13 |
| 12 namespace gfx { | 14 namespace gfx { |
| 13 class Rect; | 15 class Rect; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace mojo { | 18 namespace mojo { |
| 17 namespace view_manager { | 19 namespace view_manager { |
| 18 | 20 |
| 19 class View; | 21 class View; |
| 20 class ViewTreeNode; | 22 class ViewTreeNode; |
| 21 | 23 |
| 22 class ViewTreeNodeObserver { | 24 class ViewTreeNodeObserver { |
| 23 public: | 25 public: |
| 24 enum DispositionChangePhase { | 26 enum DispositionChangePhase { |
| 25 DISPOSITION_CHANGING, | 27 DISPOSITION_CHANGING, |
| 26 DISPOSITION_CHANGED | 28 DISPOSITION_CHANGED |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 struct TreeChangeParams { | 31 struct TreeChangeParams { |
| 30 TreeChangeParams(); | 32 TreeChangeParams(); |
| 31 ViewTreeNode* target; | 33 ViewTreeNode* target; |
| 32 ViewTreeNode* old_parent; | 34 ViewTreeNode* old_parent; |
| 33 ViewTreeNode* new_parent; | 35 ViewTreeNode* new_parent; |
| 34 ViewTreeNode* receiver; | 36 ViewTreeNode* receiver; |
| 35 DispositionChangePhase phase; | 37 DispositionChangePhase phase; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 virtual void OnTreeChange(const TreeChangeParams& params) {} | 40 virtual void OnTreeChange(const TreeChangeParams& params) {} |
| 39 | 41 |
| 42 virtual void OnNodeReordered(ViewTreeNode* node, |
| 43 ViewTreeNode* relative_node, |
| 44 OrderDirection direction, |
| 45 DispositionChangePhase phase) {} |
| 46 |
| 40 virtual void OnNodeDestroy(ViewTreeNode* node, | 47 virtual void OnNodeDestroy(ViewTreeNode* node, |
| 41 DispositionChangePhase phase) {} | 48 DispositionChangePhase phase) {} |
| 42 | 49 |
| 43 virtual void OnNodeActiveViewChange(ViewTreeNode* node, | 50 virtual void OnNodeActiveViewChange(ViewTreeNode* node, |
| 44 View* old_view, | 51 View* old_view, |
| 45 View* new_view, | 52 View* new_view, |
| 46 DispositionChangePhase phase) {} | 53 DispositionChangePhase phase) {} |
| 47 | 54 |
| 48 virtual void OnNodeBoundsChange(ViewTreeNode* node, | 55 virtual void OnNodeBoundsChange(ViewTreeNode* node, |
| 49 const gfx::Rect& old_bounds, | 56 const gfx::Rect& old_bounds, |
| 50 const gfx::Rect& new_bounds, | 57 const gfx::Rect& new_bounds, |
| 51 DispositionChangePhase phase) {} | 58 DispositionChangePhase phase) {} |
| 52 | 59 |
| 53 protected: | 60 protected: |
| 54 virtual ~ViewTreeNodeObserver() {} | 61 virtual ~ViewTreeNodeObserver() {} |
| 55 }; | 62 }; |
| 56 | 63 |
| 57 } // namespace view_manager | 64 } // namespace view_manager |
| 58 } // namespace mojo | 65 } // namespace mojo |
| 59 | 66 |
| 60 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ | 67 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_ |
| OLD | NEW |