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

Side by Side Diff: ash/wm/overview/window_selector_window.cc

Issue 256413004: Relayout windows in overview when display size changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and remove extra newline. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/overview/window_selector_window.h" 5 #include "ash/wm/overview/window_selector_window.h"
6 6
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/overview/scoped_transform_overview_window.h" 10 #include "ash/wm/overview/scoped_transform_overview_window.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool animate) { 100 bool animate) {
101 gfx::Rect src_rect = transform_window_.GetBoundsInScreen(); 101 gfx::Rect src_rect = transform_window_.GetBoundsInScreen();
102 set_bounds(ScopedTransformOverviewWindow:: 102 set_bounds(ScopedTransformOverviewWindow::
103 ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds)); 103 ShrinkRectToFitPreservingAspectRatio(src_rect, target_bounds));
104 transform_window_.SetTransform(root_window, 104 transform_window_.SetTransform(root_window,
105 ScopedTransformOverviewWindow::GetTransformForRect(src_rect, bounds()), 105 ScopedTransformOverviewWindow::GetTransformForRect(src_rect, bounds()),
106 animate); 106 animate);
107 // TODO move close button management to WindowSelectorItem, so that we can 107 // TODO move close button management to WindowSelectorItem, so that we can
108 // also handle panels. 108 // also handle panels.
109 // See http://crbug.com/352143 109 // See http://crbug.com/352143
110 UpdateCloseButtonBounds(root_window); 110 UpdateCloseButtonBounds(root_window, animate);
111 } 111 }
112 112
113 void WindowSelectorWindow::ButtonPressed(views::Button* sender, 113 void WindowSelectorWindow::ButtonPressed(views::Button* sender,
114 const ui::Event& event) { 114 const ui::Event& event) {
115 views::Widget::GetTopLevelWidgetForNativeView( 115 views::Widget::GetTopLevelWidgetForNativeView(
116 transform_window_.window())->Close(); 116 transform_window_.window())->Close();
117 } 117 }
118 118
119 void WindowSelectorWindow::UpdateCloseButtonBounds(aura::Window* root_window) { 119 void WindowSelectorWindow::UpdateCloseButtonBounds(aura::Window* root_window,
120 bool animate) {
120 gfx::Rect align_bounds( 121 gfx::Rect align_bounds(
121 ScreenUtil::ConvertRectFromScreen(root_window, bounds())); 122 ScreenUtil::ConvertRectFromScreen(root_window, bounds()));
122 gfx::Transform close_button_transform; 123 gfx::Transform close_button_transform;
123 close_button_transform.Translate(align_bounds.right(), align_bounds.y()); 124 close_button_transform.Translate(align_bounds.right(), align_bounds.y());
124 125
125 // If the root window has changed, force the close button to be recreated 126 // If the root window has changed, force the close button to be recreated
126 // and faded in on the new root window. 127 // and faded in on the new root window.
127 if (close_button_ && 128 if (close_button_ &&
128 close_button_->GetNativeWindow()->GetRootWindow() != root_window) { 129 close_button_->GetNativeWindow()->GetRootWindow() != root_window) {
129 close_button_.reset(); 130 close_button_.reset();
(...skipping 20 matching lines...) Expand all
150 ui::LayerAnimationElement::OPACITY); 151 ui::LayerAnimationElement::OPACITY);
151 { 152 {
152 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 153 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
153 settings.SetPreemptionStrategy( 154 settings.SetPreemptionStrategy(
154 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 155 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
155 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 156 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
156 WindowSelectorItem::kFadeInMilliseconds)); 157 WindowSelectorItem::kFadeInMilliseconds));
157 layer->SetOpacity(1); 158 layer->SetOpacity(1);
158 } 159 }
159 } else { 160 } else {
160 ui::ScopedLayerAnimationSettings settings( 161 if (animate) {
161 close_button_->GetNativeWindow()->layer()->GetAnimator()); 162 ui::ScopedLayerAnimationSettings settings(
162 settings.SetPreemptionStrategy( 163 close_button_->GetNativeWindow()->layer()->GetAnimator());
163 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 164 settings.SetPreemptionStrategy(
164 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 165 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
165 ScopedTransformOverviewWindow::kTransitionMilliseconds)); 166 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
166 close_button_->GetNativeWindow()->SetTransform(close_button_transform); 167 ScopedTransformOverviewWindow::kTransitionMilliseconds));
168 close_button_->GetNativeWindow()->SetTransform(close_button_transform);
169 } else {
170 close_button_->GetNativeWindow()->SetTransform(close_button_transform);
171 }
167 } 172 }
168 } 173 }
169 174
170 } // namespace ash 175 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698