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. | |
599 if (alignment_ == DOCKED_ALIGNMENT_NONE) { | 596 if (alignment_ == DOCKED_ALIGNMENT_NONE) { |
600 alignment_ = GetAlignmentOfWindow(child); | 597 alignment_ = GetAlignmentOfWindow(child); |
601 DCHECK(alignment_ != DOCKED_ALIGNMENT_NONE); | 598 DCHECK(alignment_ != DOCKED_ALIGNMENT_NONE); |
602 } | 599 } |
603 MaybeMinimizeChildrenExcept(child); | 600 MaybeMinimizeChildrenExcept(child); |
604 child->AddObserver(this); | 601 child->AddObserver(this); |
605 wm::GetWindowState(child)->AddObserver(this); | 602 wm::GetWindowState(child)->AddObserver(this); |
606 Relayout(); | 603 Relayout(); |
607 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 604 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
608 } | 605 } |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1243 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
1247 const gfx::Rect& keyboard_bounds) { | 1244 const gfx::Rect& keyboard_bounds) { |
1248 // This bounds change will have caused a change to the Shelf which does not | 1245 // This bounds change will have caused a change to the Shelf which does not |
1249 // propagate automatically to this class, so manually recalculate bounds. | 1246 // propagate automatically to this class, so manually recalculate bounds. |
1250 Relayout(); | 1247 Relayout(); |
1251 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1248 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
1252 } | 1249 } |
1253 | 1250 |
1254 } // namespace internal | 1251 } // namespace internal |
1255 } // namespace ash | 1252 } // namespace ash |
OLD | NEW |