| 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/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 private: | 395 private: |
| 396 DockedWindowLayoutManager* docked_layout_manager_; | 396 DockedWindowLayoutManager* docked_layout_manager_; |
| 397 gfx::Rect shelf_bounds_in_screen_; | 397 gfx::Rect shelf_bounds_in_screen_; |
| 398 | 398 |
| 399 DISALLOW_COPY_AND_ASSIGN(ShelfWindowObserver); | 399 DISALLOW_COPY_AND_ASSIGN(ShelfWindowObserver); |
| 400 }; | 400 }; |
| 401 | 401 |
| 402 //////////////////////////////////////////////////////////////////////////////// | 402 //////////////////////////////////////////////////////////////////////////////// |
| 403 // DockedWindowLayoutManager public implementation: | 403 // DockedWindowLayoutManager public implementation: |
| 404 DockedWindowLayoutManager::DockedWindowLayoutManager( | 404 DockedWindowLayoutManager::DockedWindowLayoutManager( |
| 405 aura::Window* dock_container, WorkspaceController* workspace_controller) | 405 aura::Window* dock_container, |
| 406 : dock_container_(dock_container), | 406 WorkspaceController* workspace_controller) |
| 407 : SnapToPixelLayoutManager(dock_container), |
| 408 dock_container_(dock_container), |
| 407 in_layout_(false), | 409 in_layout_(false), |
| 408 dragged_window_(NULL), | 410 dragged_window_(NULL), |
| 409 is_dragged_window_docked_(false), | 411 is_dragged_window_docked_(false), |
| 410 is_dragged_from_dock_(false), | 412 is_dragged_from_dock_(false), |
| 411 shelf_(NULL), | 413 shelf_(NULL), |
| 412 workspace_controller_(workspace_controller), | 414 workspace_controller_(workspace_controller), |
| 413 in_fullscreen_(workspace_controller_->GetWindowState() == | 415 in_fullscreen_(workspace_controller_->GetWindowState() == |
| 414 WORKSPACE_WINDOW_STATE_FULL_SCREEN), | 416 WORKSPACE_WINDOW_STATE_FULL_SCREEN), |
| 415 docked_width_(0), | 417 docked_width_(0), |
| 416 alignment_(DOCKED_ALIGNMENT_NONE), | 418 alignment_(DOCKED_ALIGNMENT_NONE), |
| 417 last_active_window_(NULL), | 419 last_active_window_(NULL), |
| 418 last_action_time_(base::Time::Now()), | 420 last_action_time_(base::Time::Now()), |
| 419 background_widget_(new DockedBackgroundWidget(dock_container_)) { | 421 background_widget_(new DockedBackgroundWidget(dock_container_)) { |
| 420 DCHECK(dock_container); | 422 DCHECK(dock_container); |
| 421 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> | 423 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> |
| 422 AddObserver(this); | 424 AddObserver(this); |
| 423 Shell::GetInstance()->AddShellObserver(this); | 425 Shell::GetInstance()->AddShellObserver(this); |
| 424 } | 426 } |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 const gfx::Rect& requested_bounds) { | 711 const gfx::Rect& requested_bounds) { |
| 710 // The minimum constraints have to be applied first by the layout manager. | 712 // The minimum constraints have to be applied first by the layout manager. |
| 711 gfx::Rect actual_new_bounds(requested_bounds); | 713 gfx::Rect actual_new_bounds(requested_bounds); |
| 712 if (child->delegate()) { | 714 if (child->delegate()) { |
| 713 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); | 715 const gfx::Size& min_size = child->delegate()->GetMinimumSize(); |
| 714 actual_new_bounds.set_width( | 716 actual_new_bounds.set_width( |
| 715 std::max(min_size.width(), actual_new_bounds.width())); | 717 std::max(min_size.width(), actual_new_bounds.width())); |
| 716 actual_new_bounds.set_height( | 718 actual_new_bounds.set_height( |
| 717 std::max(min_size.height(), actual_new_bounds.height())); | 719 std::max(min_size.height(), actual_new_bounds.height())); |
| 718 } | 720 } |
| 719 // Whenever one of our windows is moved or resized enforce layout. | 721 SnapToPixelLayoutManager::SetChildBounds(child, actual_new_bounds); |
| 720 SetChildBoundsDirect(child, actual_new_bounds); | |
| 721 if (IsPopupOrTransient(child)) | 722 if (IsPopupOrTransient(child)) |
| 722 return; | 723 return; |
| 724 // Whenever one of our windows is moved or resized enforce layout. |
| 723 ShelfLayoutManager* shelf_layout = | 725 ShelfLayoutManager* shelf_layout = |
| 724 ShelfLayoutManager::ForShelf(dock_container_); | 726 ShelfLayoutManager::ForShelf(dock_container_); |
| 725 if (shelf_layout) | 727 if (shelf_layout) |
| 726 shelf_layout->UpdateVisibilityState(); | 728 shelf_layout->UpdateVisibilityState(); |
| 727 } | 729 } |
| 728 | 730 |
| 729 //////////////////////////////////////////////////////////////////////////////// | 731 //////////////////////////////////////////////////////////////////////////////// |
| 730 // DockedWindowLayoutManager, ash::ShellObserver implementation: | 732 // DockedWindowLayoutManager, ash::ShellObserver implementation: |
| 731 | 733 |
| 732 void DockedWindowLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 734 void DockedWindowLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 | 1320 |
| 1319 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1321 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1320 const gfx::Rect& keyboard_bounds) { | 1322 const gfx::Rect& keyboard_bounds) { |
| 1321 // This bounds change will have caused a change to the Shelf which does not | 1323 // This bounds change will have caused a change to the Shelf which does not |
| 1322 // propagate automatically to this class, so manually recalculate bounds. | 1324 // propagate automatically to this class, so manually recalculate bounds. |
| 1323 Relayout(); | 1325 Relayout(); |
| 1324 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1326 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1325 } | 1327 } |
| 1326 | 1328 |
| 1327 } // namespace ash | 1329 } // namespace ash |
| OLD | NEW |