| 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/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/focus_cycler.h" | 9 #include "ash/focus_cycler.h" |
| 10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/wm/common/shelf/wm_shelf_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "ui/aura/window_event_dispatcher.h" | 16 #include "ui/aura/window_event_dispatcher.h" |
| 16 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 17 #include "ui/compositor/scoped_layer_animation_settings.h" | 18 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 18 #include "ui/gfx/animation/tween.h" | 19 #include "ui/gfx/animation/tween.h" |
| 19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 21 #include "ui/views/accessible_pane_view.h" | 22 #include "ui/views/accessible_pane_view.h" |
| 22 #include "ui/views/layout/grid_layout.h" | 23 #include "ui/views/layout/grid_layout.h" |
| 23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 UpdateLayout(); | 107 UpdateLayout(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 void StatusAreaWidgetDelegate::UpdateLayout() { | 110 void StatusAreaWidgetDelegate::UpdateLayout() { |
| 110 // Use a grid layout so that the trays can be centered in each cell, and | 111 // Use a grid layout so that the trays can be centered in each cell, and |
| 111 // so that the widget gets laid out correctly when tray sizes change. | 112 // so that the widget gets laid out correctly when tray sizes change. |
| 112 views::GridLayout* layout = new views::GridLayout(this); | 113 views::GridLayout* layout = new views::GridLayout(this); |
| 113 SetLayoutManager(layout); | 114 SetLayoutManager(layout); |
| 114 | 115 |
| 115 views::ColumnSet* columns = layout->AddColumnSet(0); | 116 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 116 if (IsHorizontalAlignment(alignment_)) { | 117 if (wm::IsHorizontalAlignment(alignment_)) { |
| 117 bool is_first_visible_child = true; | 118 bool is_first_visible_child = true; |
| 118 for (int c = 0; c < child_count(); ++c) { | 119 for (int c = 0; c < child_count(); ++c) { |
| 119 views::View* child = child_at(c); | 120 views::View* child = child_at(c); |
| 120 if (!child->visible()) | 121 if (!child->visible()) |
| 121 continue; | 122 continue; |
| 122 if (!is_first_visible_child) | 123 if (!is_first_visible_child) |
| 123 columns->AddPaddingColumn(0, kTraySpacing); | 124 columns->AddPaddingColumn(0, kTraySpacing); |
| 124 is_first_visible_child = false; | 125 is_first_visible_child = false; |
| 125 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, | 126 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, |
| 126 0, /* resize percent */ | 127 0, /* resize percent */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { | 166 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { |
| 166 UpdateLayout(); | 167 UpdateLayout(); |
| 167 } | 168 } |
| 168 | 169 |
| 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() { | 170 void StatusAreaWidgetDelegate::UpdateWidgetSize() { |
| 170 if (GetWidget()) | 171 if (GetWidget()) |
| 171 GetWidget()->SetSize(GetPreferredSize()); | 172 GetWidget()->SetSize(GetPreferredSize()); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |