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

Unified Diff: ui/views/view.cc

Issue 2500623002: Add ViewObserver to View for view updates (Closed)
Patch Set: Add DevToolsobserver to View for view updates 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
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index b6cd9d0e97f9345128f754a62f0b80e15fa2430f..d9ec5568db08e94a8a05a4fc5a6adaa594ce7b05 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -48,6 +48,7 @@
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/context_menu_controller.h"
+#include "ui/views/devtools_observer.h"
#include "ui/views/drag_controller.h"
#include "ui/views/focus/view_storage.h"
#include "ui/views/layout/layout_manager.h"
@@ -118,7 +119,8 @@ View::View()
focus_behavior_(FocusBehavior::NEVER),
context_menu_controller_(NULL),
drag_controller_(NULL),
- native_view_accessibility_(NULL) {
+ native_view_accessibility_(NULL),
+ devtools_observer_(NULL) {
sadrul 2016/11/15 17:21:49 nullptr
Sarmad Hashmi 2016/11/15 17:54:56 Done.
SetTargetHandler(this);
}
@@ -243,6 +245,9 @@ void View::ReorderChildView(View* view, int index) {
if (next_focusable)
next_focusable->previous_focusable_view_ = prev_focusable;
+ if (devtools_observer_)
+ devtools_observer_->OnChildViewReordered(view, index);
+
// Add it in the specified index now.
InitFocusSiblings(view, index);
children_.insert(children_.begin() + index, view);
@@ -295,6 +300,9 @@ void View::SetBoundsRect(const gfx::Rect& bounds) {
SCHEDULE_PAINT_SIZE_CHANGED);
}
+ if (devtools_observer_)
+ devtools_observer_->OnViewBoundsChanged(this, bounds);
+
gfx::Rect prev = bounds_;
bounds_ = bounds;
BoundsChanged(prev);
@@ -436,6 +444,8 @@ void View::SetEnabled(bool enabled) {
if (enabled != enabled_) {
enabled_ = enabled;
AdvanceFocusIfNecessary();
+ if (devtools_observer_)
+ devtools_observer_->OnViewEnabledChanged(this, enabled);
OnEnabledChanged();
}
}
@@ -1364,6 +1374,12 @@ int View::GetLineScrollIncrement(ScrollView* scroll_view,
return 0;
}
+// DevTools Observer ---------------------------------------------------------
+
+void View::SetDevToolsObserver(DevToolsObserver* devtools_observer) {
+ devtools_observer_ = devtools_observer;
+}
+
////////////////////////////////////////////////////////////////////////////////
// View, protected:
@@ -1878,6 +1894,8 @@ void View::ViewHierarchyChangedImpl(
}
}
+ if (devtools_observer_)
+ devtools_observer_->OnViewHierarchyChanged(this, details);
sadrul 2016/11/15 17:21:49 Is this the right place for this? Should this be i
Sarmad Hashmi 2016/11/15 17:54:56 ViewHierarchyChangedImpl is called from the Propog
ViewHierarchyChanged(details);
details.parent->needs_layout_ = true;
}
@@ -1897,6 +1915,8 @@ void View::PropagateVisibilityNotifications(View* start, bool is_visible) {
}
void View::VisibilityChangedImpl(View* starting_from, bool is_visible) {
+ if (devtools_observer_)
+ devtools_observer_->OnViewVisibilityChanged(starting_from, is_visible);
VisibilityChanged(starting_from, is_visible);
}

Powered by Google App Engine
This is Rietveld 408576698