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

Unified Diff: chrome/browser/ui/views/layout_utils.cc

Issue 2485083003: views: add layout delegates (Closed)
Patch Set: first round of fixes :) 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: chrome/browser/ui/views/layout_utils.cc
diff --git a/chrome/browser/ui/views/layout_utils.cc b/chrome/browser/ui/views/layout_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9f31c45207a1a388d4287064cc005ecf631ae027
--- /dev/null
+++ b/chrome/browser/ui/views/layout_utils.cc
@@ -0,0 +1,25 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/layout_utils.h"
+
+#include "chrome/browser/ui/views/harmony/layout_delegate.h"
+#include "ui/views/layout/grid_layout.h"
+#include "ui/views/view.h"
+
+namespace layout_utils {
+
+views::GridLayout* CreatePanelLayout(views::View* host) {
+ views::GridLayout* layout = new views::GridLayout(host);
+ LayoutDelegate* delegate = LayoutDelegate::GetActiveInstance();
+ layout->SetInsets(gfx::Insets(
+ delegate->GetLayoutDistance(
+ LayoutDelegate::LayoutDistanceType::PANEL_VERT_MARGIN),
+ delegate->GetLayoutDistance(
+ LayoutDelegate::LayoutDistanceType::BUTTON_HEDGE_MARGIN_NEW)));
+ host->SetLayoutManager(layout);
+ return layout;
+}
+
+} // namespace layout_utils

Powered by Google App Engine
This is Rietveld 408576698