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

Side by Side Diff: ash/system/status_area_widget_delegate.cc

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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
« no previous file with comments | « ash/system/overview/overview_button_tray.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shell.h" 11 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
12 #include "ash/system/tray/tray_constants.h" 13 #include "ash/system/tray/tray_constants.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "ui/aura/window_event_dispatcher.h" 15 #include "ui/aura/window_event_dispatcher.h"
15 #include "ui/compositor/layer.h" 16 #include "ui/compositor/layer.h"
16 #include "ui/compositor/scoped_layer_animation_settings.h" 17 #include "ui/compositor/scoped_layer_animation_settings.h"
17 #include "ui/gfx/animation/tween.h" 18 #include "ui/gfx/animation/tween.h"
18 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 UpdateLayout(); 106 UpdateLayout();
106 } 107 }
107 108
108 void StatusAreaWidgetDelegate::UpdateLayout() { 109 void StatusAreaWidgetDelegate::UpdateLayout() {
109 // Use a grid layout so that the trays can be centered in each cell, and 110 // Use a grid layout so that the trays can be centered in each cell, and
110 // so that the widget gets laid out correctly when tray sizes change. 111 // so that the widget gets laid out correctly when tray sizes change.
111 views::GridLayout* layout = new views::GridLayout(this); 112 views::GridLayout* layout = new views::GridLayout(this);
112 SetLayoutManager(layout); 113 SetLayoutManager(layout);
113 114
114 views::ColumnSet* columns = layout->AddColumnSet(0); 115 views::ColumnSet* columns = layout->AddColumnSet(0);
115 if (alignment_ == SHELF_ALIGNMENT_BOTTOM) { 116 if (IsHorizontalAlignment(alignment_)) {
116 bool is_first_visible_child = true; 117 bool is_first_visible_child = true;
117 for (int c = 0; c < child_count(); ++c) { 118 for (int c = 0; c < child_count(); ++c) {
118 views::View* child = child_at(c); 119 views::View* child = child_at(c);
119 if (!child->visible()) 120 if (!child->visible())
120 continue; 121 continue;
121 if (!is_first_visible_child) 122 if (!is_first_visible_child)
122 columns->AddPaddingColumn(0, kTraySpacing); 123 columns->AddPaddingColumn(0, kTraySpacing);
123 is_first_visible_child = false; 124 is_first_visible_child = false;
124 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 125 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL,
125 0, /* resize percent */ 126 0, /* resize percent */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { 165 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) {
165 UpdateLayout(); 166 UpdateLayout();
166 } 167 }
167 168
168 void StatusAreaWidgetDelegate::UpdateWidgetSize() { 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() {
169 if (GetWidget()) 170 if (GetWidget())
170 GetWidget()->SetSize(GetPreferredSize()); 171 GetWidget()->SetSize(GetPreferredSize());
171 } 172 }
172 173
173 } // namespace ash 174 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/overview/overview_button_tray.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698