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

Side by Side Diff: chrome/browser/ui/views/layout_constants.cc

Issue 1338103002: Create c/b/ui/views/layout_constants.*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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/layout_constants.h"
6
7 #include "base/logging.h"
8 #include "ui/base/resource/material_design/material_design_controller.h"
9
10 int GetLayoutConstant(LayoutConstant constant) {
11 const int kIconLabelViewTrailingPadding[] = {2, 8, 8};
12 const int kLocationBarBubbleHorizontalPadding[] = {1, 5, 5};
13 const int kLocationBarBubbleVerticalPadding[] = {1, 3, 3};
14 const int kLocationBarHeight[] = {0, 28, 32};
15 const int kLocationBarHorizontalPadding[] = {3, 6, 6};
16 const int kLocationBarVerticalPadding[] = {2, 6, 6};
17 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0};
18 const int kToolbarViewContentShadowHeight[] = {0, 0, 0};
19 const int kToolbarViewContentShadowHeightAsh[] = {2, 0, 0};
20 const int kToolbarViewElementPadding[] = {0, 0, 8};
21 const int kToolbarViewLocationBarRightPadding[] = {0, 4, 8};
22 const int kToolbarViewStandardSpacing[] = {3, 4, 8};
23
24 const int mode = ui::MaterialDesignController::GetMode();
25 switch (constant) {
26 case ICON_LABEL_VIEW_TRAILING_PADDING:
27 return kIconLabelViewTrailingPadding[mode];
28 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING:
29 return kLocationBarBubbleHorizontalPadding[mode];
30 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING:
31 return kLocationBarBubbleVerticalPadding[mode];
32 case LOCATION_BAR_HEIGHT:
33 return kLocationBarHeight[mode];
34 case LOCATION_BAR_HORIZONTAL_PADDING:
35 return kLocationBarHorizontalPadding[mode];
36 case LOCATION_BAR_VERTICAL_PADDING:
37 return kLocationBarVerticalPadding[mode];
38 case OMNIBOX_DROPDOWN_BORDER_INTERIOR:
39 return kOmniboxDropdownBorderInterior[mode];
40 case TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT:
41 return kToolbarViewContentShadowHeight[mode];
42 case TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH:
43 return kToolbarViewContentShadowHeightAsh[mode];
44 case TOOLBAR_VIEW_ELEMENT_PADDING:
45 return kToolbarViewElementPadding[mode];
46 case TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING:
47 return kToolbarViewLocationBarRightPadding[mode];
48 case TOOLBAR_VIEW_STANDARD_SPACING:
49 return kToolbarViewStandardSpacing[mode];
50 }
51 NOTREACHED();
52 return 0;
53 }
54
55 gfx::Insets GetLayoutInsets(LayoutInset inset) {
56 const int kOmniboxDropdownMinIconVerticalPadding[] = {2, 4, 8};
57 const int kOmniboxDropdownMinTextVerticalPadding[] = {3, 4, 8};
58 const int kToolbarButtonBorderInset[] = {2, 6, 6};
59 const int kToolbarViewBottomVerticalPadding[] = {5, 5, 5};
60 const int kToolbarViewTopVerticalPadding[] = {5, 4, 4};
61 const int kToolbarViewLeftEdgeSpacing[] = {3, 4, 8};
62 const int kToolbarViewRightEdgeSpacing[] = {2, 4, 8};
63
64 const int mode = ui::MaterialDesignController::GetMode();
65 switch (inset) {
66 case OMNIBOX_DROPDOWN_ICON: {
67 const int padding = kOmniboxDropdownMinIconVerticalPadding[mode];
68 return gfx::Insets(padding, 0, padding, 0);
69 }
70 case OMNIBOX_DROPDOWN_TEXT: {
71 const int padding = kOmniboxDropdownMinTextVerticalPadding[mode];
72 return gfx::Insets(padding, 0, padding, 0);
73 }
74 case TOOLBAR_BUTTON: {
75 const int inset = kToolbarButtonBorderInset[mode];
76 return gfx::Insets(inset, inset, inset, inset);
77 }
78 case TOOLBAR_VIEW:
79 return gfx::Insets(kToolbarViewTopVerticalPadding[mode],
80 kToolbarViewLeftEdgeSpacing[mode],
81 kToolbarViewBottomVerticalPadding[mode],
82 kToolbarViewRightEdgeSpacing[mode]);
83 }
84 NOTREACHED();
85 return gfx::Insets();
86 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/layout_constants.h ('k') | chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698