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

Unified Diff: ui/views/view.cc

Issue 2485083003: views: add layout delegates (Closed)
Patch Set: 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 51d246f0a3fdd6fe91bdc5a351f06909c558287b..128127178dc8a7f549f185f6f81ae76b7c4373a7 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -568,6 +568,20 @@ void View::SetLayoutManager(LayoutManager* layout_manager) {
layout_manager_->Installed(this);
}
+static LayoutDelegate default_layout_delegate_;
+
+LayoutDelegate* View::GetLayoutDelegate() const {
+ if (layout_delegate_)
+ return layout_delegate_;
+ if (!parent_)
+ return &default_layout_delegate_;
+ return parent_->GetLayoutDelegate();
+}
+
+void View::SetLayoutDelegate(LayoutDelegate* delegate) {
+ layout_delegate_ = delegate;
+}
+
void View::SnapLayerToPixelBoundary() {
if (!layer())
return;

Powered by Google App Engine
This is Rietveld 408576698