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

Side by Side Diff: ui/views/view.h

Issue 2500623002: Add ViewObserver to View for view updates (Closed)
Patch Set: skys comments Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 class Background; 68 class Background;
69 class Border; 69 class Border;
70 class ContextMenuController; 70 class ContextMenuController;
71 class DragController; 71 class DragController;
72 class FocusManager; 72 class FocusManager;
73 class FocusTraversable; 73 class FocusTraversable;
74 class LayoutManager; 74 class LayoutManager;
75 class NativeViewAccessibility; 75 class NativeViewAccessibility;
76 class ScrollView; 76 class ScrollView;
77 class ViewObserver;
77 class Widget; 78 class Widget;
78 class WordLookupClient; 79 class WordLookupClient;
79 80
80 namespace internal { 81 namespace internal {
81 class PreEventDispatchHandler; 82 class PreEventDispatchHandler;
82 class PostEventDispatchHandler; 83 class PostEventDispatchHandler;
83 class RootView; 84 class RootView;
84 } 85 }
85 86
86 ///////////////////////////////////////////////////////////////////////////// 87 /////////////////////////////////////////////////////////////////////////////
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 // to scroll. ScrollView interprets a return value of 0 (or negative) 994 // to scroll. ScrollView interprets a return value of 0 (or negative)
994 // to scroll by a default amount. 995 // to scroll by a default amount.
995 // 996 //
996 // See VariableRowHeightScrollHelper and FixedRowHeightScrollHelper for 997 // See VariableRowHeightScrollHelper and FixedRowHeightScrollHelper for
997 // implementations of common cases. 998 // implementations of common cases.
998 virtual int GetPageScrollIncrement(ScrollView* scroll_view, 999 virtual int GetPageScrollIncrement(ScrollView* scroll_view,
999 bool is_horizontal, bool is_positive); 1000 bool is_horizontal, bool is_positive);
1000 virtual int GetLineScrollIncrement(ScrollView* scroll_view, 1001 virtual int GetLineScrollIncrement(ScrollView* scroll_view,
1001 bool is_horizontal, bool is_positive); 1002 bool is_horizontal, bool is_positive);
1002 1003
1004 // Observers -----------------------------------------------------------------
sky 2016/11/21 16:33:37 No need for this comment, please remove.
Sarmad Hashmi 2016/11/21 17:09:53 Done.
1005
1006 void AddObserver(ViewObserver* observer);
1007 void RemoveObserver(ViewObserver* observer);
1008 bool HasObserver(const ViewObserver* observer) const;
1009 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
1010
1003 protected: 1011 protected:
1004 // Used to track a drag. RootView passes this into 1012 // Used to track a drag. RootView passes this into
1005 // ProcessMousePressed/Dragged. 1013 // ProcessMousePressed/Dragged.
1006 struct DragInfo { 1014 struct DragInfo {
1007 // Sets possible_drag to false and start_x/y to 0. This is invoked by 1015 // Sets possible_drag to false and start_x/y to 0. This is invoked by
1008 // RootView prior to invoke ProcessMousePressed. 1016 // RootView prior to invoke ProcessMousePressed.
1009 void Reset(); 1017 void Reset();
1010 1018
1011 // Sets possible_drag to true and start_pt to the specified point. 1019 // Sets possible_drag to true and start_pt to the specified point.
1012 // This is invoked by the target view if it detects the press may generate 1020 // This is invoked by the target view if it detects the press may generate
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 // Input -------------------------------------------------------------------- 1576 // Input --------------------------------------------------------------------
1569 1577
1570 std::unique_ptr<ViewTargeter> targeter_; 1578 std::unique_ptr<ViewTargeter> targeter_;
1571 1579
1572 // Accessibility ------------------------------------------------------------- 1580 // Accessibility -------------------------------------------------------------
1573 1581
1574 // Belongs to this view, but it's reference-counted on some platforms 1582 // Belongs to this view, but it's reference-counted on some platforms
1575 // so we can't use a scoped_ptr. It's dereferenced in the destructor. 1583 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1576 NativeViewAccessibility* native_view_accessibility_; 1584 NativeViewAccessibility* native_view_accessibility_;
1577 1585
1586 // Observers -------------------------------------------------------------
1587
1588 base::ObserverList<ViewObserver> observers_;
1589
1578 DISALLOW_COPY_AND_ASSIGN(View); 1590 DISALLOW_COPY_AND_ASSIGN(View);
1579 }; 1591 };
1580 1592
1581 } // namespace views 1593 } // namespace views
1582 1594
1583 #endif // UI_VIEWS_VIEW_H_ 1595 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« 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