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

Unified Diff: chrome/browser/ui/views/harmony/harmony_layout_delegate.cc

Issue 2485083003: views: add layout delegates (Closed)
Patch Set: move delegate out of views 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/harmony/harmony_layout_delegate.cc
diff --git a/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff465447f2158c67d51b51a92ab2959bf9d5c344
--- /dev/null
+++ b/chrome/browser/ui/views/harmony/harmony_layout_delegate.cc
@@ -0,0 +1,42 @@
+// 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/harmony/harmony_layout_delegate.h"
+
+namespace chrome {
+
+static HarmonyLayoutDelegate harmony_layout_delegate_;
sky 2016/11/14 21:49:32 Style guide says static should only be PODs.
Elly Fong-Jones 2016/11/15 17:13:39 Ack. I misread the definition of POD in the C++ sp
+
+// static
+HarmonyLayoutDelegate* HarmonyLayoutDelegate::Get() {
+ return &harmony_layout_delegate_;
+}
+
+int HarmonyLayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const {
+ const int kLayoutUnit = 16;
+ switch (type) {
+ case PANEL_VERT_MARGIN:
+ return kLayoutUnit;
+ case RELATED_BUTTON_HORIZONTAL_SPACING:
+ return kLayoutUnit / 2;
+ case RELATED_CONTROL_HORIZONTAL_SPACING:
+ return kLayoutUnit;
+ case RELATED_CONTROL_VERTICAL_SPACING:
+ return kLayoutUnit / 2;
+ case UNRELATED_CONTROL_VERTICAL_SPACING:
+ return kLayoutUnit;
+ case UNRELATED_CONTROL_LARGE_VERTICAL_SPACING:
+ return kLayoutUnit;
+ case BUTTON_VEDGE_MARGIN_NEW:
+ return kLayoutUnit;
+ case BUTTON_HEDGE_MARGIN_NEW:
+ return kLayoutUnit;
+ }
+}
+
+bool HarmonyLayoutDelegate::UseExtraDialogPadding() const {
+ return false;
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698