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

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, 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 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 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 1433
1429 // Starts a drag and drop operation originating from this view. This invokes 1434 // Starts a drag and drop operation originating from this view. This invokes
1430 // WriteDragData to write the data and GetDragOperations to determine the 1435 // WriteDragData to write the data and GetDragOperations to determine the
1431 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is 1436 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is
1432 // in the view's coordinate system. 1437 // in the view's coordinate system.
1433 // Returns true if a drag was started. 1438 // Returns true if a drag was started.
1434 bool DoDrag(const ui::LocatedEvent& event, 1439 bool DoDrag(const ui::LocatedEvent& event,
1435 const gfx::Point& press_pt, 1440 const gfx::Point& press_pt,
1436 ui::DragDropTypes::DragEventSource source); 1441 ui::DragDropTypes::DragEventSource source);
1437 1442
1443 void NotifyViewParentChanged(View* old_parent);
sky 2016/11/21 18:32:12 Add description.
Sarmad Hashmi 2016/11/21 19:14:13 Done.
1444
1438 ////////////////////////////////////////////////////////////////////////////// 1445 //////////////////////////////////////////////////////////////////////////////
1439 1446
1440 // Creation and lifetime ----------------------------------------------------- 1447 // Creation and lifetime -----------------------------------------------------
1441 1448
1442 // False if this View is owned by its parent - i.e. it will be deleted by its 1449 // False if this View is owned by its parent - i.e. it will be deleted by its
1443 // parent during its parents destruction. False is the default. 1450 // parent during its parents destruction. False is the default.
1444 bool owned_by_client_; 1451 bool owned_by_client_;
1445 1452
1446 // Attributes ---------------------------------------------------------------- 1453 // Attributes ----------------------------------------------------------------
1447 1454
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 // Input -------------------------------------------------------------------- 1575 // Input --------------------------------------------------------------------
1569 1576
1570 std::unique_ptr<ViewTargeter> targeter_; 1577 std::unique_ptr<ViewTargeter> targeter_;
1571 1578
1572 // Accessibility ------------------------------------------------------------- 1579 // Accessibility -------------------------------------------------------------
1573 1580
1574 // Belongs to this view, but it's reference-counted on some platforms 1581 // 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. 1582 // so we can't use a scoped_ptr. It's dereferenced in the destructor.
1576 NativeViewAccessibility* native_view_accessibility_; 1583 NativeViewAccessibility* native_view_accessibility_;
1577 1584
1585 // Observers -------------------------------------------------------------
1586
1587 base::ObserverList<ViewObserver> observers_;
1588
1578 DISALLOW_COPY_AND_ASSIGN(View); 1589 DISALLOW_COPY_AND_ASSIGN(View);
1579 }; 1590 };
1580 1591
1581 } // namespace views 1592 } // namespace views
1582 1593
1583 #endif // UI_VIEWS_VIEW_H_ 1594 #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