| OLD | NEW |
| 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/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 BackgroundAnimatorChangeType visible_background_change_type_; | 214 BackgroundAnimatorChangeType visible_background_change_type_; |
| 215 | 215 |
| 216 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); | 216 DISALLOW_COPY_AND_ASSIGN(DockedBackgroundWidget); |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 namespace { | 219 namespace { |
| 220 | 220 |
| 221 // Returns true if a window is a popup or a transient child. | 221 // Returns true if a window is a popup or a transient child. |
| 222 bool IsPopupOrTransient(const aura::Window* window) { | 222 bool IsPopupOrTransient(const aura::Window* window) { |
| 223 return (window->type() == ui::wm::WINDOW_TYPE_POPUP || | 223 return (window->type() == ui::wm::WINDOW_TYPE_POPUP || |
| 224 views::corewm::GetTransientParent(window)); | 224 ::wm::GetTransientParent(window)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Certain windows (minimized, hidden or popups) do not matter to docking. | 227 // Certain windows (minimized, hidden or popups) do not matter to docking. |
| 228 bool IsUsedByLayout(const aura::Window* window) { | 228 bool IsUsedByLayout(const aura::Window* window) { |
| 229 return (window->IsVisible() && | 229 return (window->IsVisible() && |
| 230 !wm::GetWindowState(window)->IsMinimized() && | 230 !wm::GetWindowState(window)->IsMinimized() && |
| 231 !IsPopupOrTransient(window)); | 231 !IsPopupOrTransient(window)); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void UndockWindow(aura::Window* window) { | 234 void UndockWindow(aura::Window* window) { |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 const gfx::Rect& new_bounds) { | 827 const gfx::Rect& new_bounds) { |
| 828 // Only relayout if the dragged window would get docked. | 828 // Only relayout if the dragged window would get docked. |
| 829 if (window == dragged_window_ && is_dragged_window_docked_) | 829 if (window == dragged_window_ && is_dragged_window_docked_) |
| 830 Relayout(); | 830 Relayout(); |
| 831 } | 831 } |
| 832 | 832 |
| 833 void DockedWindowLayoutManager::OnWindowVisibilityChanging( | 833 void DockedWindowLayoutManager::OnWindowVisibilityChanging( |
| 834 aura::Window* window, bool visible) { | 834 aura::Window* window, bool visible) { |
| 835 if (IsPopupOrTransient(window)) | 835 if (IsPopupOrTransient(window)) |
| 836 return; | 836 return; |
| 837 int animation_type = views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT; | 837 int animation_type = ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT; |
| 838 if (visible) { | 838 if (visible) { |
| 839 animation_type = views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DROP; | 839 animation_type = ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_DROP; |
| 840 views::corewm::SetWindowVisibilityAnimationDuration( | 840 ::wm::SetWindowVisibilityAnimationDuration( |
| 841 window, base::TimeDelta::FromMilliseconds(kFadeDurationMs)); | 841 window, base::TimeDelta::FromMilliseconds(kFadeDurationMs)); |
| 842 } else if (wm::GetWindowState(window)->IsMinimized()) { | 842 } else if (wm::GetWindowState(window)->IsMinimized()) { |
| 843 animation_type = WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE; | 843 animation_type = WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE; |
| 844 } | 844 } |
| 845 views::corewm::SetWindowVisibilityAnimationType(window, animation_type); | 845 ::wm::SetWindowVisibilityAnimationType(window, animation_type); |
| 846 } | 846 } |
| 847 | 847 |
| 848 void DockedWindowLayoutManager::OnWindowDestroying(aura::Window* window) { | 848 void DockedWindowLayoutManager::OnWindowDestroying(aura::Window* window) { |
| 849 if (dragged_window_ == window) { | 849 if (dragged_window_ == window) { |
| 850 FinishDragging(DOCKED_ACTION_NONE, DOCKED_ACTION_SOURCE_UNKNOWN); | 850 FinishDragging(DOCKED_ACTION_NONE, DOCKED_ACTION_SOURCE_UNKNOWN); |
| 851 DCHECK(!dragged_window_); | 851 DCHECK(!dragged_window_); |
| 852 DCHECK(!is_dragged_window_docked_); | 852 DCHECK(!is_dragged_window_docked_); |
| 853 } | 853 } |
| 854 if (window == last_active_window_) | 854 if (window == last_active_window_) |
| 855 last_active_window_ = NULL; | 855 last_active_window_ = NULL; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1311 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1312 const gfx::Rect& keyboard_bounds) { | 1312 const gfx::Rect& keyboard_bounds) { |
| 1313 // This bounds change will have caused a change to the Shelf which does not | 1313 // This bounds change will have caused a change to the Shelf which does not |
| 1314 // propagate automatically to this class, so manually recalculate bounds. | 1314 // propagate automatically to this class, so manually recalculate bounds. |
| 1315 Relayout(); | 1315 Relayout(); |
| 1316 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1316 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 } // namespace internal | 1319 } // namespace internal |
| 1320 } // namespace ash | 1320 } // namespace ash |
| OLD | NEW |