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

Unified Diff: ui/views/layout/layout_delegate.h

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Changes due to feedback. Created 3 years, 8 months 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
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | ui/views/layout/layout_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/layout/layout_delegate.h
diff --git a/ui/views/layout/layout_delegate.h b/ui/views/layout/layout_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d274c3a3555e7a7df5ea30cb1acae1eab55e604
--- /dev/null
+++ b/ui/views/layout/layout_delegate.h
@@ -0,0 +1,75 @@
+// Copyright 2017 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.
+
+#ifndef UI_VIEWS_LAYOUT_LAYOUT_DELEGATE_H_
+#define UI_VIEWS_LAYOUT_LAYOUT_DELEGATE_H_
+
+#include "base/macros.h"
+#include "ui/gfx/geometry/insets.h"
+#include "ui/views/style/typography_provider.h"
+#include "ui/views/views_export.h"
+
+namespace views {
+
+enum InsetsMetric {
+ // The margins that should be applied around a bubble dialog.
+ BUBBLE_DIALOG,
+ // The insets that should be applied around a DialogClientView. Note that
+ // the top inset is used for the distance between the buttons and the
+ // DialogClientView's content view.
+ DIALOG_BUTTON,
+ // The insets that should be applied around a dialog's frame view.
+ DIALOG_FRAME_VIEW,
+ // The margins that should be applied around a panel GridLayout.
+ PANEL,
+ // Padding to add to vector image buttons to increase their click and touch
+ // target size.
+ VECTOR_IMAGE_BUTTON,
+};
+
+enum DistanceMetric {
+ // The default padding to add on each side of a button's label.
+ BUTTON_HORIZONTAL_PADDING,
+ // The distance between a dialog's edge and the close button in the upper
+ // trailing corner.
+ CLOSE_BUTTON_MARGIN,
+ // The default minimum width of a dialog button.
+ DIALOG_BUTTON_MINIMUM_WIDTH,
+ // The spacing between a pair of related horizontal buttons, used for
+ // dialog layout.
+ RELATED_BUTTON_HORIZONTAL,
+ // Horizontal spacing between controls that are logically related.
+ RELATED_CONTROL_HORIZONTAL,
+ // The spacing between a pair of related vertical controls, used for
+ // dialog layout.
+ RELATED_CONTROL_VERTICAL,
+};
+
+class VIEWS_EXPORT LayoutDelegate {
sky 2017/04/06 19:59:24 This class allows looking up layout and typography
kylix_rd 2017/04/07 14:07:59 I like that suggestion. From an observational pers
+ public:
+ LayoutDelegate();
+ virtual ~LayoutDelegate();
+
+ static LayoutDelegate* Get();
+
+ // Returns the insets metric according to the given enumeration element.
+ virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const;
+
+ // Returns the distance metric between elements according to the given
+ // enumeration element.
+ virtual int GetDistanceMetric(DistanceMetric metric) const;
+
+ // Returns the TypographyProvider, used to configure text properties such as
+ // font, weight, color, size, and line height. Never null.
+ virtual const TypographyProvider& GetTypographyProvider() const;
+
+ private:
+ DefaultTypographyProvider typography_provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(LayoutDelegate);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_LAYOUT_LAYOUT_DELEGATE_H_
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | ui/views/layout/layout_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698