| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/layout_constants.h" | 5 #include "chrome/browser/ui/views/layout_constants.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/base/resource/material_design/material_design_controller.h" | 8 #include "ui/base/resource/material_design/material_design_controller.h" |
| 9 | 9 |
| 10 int GetLayoutConstant(LayoutConstant constant) { | 10 int GetLayoutConstant(LayoutConstant constant) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 NOTREACHED(); | 89 NOTREACHED(); |
| 90 return 0; | 90 return 0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 gfx::Insets GetLayoutInsets(LayoutInset inset) { | 93 gfx::Insets GetLayoutInsets(LayoutInset inset) { |
| 94 const int kAvatarLeftPadding[] = {2, 4, 4}; | 94 const int kAvatarLeftPadding[] = {2, 4, 4}; |
| 95 const int kAvatarRightPadding[] = {-6, 4, 4}; | 95 const int kAvatarRightPadding[] = {-6, 4, 4}; |
| 96 const int kAvatarBottomPadding[] = {2, 4, 4}; | 96 const int kAvatarBottomPadding[] = {2, 4, 4}; |
| 97 const int kOmniboxDropdownIconPadding[] = {2, 4, 8}; | 97 const int kOmniboxDropdownIconPadding[] = {2, 4, 8}; |
| 98 const int kOmniboxDropdownTextPadding[] = {3, 4, 8}; | 98 const int kOmniboxDropdownPadding[] = {3, 4, 4}; |
| 99 const int kOmniboxDropdownTextPadding[] = {3, 3, 3}; |
| 99 const int kTabBottomPadding[] = {2, 2, 2}; | 100 const int kTabBottomPadding[] = {2, 2, 2}; |
| 100 const int kTabLeftPadding[] = {20, 20, 20}; | 101 const int kTabLeftPadding[] = {20, 20, 20}; |
| 101 const int kTabRightPadding[] = {20, 20, 20}; | 102 const int kTabRightPadding[] = {20, 20, 20}; |
| 102 const int kTabTopPadding[] = {4, 4, 4}; | 103 const int kTabTopPadding[] = {4, 4, 4}; |
| 103 const int kToolbarBottomPadding[] = {5, 5, 5}; | 104 const int kToolbarBottomPadding[] = {5, 5, 5}; |
| 104 const int kToolbarButtonPadding[] = {2, 6, 6}; | 105 const int kToolbarButtonPadding[] = {2, 6, 6}; |
| 105 const int kToolbarLeftPadding[] = {3, 4, 8}; | 106 const int kToolbarLeftPadding[] = {3, 4, 8}; |
| 106 const int kToolbarRightPadding[] = {2, 4, 8}; | 107 const int kToolbarRightPadding[] = {2, 4, 8}; |
| 107 const int kToolbarTopPadding[] = {5, 4, 4}; | 108 const int kToolbarTopPadding[] = {5, 4, 4}; |
| 108 | 109 |
| 109 const int mode = ui::MaterialDesignController::GetMode(); | 110 const int mode = ui::MaterialDesignController::GetMode(); |
| 110 switch (inset) { | 111 switch (inset) { |
| 111 case AVATAR_ICON: { | 112 case AVATAR_ICON: { |
| 112 return gfx::Insets(0, kAvatarLeftPadding[mode], | 113 return gfx::Insets(0, kAvatarLeftPadding[mode], |
| 113 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); | 114 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); |
| 114 } | 115 } |
| 116 case OMNIBOX_DROPDOWN: { |
| 117 const int padding = kOmniboxDropdownPadding[mode]; |
| 118 return gfx::Insets(padding, 0, padding, 0); |
| 119 } |
| 115 case OMNIBOX_DROPDOWN_ICON: { | 120 case OMNIBOX_DROPDOWN_ICON: { |
| 116 const int padding = kOmniboxDropdownIconPadding[mode]; | 121 const int padding = kOmniboxDropdownIconPadding[mode]; |
| 117 return gfx::Insets(padding, 0, padding, 0); | 122 return gfx::Insets(padding, 0, padding, 0); |
| 118 } | 123 } |
| 119 case OMNIBOX_DROPDOWN_TEXT: { | 124 case OMNIBOX_DROPDOWN_TEXT: { |
| 120 const int padding = kOmniboxDropdownTextPadding[mode]; | 125 const int padding = kOmniboxDropdownTextPadding[mode]; |
| 121 return gfx::Insets(padding, 0, padding, 0); | 126 return gfx::Insets(padding, 0, padding, 0); |
| 122 } | 127 } |
| 123 case TAB: | 128 case TAB: |
| 124 return gfx::Insets(kTabTopPadding[mode], kTabLeftPadding[mode], | 129 return gfx::Insets(kTabTopPadding[mode], kTabLeftPadding[mode], |
| 125 kTabBottomPadding[mode], kTabRightPadding[mode]); | 130 kTabBottomPadding[mode], kTabRightPadding[mode]); |
| 126 case TOOLBAR: | 131 case TOOLBAR: |
| 127 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], | 132 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], |
| 128 kToolbarBottomPadding[mode], | 133 kToolbarBottomPadding[mode], |
| 129 kToolbarRightPadding[mode]); | 134 kToolbarRightPadding[mode]); |
| 130 case TOOLBAR_BUTTON: { | 135 case TOOLBAR_BUTTON: { |
| 131 const int inset = kToolbarButtonPadding[mode]; | 136 const int inset = kToolbarButtonPadding[mode]; |
| 132 return gfx::Insets(inset, inset, inset, inset); | 137 return gfx::Insets(inset, inset, inset, inset); |
| 133 } | 138 } |
| 134 } | 139 } |
| 135 NOTREACHED(); | 140 NOTREACHED(); |
| 136 return gfx::Insets(); | 141 return gfx::Insets(); |
| 137 } | 142 } |
| OLD | NEW |