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

Side by Side Diff: chrome/browser/ui/views/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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
6 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
7 #include "ui/base/material_design/material_design_controller.h"
8 #include "ui/views/layout/layout_constants.h"
9
10 namespace chrome {
11
12 static LayoutDelegate layout_delegate_;
sky 2016/11/14 21:49:32 Same comment about statics.
Elly Fong-Jones 2016/11/15 17:13:39 Done.
13
14 // static
15 LayoutDelegate* LayoutDelegate::Get() {
16 return &layout_delegate_;
17 }
18
19 // static
20 LayoutDelegate* LayoutDelegate::GetActiveInstance() {
21 return ui::MaterialDesignController::IsSecondaryUiMaterial()
22 ? HarmonyLayoutDelegate::Get()
23 : LayoutDelegate::Get();
24 }
25
26 int LayoutDelegate::GetLayoutDistance(LayoutDistanceType type) const {
27 switch (type) {
28 case PANEL_VERT_MARGIN:
29 return views::kPanelVertMargin;
30 case RELATED_BUTTON_HORIZONTAL_SPACING:
31 return views::kRelatedButtonHSpacing;
32 case RELATED_CONTROL_HORIZONTAL_SPACING:
33 return views::kRelatedControlHorizontalSpacing;
34 case RELATED_CONTROL_VERTICAL_SPACING:
35 return views::kRelatedControlVerticalSpacing;
36 case UNRELATED_CONTROL_VERTICAL_SPACING:
37 return views::kUnrelatedControlVerticalSpacing;
38 case UNRELATED_CONTROL_LARGE_VERTICAL_SPACING:
39 return views::kUnrelatedControlLargeVerticalSpacing;
40 case BUTTON_VEDGE_MARGIN_NEW:
41 return views::kButtonVEdgeMarginNew;
42 case BUTTON_HEDGE_MARGIN_NEW:
43 return views::kButtonHEdgeMarginNew;
44 }
45 return 0;
46 }
47
48 views::GridLayout::Alignment LayoutDelegate::GetControlLabelGridAlignment()
49 const {
50 return views::kControlLabelGridAlignment;
51 }
52
53 bool LayoutDelegate::UseExtraDialogPadding() const {
54 return true;
55 }
56
57 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698