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