| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/window_overview_mode.h" | 5 #include "athena/wm/window_overview_mode.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/compositor/scoped_layer_animation_settings.h" | 25 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 26 #include "ui/events/event_handler.h" | 26 #include "ui/events/event_handler.h" |
| 27 #include "ui/events/gestures/fling_curve.h" | 27 #include "ui/events/gestures/fling_curve.h" |
| 28 #include "ui/gfx/frame_time.h" | 28 #include "ui/gfx/frame_time.h" |
| 29 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
| 30 #include "ui/wm/core/shadow_types.h" | 30 #include "ui/wm/core/shadow_types.h" |
| 31 #include "ui/wm/core/window_util.h" | 31 #include "ui/wm/core/window_util.h" |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 const float kOverviewDefaultScale = 0.75f; |
| 36 |
| 35 struct WindowOverviewState { | 37 struct WindowOverviewState { |
| 36 // The transform for when the window is at the topmost position. | |
| 37 gfx::Transform top; | |
| 38 | |
| 39 // The transform for when the window is at the bottom-most position. | |
| 40 gfx::Transform bottom; | |
| 41 | |
| 42 // The current overview state of the window. 0.f means the window is at the | 38 // The current overview state of the window. 0.f means the window is at the |
| 43 // topmost position. 1.f means the window is at the bottom-most position. | 39 // topmost position. 1.f means the window is at the bottom-most position. |
| 44 float progress; | 40 float progress; |
| 41 |
| 42 // The top-most and bottom-most vertical position of the window in overview |
| 43 // mode. |
| 44 float max_y; |
| 45 float min_y; |
| 46 |
| 47 // |split| is set if this window is one of the two split windows in split-view |
| 48 // mode. |
| 49 bool split; |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 } // namespace | 52 } // namespace |
| 48 | 53 |
| 49 DECLARE_WINDOW_PROPERTY_TYPE(WindowOverviewState*) | 54 DECLARE_WINDOW_PROPERTY_TYPE(WindowOverviewState*) |
| 50 DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowOverviewState, | 55 DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowOverviewState, |
| 51 kWindowOverviewState, | 56 kWindowOverviewState, |
| 52 NULL) | 57 NULL) |
| 53 namespace athena { | 58 namespace athena { |
| 54 | 59 |
| 55 namespace { | 60 namespace { |
| 56 | 61 |
| 62 gfx::Transform GetTransformForSplitWindow(aura::Window* window, float scale) { |
| 63 const float kScrollWindowPositionInOverview = 0.65f; |
| 64 int x_translate = window->bounds().width() * (1 - scale) / 2; |
| 65 gfx::Transform transform; |
| 66 transform.Translate( |
| 67 x_translate, window->bounds().height() * kScrollWindowPositionInOverview); |
| 68 transform.Scale(scale, scale); |
| 69 return transform; |
| 70 } |
| 71 |
| 57 // Gets the transform for the window in its current state. | 72 // Gets the transform for the window in its current state. |
| 58 gfx::Transform GetTransformForState(WindowOverviewState* state) { | 73 gfx::Transform GetTransformForState(aura::Window* window, |
| 59 return gfx::Tween::TransformValueBetween(state->progress, | 74 WindowOverviewState* state) { |
| 60 state->top, | 75 if (state->split) |
| 61 state->bottom); | 76 return GetTransformForSplitWindow(window, kOverviewDefaultScale); |
| 77 |
| 78 const float kProgressToStartShrinking = 0.07; |
| 79 const float kOverviewScale = 0.75f; |
| 80 float scale = kOverviewScale; |
| 81 if (state->progress < kProgressToStartShrinking) { |
| 82 const float kShrunkMinimumScale = 0.7f; |
| 83 scale = gfx::Tween::FloatValueBetween( |
| 84 state->progress / kProgressToStartShrinking, |
| 85 kShrunkMinimumScale, |
| 86 kOverviewScale); |
| 87 } |
| 88 int container_width = window->parent()->bounds().width(); |
| 89 int window_width = window->bounds().width(); |
| 90 int window_x = window->bounds().x(); |
| 91 float x_translate = (container_width - (window_width * scale)) / 2 - window_x; |
| 92 float y_translate = gfx::Tween::FloatValueBetween( |
| 93 state->progress, state->min_y, state->max_y); |
| 94 gfx::Transform transform; |
| 95 transform.Translate(x_translate, y_translate); |
| 96 transform.Scale(scale, scale); |
| 97 return transform; |
| 62 } | 98 } |
| 63 | 99 |
| 64 // Sets the progress-state for the window in the overview mode. | 100 // Sets the progress-state for the window in the overview mode. |
| 65 void SetWindowProgress(aura::Window* window, float progress) { | 101 void SetWindowProgress(aura::Window* window, float progress) { |
| 66 WindowOverviewState* state = window->GetProperty(kWindowOverviewState); | 102 WindowOverviewState* state = window->GetProperty(kWindowOverviewState); |
| 67 state->progress = progress; | 103 state->progress = progress; |
| 68 window->SetTransform(GetTransformForState(state)); | 104 |
| 105 gfx::Transform transform = GetTransformForState(window, state); |
| 106 window->SetTransform(transform); |
| 69 } | 107 } |
| 70 | 108 |
| 71 void HideWindowIfNotVisible(aura::Window* window, | 109 void HideWindowIfNotVisible(aura::Window* window, |
| 72 SplitViewController* split_view_controller) { | 110 SplitViewController* split_view_controller) { |
| 73 bool should_hide = true; | 111 bool should_hide = true; |
| 74 if (split_view_controller->IsSplitViewModeActive()) { | 112 if (split_view_controller->IsSplitViewModeActive()) { |
| 75 should_hide = window != split_view_controller->left_window() && | 113 should_hide = window != split_view_controller->left_window() && |
| 76 window != split_view_controller->right_window(); | 114 window != split_view_controller->right_window(); |
| 77 } else { | 115 } else { |
| 78 should_hide = !wm::IsActiveWindow(window); | 116 should_hide = !wm::IsActiveWindow(window); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 105 gfx::RectF GetTransformedBounds(aura::Window* window) { | 143 gfx::RectF GetTransformedBounds(aura::Window* window) { |
| 106 gfx::Transform transform; | 144 gfx::Transform transform; |
| 107 gfx::RectF bounds = window->bounds(); | 145 gfx::RectF bounds = window->bounds(); |
| 108 transform.Translate(bounds.x(), bounds.y()); | 146 transform.Translate(bounds.x(), bounds.y()); |
| 109 transform.PreconcatTransform(window->layer()->transform()); | 147 transform.PreconcatTransform(window->layer()->transform()); |
| 110 transform.Translate(-bounds.x(), -bounds.y()); | 148 transform.Translate(-bounds.x(), -bounds.y()); |
| 111 transform.TransformRect(&bounds); | 149 transform.TransformRect(&bounds); |
| 112 return bounds; | 150 return bounds; |
| 113 } | 151 } |
| 114 | 152 |
| 115 gfx::Transform GetTransformForSplitWindow(aura::Window* window, float scale) { | |
| 116 int x_translate = window->bounds().width() * (1 - scale) / 2; | |
| 117 gfx::Transform transform; | |
| 118 transform.Translate(x_translate, window->bounds().height() * 0.65); | |
| 119 transform.Scale(scale, scale); | |
| 120 return transform; | |
| 121 } | |
| 122 | |
| 123 void TransformSplitWindowScale(aura::Window* window, float scale) { | 153 void TransformSplitWindowScale(aura::Window* window, float scale) { |
| 124 gfx::Transform transform = window->layer()->GetTargetTransform(); | 154 gfx::Transform transform = window->layer()->GetTargetTransform(); |
| 125 if (transform.Scale2d() == gfx::Vector2dF(scale, scale)) | 155 if (transform.Scale2d() == gfx::Vector2dF(scale, scale)) |
| 126 return; | 156 return; |
| 127 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); | 157 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| 128 window->SetTransform(GetTransformForSplitWindow(window, scale)); | 158 window->SetTransform(GetTransformForSplitWindow(window, scale)); |
| 129 } | 159 } |
| 130 | 160 |
| 131 // Always returns the same target. | 161 // Always returns the same target. |
| 132 class StaticWindowTargeter : public aura::WindowTargeter { | 162 class StaticWindowTargeter : public aura::WindowTargeter { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 ++iter, ++index) { | 231 ++iter, ++index) { |
| 202 aura::Window* window = (*iter); | 232 aura::Window* window = (*iter); |
| 203 wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE); | 233 wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE); |
| 204 | 234 |
| 205 WindowOverviewState* state = new WindowOverviewState; | 235 WindowOverviewState* state = new WindowOverviewState; |
| 206 window->SetProperty(kWindowOverviewState, state); | 236 window->SetProperty(kWindowOverviewState, state); |
| 207 if (split_view_controller_->IsSplitViewModeActive() && | 237 if (split_view_controller_->IsSplitViewModeActive() && |
| 208 (window == split_view_controller_->left_window() || | 238 (window == split_view_controller_->left_window() || |
| 209 window == split_view_controller_->right_window())) { | 239 window == split_view_controller_->right_window())) { |
| 210 // Do not let the left/right windows be scrolled. | 240 // Do not let the left/right windows be scrolled. |
| 211 state->top = GetTransformForSplitWindow(window, kMaxScale); | 241 gfx::Transform transform = |
| 212 state->bottom = state->top; | 242 GetTransformForSplitWindow(window, kOverviewDefaultScale); |
| 243 state->max_y = state->min_y = transform.To2dTranslation().y(); |
| 244 state->split = true; |
| 213 --index; | 245 --index; |
| 214 continue; | 246 continue; |
| 215 } | 247 } |
| 248 state->split = false; |
| 216 UpdateTerminalStateForWindowAtIndex(window, index, windows.size()); | 249 UpdateTerminalStateForWindowAtIndex(window, index, windows.size()); |
| 217 } | 250 } |
| 218 } | 251 } |
| 219 | 252 |
| 220 // Computes the terminal states (i.e. the transforms for the top-most and | 253 // Computes the terminal states (i.e. the transforms for the top-most and |
| 221 // bottom-most position in the stack) for |window|. |window_count| is the | 254 // bottom-most position in the stack) for |window|. |window_count| is the |
| 222 // number of windows in the stack, and |index| is the position of the window | 255 // number of windows in the stack, and |index| is the position of the window |
| 223 // in the stack (0 being the front-most window). | 256 // in the stack (0 being the front-most window). |
| 224 void UpdateTerminalStateForWindowAtIndex(aura::Window* window, | 257 void UpdateTerminalStateForWindowAtIndex(aura::Window* window, |
| 225 size_t index, | 258 size_t index, |
| 226 size_t window_count) { | 259 size_t window_count) { |
| 227 const int kGapBetweenWindowsBottom = 10; | 260 const int kGapBetweenWindowsBottom = 10; |
| 228 const int kGapBetweenWindowsTop = 5; | 261 const int kGapBetweenWindowsTop = 5; |
| 229 | 262 |
| 230 const int container_width = container_->bounds().width(); | |
| 231 const int window_width = window->bounds().width(); | |
| 232 const int window_x = window->bounds().x(); | |
| 233 gfx::Transform top_transform; | |
| 234 int top = (window_count - index - 1) * kGapBetweenWindowsTop; | 263 int top = (window_count - index - 1) * kGapBetweenWindowsTop; |
| 235 float x_translate = | |
| 236 (container_width - (window_width * kMinScale)) / 2 - window_x; | |
| 237 top_transform.Translate(x_translate, top); | |
| 238 top_transform.Scale(kMinScale, kMinScale); | |
| 239 | |
| 240 gfx::Transform bottom_transform; | |
| 241 int bottom = GetScrollableHeight() - (index * kGapBetweenWindowsBottom); | 264 int bottom = GetScrollableHeight() - (index * kGapBetweenWindowsBottom); |
| 242 x_translate = (container_width - (window_width * kMaxScale)) / 2 - window_x; | |
| 243 bottom_transform.Translate(x_translate, bottom - window->bounds().y()); | |
| 244 bottom_transform.Scale(kMaxScale, kMaxScale); | |
| 245 | 265 |
| 246 WindowOverviewState* state = window->GetProperty(kWindowOverviewState); | 266 WindowOverviewState* state = window->GetProperty(kWindowOverviewState); |
| 247 CHECK(state); | 267 CHECK(state); |
| 248 state->top = top_transform; | 268 if (state->split) |
| 249 state->bottom = bottom_transform; | 269 return; |
| 270 state->min_y = top; |
| 271 state->max_y = bottom - window->bounds().y(); |
| 250 state->progress = 0.f; | 272 state->progress = 0.f; |
| 251 } | 273 } |
| 252 | 274 |
| 253 // Sets the initial position for the windows for the overview mode. | 275 // Sets the initial position for the windows for the overview mode. |
| 254 void SetInitialWindowStates() { | 276 void SetInitialWindowStates() { |
| 255 aura::Window::Windows windows = window_list_provider_->GetWindowList(); | 277 aura::Window::Windows windows = window_list_provider_->GetWindowList(); |
| 256 // The initial overview state of the topmost three windows. | 278 // The initial overview state of the topmost three windows. |
| 257 const float kInitialProgress[] = { 0.5f, 0.05f, 0.01f }; | 279 const float kInitialProgress[] = { 0.5f, 0.05f, 0.01f }; |
| 258 size_t index = 0; | 280 size_t index = 0; |
| 259 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); | 281 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // It is possible to scroll |window| down. Scroll it down, and update | 364 // It is possible to scroll |window| down. Scroll it down, and update |
| 343 // |delta_y_p| for the next window. | 365 // |delta_y_p| for the next window. |
| 344 SetWindowProgress(window, std::min(1.f, state->progress + delta_y_p)); | 366 SetWindowProgress(window, std::min(1.f, state->progress + delta_y_p)); |
| 345 delta_y_p /= 2.f; | 367 delta_y_p /= 2.f; |
| 346 } | 368 } |
| 347 } | 369 } |
| 348 } | 370 } |
| 349 } | 371 } |
| 350 | 372 |
| 351 int GetScrollableHeight() const { | 373 int GetScrollableHeight() const { |
| 352 const float kScrollableFraction = 0.65f; | 374 const float kScrollableFraction = 0.85f; |
| 353 const float kScrollableFractionInSplit = 0.5f; | 375 const float kScrollableFractionInSplit = 0.5f; |
| 354 const float fraction = split_view_controller_->IsSplitViewModeActive() | 376 const float fraction = split_view_controller_->IsSplitViewModeActive() |
| 355 ? kScrollableFractionInSplit | 377 ? kScrollableFractionInSplit |
| 356 : kScrollableFraction; | 378 : kScrollableFraction; |
| 357 return container_->bounds().height() * fraction; | 379 return container_->bounds().height() * fraction; |
| 358 } | 380 } |
| 359 | 381 |
| 360 void CreateFlingerFor(const ui::GestureEvent& event) { | 382 void CreateFlingerFor(const ui::GestureEvent& event) { |
| 361 gfx::Vector2dF velocity(event.details().velocity_x(), | 383 gfx::Vector2dF velocity(event.details().velocity_x(), |
| 362 event.details().velocity_y()); | 384 event.details().velocity_y()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 392 | 414 |
| 393 void DragWindow(const ui::GestureEvent& event) { | 415 void DragWindow(const ui::GestureEvent& event) { |
| 394 CHECK(dragged_window_); | 416 CHECK(dragged_window_); |
| 395 CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, event.type()); | 417 CHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, event.type()); |
| 396 CHECK(overview_toolbar_); | 418 CHECK(overview_toolbar_); |
| 397 gfx::Vector2dF dragged_distance = | 419 gfx::Vector2dF dragged_distance = |
| 398 dragged_start_location_ - event.location(); | 420 dragged_start_location_ - event.location(); |
| 399 WindowOverviewState* dragged_state = | 421 WindowOverviewState* dragged_state = |
| 400 dragged_window_->GetProperty(kWindowOverviewState); | 422 dragged_window_->GetProperty(kWindowOverviewState); |
| 401 CHECK(dragged_state); | 423 CHECK(dragged_state); |
| 402 gfx::Transform transform = GetTransformForState(dragged_state); | 424 gfx::Transform transform = |
| 425 GetTransformForState(dragged_window_, dragged_state); |
| 403 transform.Translate(-dragged_distance.x(), 0); | 426 transform.Translate(-dragged_distance.x(), 0); |
| 404 dragged_window_->SetTransform(transform); | 427 dragged_window_->SetTransform(transform); |
| 405 | 428 |
| 406 // Update the toolbar. | 429 // Update the toolbar. |
| 407 const int kMinDistanceForActionButtons = 20; | 430 const int kMinDistanceForActionButtons = 20; |
| 408 if (fabs(dragged_distance.x()) > kMinDistanceForActionButtons) | 431 if (fabs(dragged_distance.x()) > kMinDistanceForActionButtons) |
| 409 overview_toolbar_->ShowActionButtons(); | 432 overview_toolbar_->ShowActionButtons(); |
| 410 else | 433 else |
| 411 overview_toolbar_->HideActionButtons(); | 434 overview_toolbar_->HideActionButtons(); |
| 412 | 435 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 : gfx::Tween::FloatValueBetween(ratio, kMaxOpacity, kMinOpacity); | 467 : gfx::Tween::FloatValueBetween(ratio, kMaxOpacity, kMinOpacity); |
| 445 if (animate_opacity) { | 468 if (animate_opacity) { |
| 446 ui::ScopedLayerAnimationSettings settings( | 469 ui::ScopedLayerAnimationSettings settings( |
| 447 dragged_window_->layer()->GetAnimator()); | 470 dragged_window_->layer()->GetAnimator()); |
| 448 dragged_window_->layer()->SetOpacity(opacity); | 471 dragged_window_->layer()->SetOpacity(opacity); |
| 449 } else { | 472 } else { |
| 450 dragged_window_->layer()->SetOpacity(opacity); | 473 dragged_window_->layer()->SetOpacity(opacity); |
| 451 } | 474 } |
| 452 | 475 |
| 453 if (split_view_controller_->IsSplitViewModeActive()) { | 476 if (split_view_controller_->IsSplitViewModeActive()) { |
| 454 float scale = kMaxScale; | 477 float scale = kOverviewDefaultScale; |
| 455 if (split_drop == split_view_controller_->left_window()) | 478 if (split_drop == split_view_controller_->left_window()) |
| 456 scale = kMaxScaleForSplitTarget; | 479 scale = kMaxScaleForSplitTarget; |
| 457 TransformSplitWindowScale(split_view_controller_->left_window(), scale); | 480 TransformSplitWindowScale(split_view_controller_->left_window(), scale); |
| 458 | 481 |
| 459 scale = kMaxScale; | 482 scale = kOverviewDefaultScale; |
| 460 if (split_drop == split_view_controller_->right_window()) | 483 if (split_drop == split_view_controller_->right_window()) |
| 461 scale = kMaxScaleForSplitTarget; | 484 scale = kMaxScaleForSplitTarget; |
| 462 TransformSplitWindowScale(split_view_controller_->right_window(), scale); | 485 TransformSplitWindowScale(split_view_controller_->right_window(), scale); |
| 463 } | 486 } |
| 464 } | 487 } |
| 465 | 488 |
| 466 bool ShouldCloseDragWindow(const ui::GestureEvent& event) const { | 489 bool ShouldCloseDragWindow(const ui::GestureEvent& event) const { |
| 467 gfx::Vector2dF dragged_distance = | 490 gfx::Vector2dF dragged_distance = |
| 468 dragged_start_location_ - event.location(); | 491 dragged_start_location_ - event.location(); |
| 469 if (event.type() == ui::ET_GESTURE_SCROLL_END) | 492 if (event.type() == ui::ET_GESTURE_SCROLL_END) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 491 dragged_window_->GetProperty(kWindowOverviewState); | 514 dragged_window_->GetProperty(kWindowOverviewState); |
| 492 CHECK(dragged_state); | 515 CHECK(dragged_state); |
| 493 gfx::Transform transform = dragged_window_->layer()->transform(); | 516 gfx::Transform transform = dragged_window_->layer()->transform(); |
| 494 gfx::RectF transformed_bounds = dragged_window_->bounds(); | 517 gfx::RectF transformed_bounds = dragged_window_->bounds(); |
| 495 transform.TransformRect(&transformed_bounds); | 518 transform.TransformRect(&transformed_bounds); |
| 496 float transform_x = 0.f; | 519 float transform_x = 0.f; |
| 497 if (gesture.location().x() > dragged_start_location_.x()) | 520 if (gesture.location().x() > dragged_start_location_.x()) |
| 498 transform_x = container_->bounds().right() - transformed_bounds.x(); | 521 transform_x = container_->bounds().right() - transformed_bounds.x(); |
| 499 else | 522 else |
| 500 transform_x = -(transformed_bounds.x() + transformed_bounds.width()); | 523 transform_x = -(transformed_bounds.x() + transformed_bounds.width()); |
| 501 float scale = gfx::Tween::FloatValueBetween( | 524 transform.Translate(transform_x / kOverviewDefaultScale, 0); |
| 502 dragged_state->progress, kMinScale, kMaxScale); | |
| 503 transform.Translate(transform_x / scale, 0); | |
| 504 dragged_window_->SetTransform(transform); | 525 dragged_window_->SetTransform(transform); |
| 505 dragged_window_->layer()->SetOpacity(kMinOpacity); | 526 dragged_window_->layer()->SetOpacity(kMinOpacity); |
| 506 } | 527 } |
| 507 | 528 |
| 508 const aura::Window::Windows list = window_list_provider_->GetWindowList(); | 529 const aura::Window::Windows list = window_list_provider_->GetWindowList(); |
| 509 CHECK(!list.empty()); | 530 CHECK(!list.empty()); |
| 510 if (list.front() == dragged_window_) { | 531 if (list.front() == dragged_window_) { |
| 511 // There's no window behind |dragged_window_|. So move the windows in | 532 // There's no window behind |dragged_window_|. So move the windows in |
| 512 // front take a step back. | 533 // front take a step back. |
| 513 for (aura::Window::Windows::const_reverse_iterator iter = list.rbegin(); | 534 for (aura::Window::Windows::const_reverse_iterator iter = list.rbegin(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 void RestoreDragWindow() { | 574 void RestoreDragWindow() { |
| 554 CHECK(dragged_window_); | 575 CHECK(dragged_window_); |
| 555 WindowOverviewState* dragged_state = | 576 WindowOverviewState* dragged_state = |
| 556 dragged_window_->GetProperty(kWindowOverviewState); | 577 dragged_window_->GetProperty(kWindowOverviewState); |
| 557 CHECK(dragged_state); | 578 CHECK(dragged_state); |
| 558 | 579 |
| 559 ui::ScopedLayerAnimationSettings settings( | 580 ui::ScopedLayerAnimationSettings settings( |
| 560 dragged_window_->layer()->GetAnimator()); | 581 dragged_window_->layer()->GetAnimator()); |
| 561 settings.SetPreemptionStrategy( | 582 settings.SetPreemptionStrategy( |
| 562 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 583 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 563 dragged_window_->SetTransform(GetTransformForState(dragged_state)); | 584 dragged_window_->SetTransform( |
| 585 GetTransformForState(dragged_window_, dragged_state)); |
| 564 dragged_window_->layer()->SetOpacity(1.f); | 586 dragged_window_->layer()->SetOpacity(1.f); |
| 565 dragged_window_ = NULL; | 587 dragged_window_ = NULL; |
| 566 } | 588 } |
| 567 | 589 |
| 568 void EndDragWindow(const ui::GestureEvent& gesture) { | 590 void EndDragWindow(const ui::GestureEvent& gesture) { |
| 569 CHECK(dragged_window_); | 591 CHECK(dragged_window_); |
| 570 CHECK(overview_toolbar_); | 592 CHECK(overview_toolbar_); |
| 571 OverviewToolbar::ActionType action = overview_toolbar_->current_action(); | 593 OverviewToolbar::ActionType action = overview_toolbar_->current_action(); |
| 572 overview_toolbar_.reset(); | 594 overview_toolbar_.reset(); |
| 573 if (action == OverviewToolbar::ACTION_TYPE_SPLIT) { | 595 if (action == OverviewToolbar::ACTION_TYPE_SPLIT) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 gfx::Vector2dF scroll = fling_->GetScrollAmountAtTime(timestamp); | 720 gfx::Vector2dF scroll = fling_->GetScrollAmountAtTime(timestamp); |
| 699 if (scroll.IsZero()) { | 721 if (scroll.IsZero()) { |
| 700 fling_.reset(); | 722 fling_.reset(); |
| 701 RemoveAnimationObserver(); | 723 RemoveAnimationObserver(); |
| 702 } else { | 724 } else { |
| 703 DoScroll(scroll.y()); | 725 DoScroll(scroll.y()); |
| 704 } | 726 } |
| 705 } | 727 } |
| 706 | 728 |
| 707 const int kMinDistanceForDismissal = 300; | 729 const int kMinDistanceForDismissal = 300; |
| 708 const float kMinScale = 0.6f; | |
| 709 const float kMaxScale = 0.75f; | |
| 710 const float kMaxOpacity = 1.0f; | 730 const float kMaxOpacity = 1.0f; |
| 711 const float kMinOpacity = 0.2f; | 731 const float kMinOpacity = 0.2f; |
| 712 const float kMaxScaleForSplitTarget = 0.9f; | 732 const float kMaxScaleForSplitTarget = 0.9f; |
| 713 | 733 |
| 714 aura::Window* container_; | 734 aura::Window* container_; |
| 715 // Provider of the stack of windows to show in the overview mode. Not owned. | 735 // Provider of the stack of windows to show in the overview mode. Not owned. |
| 716 const WindowListProvider* window_list_provider_; | 736 const WindowListProvider* window_list_provider_; |
| 717 SplitViewController* split_view_controller_; | 737 SplitViewController* split_view_controller_; |
| 718 | 738 |
| 719 WindowOverviewModeDelegate* delegate_; | 739 WindowOverviewModeDelegate* delegate_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 734 aura::Window* container, | 754 aura::Window* container, |
| 735 const WindowListProvider* window_list_provider, | 755 const WindowListProvider* window_list_provider, |
| 736 SplitViewController* split_view_controller, | 756 SplitViewController* split_view_controller, |
| 737 WindowOverviewModeDelegate* delegate) { | 757 WindowOverviewModeDelegate* delegate) { |
| 738 return scoped_ptr<WindowOverviewMode>( | 758 return scoped_ptr<WindowOverviewMode>( |
| 739 new WindowOverviewModeImpl(container, window_list_provider, | 759 new WindowOverviewModeImpl(container, window_list_provider, |
| 740 split_view_controller, delegate)); | 760 split_view_controller, delegate)); |
| 741 } | 761 } |
| 742 | 762 |
| 743 } // namespace athena | 763 } // namespace athena |
| OLD | NEW |