| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/status_area_widget_delegate.h" | 5 #include "ash/system/status_area_widget_delegate.h" |
| 6 | 6 |
| 7 #include "ash/focus_cycler.h" | 7 #include "ash/focus_cycler.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/wm_shelf.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() { | 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() { |
| 170 if (GetWidget()) | 170 if (GetWidget()) |
| 171 GetWidget()->SetSize(GetPreferredSize()); | 171 GetWidget()->SetSize(GetPreferredSize()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child, | 174 void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child, |
| 175 bool extend_border_to_edge) { | 175 bool extend_border_to_edge) { |
| 176 // Tray views are laid out right-to-left or bottom-to-top. | 176 // Tray views are laid out right-to-left or bottom-to-top. |
| 177 const bool horizontal_alignment = IsHorizontalAlignment(alignment_); | 177 const bool horizontal_alignment = IsHorizontalAlignment(alignment_); |
| 178 const int padding = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2; | 178 const int padding = (kShelfSize - kTrayItemSize) / 2; |
| 179 | 179 |
| 180 const int top_edge = horizontal_alignment ? padding : 0; | 180 const int top_edge = horizontal_alignment ? padding : 0; |
| 181 const int left_edge = horizontal_alignment ? 0 : padding; | 181 const int left_edge = horizontal_alignment ? 0 : padding; |
| 182 const int bottom_edge = | 182 const int bottom_edge = |
| 183 horizontal_alignment | 183 horizontal_alignment |
| 184 ? padding | 184 ? padding |
| 185 : (extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0); | 185 : (extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0); |
| 186 const int right_edge = | 186 const int right_edge = |
| 187 horizontal_alignment | 187 horizontal_alignment |
| 188 ? (extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0) | 188 ? (extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0) |
| 189 : padding; | 189 : padding; |
| 190 child->SetBorder( | 190 child->SetBorder( |
| 191 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); | 191 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); |
| 192 | 192 |
| 193 // Layout on |child| needs to be updated based on new border value before | 193 // Layout on |child| needs to be updated based on new border value before |
| 194 // displaying; otherwise |child| will be showing with old border size. | 194 // displaying; otherwise |child| will be showing with old border size. |
| 195 // Fix for crbug.com/623438. | 195 // Fix for crbug.com/623438. |
| 196 child->Layout(); | 196 child->Layout(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace ash | 199 } // namespace ash |
| OLD | NEW |