| 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/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/focus_cycler.h" | 8 #include "ash/focus_cycler.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 views::ColumnSet* columns = layout->AddColumnSet(0); | 89 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 90 if (alignment_ == SHELF_ALIGNMENT_BOTTOM) { | 90 if (alignment_ == SHELF_ALIGNMENT_BOTTOM) { |
| 91 for (int c = 0; c < child_count(); ++c) { | 91 for (int c = 0; c < child_count(); ++c) { |
| 92 if (c != 0) | 92 if (c != 0) |
| 93 columns->AddPaddingColumn(0, kTraySpacing); | 93 columns->AddPaddingColumn(0, kTraySpacing); |
| 94 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, | 94 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, |
| 95 0, /* resize percent */ | 95 0, /* resize percent */ |
| 96 views::GridLayout::USE_PREF, 0, 0); | 96 views::GridLayout::USE_PREF, 0, 0); |
| 97 } | 97 } |
| 98 layout->StartRow(0, 0); | 98 layout->StartRow(0, 0); |
| 99 for (int c = 0; c < child_count(); ++c) | 99 for (int c = child_count() - 1; c >= 0; --c) |
| 100 layout->AddView(child_at(c)); | 100 layout->AddView(child_at(c)); |
| 101 } else { | 101 } else { |
| 102 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, | 102 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, |
| 103 0, /* resize percent */ | 103 0, /* resize percent */ |
| 104 views::GridLayout::USE_PREF, 0, 0); | 104 views::GridLayout::USE_PREF, 0, 0); |
| 105 for (int c = 0; c < child_count(); ++c) { | 105 for (int c = child_count() - 1; c >= 0; --c) { |
| 106 if (c != 0) | 106 if (c != child_count() - 1) |
| 107 layout->AddPaddingRow(0, kTraySpacing); | 107 layout->AddPaddingRow(0, kTraySpacing); |
| 108 layout->StartRow(0, 0); | 108 layout->StartRow(0, 0); |
| 109 layout->AddView(child_at(c)); | 109 layout->AddView(child_at(c)); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 Layout(); | 112 Layout(); |
| 113 UpdateWidgetSize(); | 113 UpdateWidgetSize(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { | 116 void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { |
| 117 // Need to resize the window when trays or items are added/removed. | 117 // Need to resize the window when trays or items are added/removed. |
| 118 UpdateWidgetSize(); | 118 UpdateWidgetSize(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void StatusAreaWidgetDelegate::UpdateWidgetSize() { | 121 void StatusAreaWidgetDelegate::UpdateWidgetSize() { |
| 122 if (GetWidget()) | 122 if (GetWidget()) |
| 123 GetWidget()->SetSize(GetPreferredSize()); | 123 GetWidget()->SetSize(GetPreferredSize()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace internal | 126 } // namespace internal |
| 127 } // namespace ash | 127 } // namespace ash |
| OLD | NEW |