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

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

Issue 2036353002: mash: Move ash/common/wm/shelf to ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 6 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/status_area_widget_delegate.h ('k') | ash/system/toast/toast_manager_unittest.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/common/shelf/wm_shelf_util.h"
9 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
10 #include "ash/common/wm/shelf/wm_shelf_util.h"
11 #include "ash/focus_cycler.h" 11 #include "ash/focus_cycler.h"
12 #include "ash/shelf/shelf_util.h" 12 #include "ash/shelf/shelf_util.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/system/tray/tray_constants.h" 14 #include "ash/system/tray/tray_constants.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/compositor/layer.h" 17 #include "ui/compositor/layer.h"
18 #include "ui/compositor/scoped_layer_animation_settings.h" 18 #include "ui/compositor/scoped_layer_animation_settings.h"
19 #include "ui/gfx/animation/tween.h" 19 #include "ui/gfx/animation/tween.h"
20 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
(...skipping 22 matching lines...) Expand all
43 43
44 private: 44 private:
45 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegateAnimationSettings); 45 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegateAnimationSettings);
46 }; 46 };
47 47
48 } // namespace 48 } // namespace
49 49
50 namespace ash { 50 namespace ash {
51 51
52 StatusAreaWidgetDelegate::StatusAreaWidgetDelegate() 52 StatusAreaWidgetDelegate::StatusAreaWidgetDelegate()
53 : focus_cycler_for_testing_(nullptr), 53 : focus_cycler_for_testing_(nullptr), alignment_(SHELF_ALIGNMENT_BOTTOM) {
54 alignment_(wm::SHELF_ALIGNMENT_BOTTOM) {
55 // Allow the launcher to surrender the focus to another window upon 54 // Allow the launcher to surrender the focus to another window upon
56 // navigation completion by the user. 55 // navigation completion by the user.
57 set_allow_deactivate_on_esc(true); 56 set_allow_deactivate_on_esc(true);
58 SetPaintToLayer(true); 57 SetPaintToLayer(true);
59 layer()->SetFillsBoundsOpaquely(false); 58 layer()->SetFillsBoundsOpaquely(false);
60 } 59 }
61 60
62 StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() { 61 StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() {
63 } 62 }
64 63
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 UpdateLayout(); 106 UpdateLayout();
108 } 107 }
109 108
110 void StatusAreaWidgetDelegate::UpdateLayout() { 109 void StatusAreaWidgetDelegate::UpdateLayout() {
111 // 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
112 // 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.
113 views::GridLayout* layout = new views::GridLayout(this); 112 views::GridLayout* layout = new views::GridLayout(this);
114 SetLayoutManager(layout); 113 SetLayoutManager(layout);
115 114
116 views::ColumnSet* columns = layout->AddColumnSet(0); 115 views::ColumnSet* columns = layout->AddColumnSet(0);
117 if (wm::IsHorizontalAlignment(alignment_)) { 116 if (IsHorizontalAlignment(alignment_)) {
118 bool is_first_visible_child = true; 117 bool is_first_visible_child = true;
119 for (int c = 0; c < child_count(); ++c) { 118 for (int c = 0; c < child_count(); ++c) {
120 views::View* child = child_at(c); 119 views::View* child = child_at(c);
121 if (!child->visible()) 120 if (!child->visible())
122 continue; 121 continue;
123 if (!is_first_visible_child) 122 if (!is_first_visible_child)
124 columns->AddPaddingColumn(0, kTraySpacing); 123 columns->AddPaddingColumn(0, kTraySpacing);
125 is_first_visible_child = false; 124 is_first_visible_child = false;
126 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 125 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL,
127 0, /* resize percent */ 126 0, /* resize percent */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { 165 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) {
167 UpdateLayout(); 166 UpdateLayout();
168 } 167 }
169 168
170 void StatusAreaWidgetDelegate::UpdateWidgetSize() { 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() {
171 if (GetWidget()) 170 if (GetWidget())
172 GetWidget()->SetSize(GetPreferredSize()); 171 GetWidget()->SetSize(GetPreferredSize());
173 } 172 }
174 173
175 } // namespace ash 174 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.h ('k') | ash/system/toast/toast_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698