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_ash.h" | 8 #include "ash/screen_ash.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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 586 } |
587 | 587 |
588 void DockedWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 588 void DockedWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
589 if (IsPopupOrTransient(child)) | 589 if (IsPopupOrTransient(child)) |
590 return; | 590 return; |
591 // Dragged windows are already observed by StartDragging and do not change | 591 // Dragged windows are already observed by StartDragging and do not change |
592 // docked alignment during the drag. | 592 // docked alignment during the drag. |
593 if (child == dragged_window_) | 593 if (child == dragged_window_) |
594 return; | 594 return; |
595 // If this is the first window getting docked - update alignment. | 595 // If this is the first window getting docked - update alignment. |
| 596 // TODO(oshima|varkha): A window can be added without proper bounds when |
| 597 // window is moved to another display via API or due to display configuration |
| 598 // change, so the the alignment may not be valid. |
596 if (alignment_ == DOCKED_ALIGNMENT_NONE) { | 599 if (alignment_ == DOCKED_ALIGNMENT_NONE) { |
597 alignment_ = GetAlignmentOfWindow(child); | 600 alignment_ = GetAlignmentOfWindow(child); |
598 DCHECK(alignment_ != DOCKED_ALIGNMENT_NONE); | 601 DCHECK(alignment_ != DOCKED_ALIGNMENT_NONE); |
599 } | 602 } |
600 MaybeMinimizeChildrenExcept(child); | 603 MaybeMinimizeChildrenExcept(child); |
601 child->AddObserver(this); | 604 child->AddObserver(this); |
602 wm::GetWindowState(child)->AddObserver(this); | 605 wm::GetWindowState(child)->AddObserver(this); |
603 Relayout(); | 606 Relayout(); |
604 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 607 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
605 } | 608 } |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1246 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1244 const gfx::Rect& keyboard_bounds) { | 1247 const gfx::Rect& keyboard_bounds) { |
1245 // This bounds change will have caused a change to the Shelf which does not | 1248 // This bounds change will have caused a change to the Shelf which does not |
1246 // propagate automatically to this class, so manually recalculate bounds. | 1249 // propagate automatically to this class, so manually recalculate bounds. |
1247 Relayout(); | 1250 Relayout(); |
1248 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1251 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1249 } | 1252 } |
1250 | 1253 |
1251 } // namespace internal | 1254 } // namespace internal |
1252 } // namespace ash | 1255 } // namespace ash |
OLD | NEW |