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

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

Issue 281793002: Revert animation of Overview Button Tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | ash/system/tray/tray_background_view.h » ('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/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/system/tray/tray_constants.h" 12 #include "ash/system/tray/tray_constants.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
15 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/compositor/layer.h"
18 #include "ui/compositor/scoped_layer_animation_settings.h"
19 #include "ui/gfx/animation/tween.h"
20 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
22 #include "ui/views/accessible_pane_view.h" 18 #include "ui/views/accessible_pane_view.h"
23 #include "ui/views/layout/grid_layout.h" 19 #include "ui/views/layout/grid_layout.h"
24 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
25 21
26 namespace {
27
28 const int kAnimationDurationMs = 250;
29
30 class StatusAreaWidgetDelegateAnimationSettings
31 : public ui::ScopedLayerAnimationSettings {
32 public:
33 explicit StatusAreaWidgetDelegateAnimationSettings(ui::Layer* layer)
34 : ui::ScopedLayerAnimationSettings(layer->GetAnimator()) {
35 SetTransitionDuration(
36 base::TimeDelta::FromMilliseconds(kAnimationDurationMs));
37 SetPreemptionStrategy(
38 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
39 SetTweenType(gfx::Tween::EASE_IN_OUT);
40 }
41
42 virtual ~StatusAreaWidgetDelegateAnimationSettings() {}
43
44 private:
45 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegateAnimationSettings);
46 };
47
48 } // namespace
49
50 namespace ash { 22 namespace ash {
51 23
52 StatusAreaWidgetDelegate::StatusAreaWidgetDelegate() 24 StatusAreaWidgetDelegate::StatusAreaWidgetDelegate()
53 : focus_cycler_for_testing_(NULL), 25 : focus_cycler_for_testing_(NULL),
54 alignment_(SHELF_ALIGNMENT_BOTTOM) { 26 alignment_(SHELF_ALIGNMENT_BOTTOM) {
55 // Allow the launcher to surrender the focus to another window upon 27 // Allow the launcher to surrender the focus to another window upon
56 // navigation completion by the user. 28 // navigation completion by the user.
57 set_allow_deactivate_on_esc(true); 29 set_allow_deactivate_on_esc(true);
58 SetPaintToLayer(true);
59 SetFillsBoundsOpaquely(false);
60 } 30 }
61 31
62 StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() { 32 StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() {
63 } 33 }
64 34
65 void StatusAreaWidgetDelegate::SetFocusCyclerForTesting( 35 void StatusAreaWidgetDelegate::SetFocusCyclerForTesting(
66 const FocusCycler* focus_cycler) { 36 const FocusCycler* focus_cycler) {
67 focus_cycler_for_testing_ = focus_cycler; 37 focus_cycler_for_testing_ = focus_cycler;
68 } 38 }
69 39
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 views::View* child = child_at(c); 110 views::View* child = child_at(c);
141 if (!child->visible()) 111 if (!child->visible())
142 continue; 112 continue;
143 if (!is_first_visible_child) 113 if (!is_first_visible_child)
144 layout->AddPaddingRow(0, kTraySpacing); 114 layout->AddPaddingRow(0, kTraySpacing);
145 is_first_visible_child = false; 115 is_first_visible_child = false;
146 layout->StartRow(0, 0); 116 layout->StartRow(0, 0);
147 layout->AddView(child); 117 layout->AddView(child);
148 } 118 }
149 } 119 }
150
151 layer()->GetAnimator()->StopAnimating();
152 StatusAreaWidgetDelegateAnimationSettings settings(layer());
153
154 Layout(); 120 Layout();
155 UpdateWidgetSize(); 121 UpdateWidgetSize();
156 } 122 }
157 123
158 void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) { 124 void StatusAreaWidgetDelegate::ChildPreferredSizeChanged(View* child) {
159 // Need to resize the window when trays or items are added/removed. 125 // Need to resize the window when trays or items are added/removed.
160 StatusAreaWidgetDelegateAnimationSettings settings(layer());
161 UpdateWidgetSize(); 126 UpdateWidgetSize();
162 } 127 }
163 128
164 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { 129 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) {
165 UpdateLayout(); 130 UpdateLayout();
166 } 131 }
167 132
168 void StatusAreaWidgetDelegate::UpdateWidgetSize() { 133 void StatusAreaWidgetDelegate::UpdateWidgetSize() {
169 if (GetWidget()) 134 if (GetWidget())
170 GetWidget()->SetSize(GetPreferredSize()); 135 GetWidget()->SetSize(GetPreferredSize());
171 } 136 }
172 137
173 } // namespace ash 138 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698