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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 82573002: Changes sequence of docked animations when evicting windows from dock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes sequence of docked animations (nits) Created 7 years 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/wm/window_animations.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" 5 #include "ash/wm/dock/docked_window_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 27 matching lines...) Expand all
38 // static 38 // static
39 const int DockedWindowLayoutManager::kMaxDockWidth = 360; 39 const int DockedWindowLayoutManager::kMaxDockWidth = 360;
40 // static 40 // static
41 const int DockedWindowLayoutManager::kMinDockWidth = 200; 41 const int DockedWindowLayoutManager::kMinDockWidth = 200;
42 // static 42 // static
43 const int DockedWindowLayoutManager::kMinDockGap = 2; 43 const int DockedWindowLayoutManager::kMinDockGap = 2;
44 // static 44 // static
45 const int DockedWindowLayoutManager::kIdealWidth = 250; 45 const int DockedWindowLayoutManager::kIdealWidth = 250;
46 const int kMinimumHeight = 250; 46 const int kMinimumHeight = 250;
47 const int kSlideDurationMs = 120; 47 const int kSlideDurationMs = 120;
48 const int kFadeDurationMs = 720; 48 const int kFadeDurationMs = 60;
49 const int kMinimizeDurationMs = 720;
49 50
50 namespace { 51 namespace {
51 52
52 const SkColor kDockBackgroundColor = SkColorSetARGB(0xff, 0x10, 0x10, 0x10); 53 const SkColor kDockBackgroundColor = SkColorSetARGB(0xff, 0x10, 0x10, 0x10);
53 const float kDockBackgroundOpacity = 0.5f; 54 const float kDockBackgroundOpacity = 0.5f;
54 55
55 class DockedBackgroundWidget : public views::Widget { 56 class DockedBackgroundWidget : public views::Widget {
56 public: 57 public:
57 explicit DockedBackgroundWidget(aura::Window* container) { 58 explicit DockedBackgroundWidget(aura::Window* container) {
58 InitWidget(container); 59 InitWidget(container);
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (child) 648 if (child)
648 available_room -= (GetWindowHeightCloseTo(child, 0) + kMinDockGap); 649 available_room -= (GetWindowHeightCloseTo(child, 0) + kMinDockGap);
649 // Use a copy of children array because a call to Minimize can change order. 650 // Use a copy of children array because a call to Minimize can change order.
650 aura::Window::Windows children(dock_container_->children()); 651 aura::Window::Windows children(dock_container_->children());
651 aura::Window::Windows::const_reverse_iterator iter = children.rbegin(); 652 aura::Window::Windows::const_reverse_iterator iter = children.rbegin();
652 while (iter != children.rend()) { 653 while (iter != children.rend()) {
653 aura::Window* window(*iter++); 654 aura::Window* window(*iter++);
654 if (window == child || !IsUsedByLayout(window)) 655 if (window == child || !IsUsedByLayout(window))
655 continue; 656 continue;
656 int room_needed = GetWindowHeightCloseTo(window, 0) + kMinDockGap; 657 int room_needed = GetWindowHeightCloseTo(window, 0) + kMinDockGap;
657 if (available_room > room_needed) 658 if (available_room > room_needed) {
658 available_room -= room_needed; 659 available_room -= room_needed;
659 else 660 } else {
661 // Slow down minimizing animations. Lock duration so that it is not
662 // overridden by other ScopedLayerAnimationSettings down the stack.
663 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
664 settings.SetTransitionDuration(
665 base::TimeDelta::FromMilliseconds(kMinimizeDurationMs));
666 settings.LockTransitionDuration();
660 wm::GetWindowState(window)->Minimize(); 667 wm::GetWindowState(window)->Minimize();
668 }
661 } 669 }
662 } 670 }
663 671
664 void DockedWindowLayoutManager::MinimizeDockedWindow( 672 void DockedWindowLayoutManager::MinimizeDockedWindow(
665 wm::WindowState* window_state) { 673 wm::WindowState* window_state) {
666 DCHECK(!IsPopupOrTransient(window_state->window())); 674 DCHECK(!IsPopupOrTransient(window_state->window()));
667 window_state->window()->Hide(); 675 window_state->window()->Hide();
668 if (window_state->IsActive()) 676 if (window_state->IsActive())
669 window_state->Deactivate(); 677 window_state->Deactivate();
670 RecordUmaAction(DOCKED_ACTION_MINIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN); 678 RecordUmaAction(DOCKED_ACTION_MINIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN);
671 } 679 }
672 680
673 void DockedWindowLayoutManager::RestoreDockedWindow( 681 void DockedWindowLayoutManager::RestoreDockedWindow(
674 wm::WindowState* window_state) { 682 wm::WindowState* window_state) {
675 aura::Window* window = window_state->window(); 683 aura::Window* window = window_state->window();
676 DCHECK(!IsPopupOrTransient(window)); 684 DCHECK(!IsPopupOrTransient(window));
677 // Always place restored window at the top shuffling the other windows down. 685 // Always place restored window at the bottom shuffling the other windows up.
678 // TODO(varkha): add a separate container for docked windows to keep track 686 // TODO(varkha): add a separate container for docked windows to keep track
679 // of ordering. 687 // of ordering.
680 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( 688 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(
681 dock_container_); 689 dock_container_);
682 const gfx::Rect work_area = display.work_area(); 690 const gfx::Rect work_area = display.work_area();
683 691
684 // Evict the window if it can no longer be docked because of its height. 692 // Evict the window if it can no longer be docked because of its height.
685 if (!CanDockWindow(window, SNAP_NONE)) { 693 if (!CanDockWindow(window, SNAP_NONE)) {
686 UndockWindow(window); 694 UndockWindow(window);
687 RecordUmaAction(DOCKED_ACTION_EVICT, DOCKED_ACTION_SOURCE_UNKNOWN); 695 RecordUmaAction(DOCKED_ACTION_EVICT, DOCKED_ACTION_SOURCE_UNKNOWN);
688 return; 696 return;
689 } 697 }
690 gfx::Rect bounds(window->bounds()); 698 gfx::Rect bounds(window->bounds());
691 bounds.set_y(work_area.y() - bounds.height()); 699 bounds.set_y(work_area.bottom());
692 window->SetBounds(bounds); 700 window->SetBounds(bounds);
693 window->Show(); 701 window->Show();
694 MaybeMinimizeChildrenExcept(window); 702 MaybeMinimizeChildrenExcept(window);
695 RecordUmaAction(DOCKED_ACTION_RESTORE, DOCKED_ACTION_SOURCE_UNKNOWN); 703 RecordUmaAction(DOCKED_ACTION_RESTORE, DOCKED_ACTION_SOURCE_UNKNOWN);
696 } 704 }
697 705
698 void DockedWindowLayoutManager::RecordUmaAction(DockedAction action, 706 void DockedWindowLayoutManager::RecordUmaAction(DockedAction action,
699 DockedActionSource source) { 707 DockedActionSource source) {
700 if (action == DOCKED_ACTION_NONE) 708 if (action == DOCKED_ACTION_NONE)
701 return; 709 return;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( 1063 void DockedWindowLayoutManager::OnKeyboardBoundsChanging(
1056 const gfx::Rect& keyboard_bounds) { 1064 const gfx::Rect& keyboard_bounds) {
1057 // This bounds change will have caused a change to the Shelf which does not 1065 // This bounds change will have caused a change to the Shelf which does not
1058 // propagate automatically to this class, so manually recalculate bounds. 1066 // propagate automatically to this class, so manually recalculate bounds.
1059 Relayout(); 1067 Relayout();
1060 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); 1068 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING);
1061 } 1069 }
1062 1070
1063 } // namespace internal 1071 } // namespace internal
1064 } // namespace ash 1072 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698