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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Deleted LayoutDelegate and HarmonyLayoutDelegate. Created 3 years, 9 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
Index: ui/views/layout/views_layout_delegate.h
diff --git a/ui/views/layout/views_layout_delegate.h b/ui/views/layout/views_layout_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..37830dd77d54234c30355306b21d0ef64aa136a3
--- /dev/null
+++ b/ui/views/layout/views_layout_delegate.h
@@ -0,0 +1,73 @@
+// 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_VIEWS_LAYOUT_DELEGATE_H_
+#define UI_VIEWS_LAYOUT_VIEWS_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,
+ // 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 ViewsLayoutDelegate {
Peter Kasting 2017/04/04 02:08:56 Can we just call this LayoutDelegate, and call the
kylix_rd 2017/04/04 20:28:23 Now that the original LayoutDelegate and HarmonyLa
+ public:
+ ViewsLayoutDelegate();
+ virtual ~ViewsLayoutDelegate();
+
+ static ViewsLayoutDelegate* 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.
Peter Kasting 2017/04/04 02:08:56 Nit: "Returns the distance for the given metric"?
kylix_rd 2017/04/04 20:28:23 Done.
Peter Kasting 2017/04/05 19:30:10 It seems at best unnecessary to me, but if you fee
+ 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_;
Peter Kasting 2017/04/04 02:08:56 Seems like this should be a static local in GetTyp
kylix_rd 2017/04/04 20:28:23 OK. I just moved the implementation from ViewsDele
+
+ DISALLOW_COPY_AND_ASSIGN(ViewsLayoutDelegate);
+};
+
+} // namespace views
+
+#endif // CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698