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

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

Issue 2500623002: Add ViewObserver to View for view updates (Closed)
Patch Set: Remove Rect forward declaration and view.h include 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
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 void AddObserver(ViewObserver* observer);
1005 void RemoveObserver(ViewObserver* observer);
1006 bool HasObserver(const ViewObserver* observer) const;
1007
1003 protected: 1008 protected:
1004 // Used to track a drag. RootView passes this into 1009 // Used to track a drag. RootView passes this into
1005 // ProcessMousePressed/Dragged. 1010 // ProcessMousePressed/Dragged.
1006 struct DragInfo { 1011 struct DragInfo {
1007 // Sets possible_drag to false and start_x/y to 0. This is invoked by 1012 // Sets possible_drag to false and start_x/y to 0. This is invoked by
1008 // RootView prior to invoke ProcessMousePressed. 1013 // RootView prior to invoke ProcessMousePressed.
1009 void Reset(); 1014 void Reset();
1010 1015
1011 // Sets possible_drag to true and start_pt to the specified point. 1016 // 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 1017 // 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 -------------------------------------------------------------------- 1573 // Input --------------------------------------------------------------------
1569 1574
1570 std::unique_ptr<ViewTargeter> targeter_; 1575 std::unique_ptr<ViewTargeter> targeter_;
1571 1576
1572 // Accessibility ------------------------------------------------------------- 1577 // Accessibility -------------------------------------------------------------
1573 1578
1574 // Belongs to this view, but it's reference-counted on some platforms 1579 // 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. 1580 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1576 NativeViewAccessibility* native_view_accessibility_; 1581 NativeViewAccessibility* native_view_accessibility_;
1577 1582
1583 // Observers -------------------------------------------------------------
1584
1585 base::ObserverList<ViewObserver> observers_;
1586
1578 DISALLOW_COPY_AND_ASSIGN(View); 1587 DISALLOW_COPY_AND_ASSIGN(View);
1579 }; 1588 };
1580 1589
1581 } // namespace views 1590 } // namespace views
1582 1591
1583 #endif // UI_VIEWS_VIEW_H_ 1592 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698