Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: ui/views/view.h

Issue 2500623002: Add ViewObserver to View for view updates (Closed)
Patch Set: skys comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.h
diff --git a/ui/views/view.h b/ui/views/view.h
index bb5ebdf78cb1213e16c4dd0cd41c4ad73e510466..5eaa6b61b8b43eae1c4a3339436ab30e7488465b 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,13 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
virtual int GetLineScrollIncrement(ScrollView* scroll_view,
bool is_horizontal, bool is_positive);
+ // Observers -----------------------------------------------------------------
sky 2016/11/21 16:33:37 No need for this comment, please remove.
Sarmad Hashmi 2016/11/21 17:09:53 Done.
+
+ void AddObserver(ViewObserver* observer);
+ void RemoveObserver(ViewObserver* observer);
+ bool HasObserver(const ViewObserver* observer) const;
+ void NotifyViewParentChanged(View* view, View* old_parent, View* new_parent);
sky 2016/11/21 16:33:37 Why is this function public? Also, why does it tak
Sarmad Hashmi 2016/11/21 17:09:53 Made it private. Updated NotifyViewParentChanged t
+
protected:
// Used to track a drag. RootView passes this into
// ProcessMousePressed/Dragged.
@@ -1575,6 +1583,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);
};
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698