Chromium Code Reviews| 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" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
| 13 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
| 16 #include "ash/wm/coordinate_conversion.h" | 16 #include "ash/wm/coordinate_conversion.h" |
| 17 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
| 18 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_resizer.h" | |
| 19 #include "ash/wm/window_state.h" | 20 #include "ash/wm/window_state.h" |
| 20 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
| 21 #include "ash/wm/workspace_controller.h" | 22 #include "ash/wm/workspace_controller.h" |
| 22 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
| 23 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 24 #include "base/metrics/histogram.h" | 25 #include "base/metrics/histogram.h" |
| 25 #include "grit/ash_resources.h" | 26 #include "grit/ash_resources.h" |
| 26 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 27 #include "third_party/skia/include/core/SkPaint.h" | 28 #include "third_party/skia/include/core/SkPaint.h" |
| 28 #include "ui/aura/client/activation_client.h" | 29 #include "ui/aura/client/activation_client.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 DockedWindowLayoutManagerObserver* observer) { | 423 DockedWindowLayoutManagerObserver* observer) { |
| 423 observer_list_.RemoveObserver(observer); | 424 observer_list_.RemoveObserver(observer); |
| 424 } | 425 } |
| 425 | 426 |
| 426 void DockedWindowLayoutManager::StartDragging(aura::Window* window) { | 427 void DockedWindowLayoutManager::StartDragging(aura::Window* window) { |
| 427 DCHECK(!dragged_window_); | 428 DCHECK(!dragged_window_); |
| 428 dragged_window_ = window; | 429 dragged_window_ = window; |
| 429 DCHECK(!IsPopupOrTransient(window)); | 430 DCHECK(!IsPopupOrTransient(window)); |
| 430 // Start observing a window unless it is docked container's child in which | 431 // Start observing a window unless it is docked container's child in which |
| 431 // case it is already observed. | 432 // case it is already observed. |
| 433 wm::WindowState* dragged_state = wm::GetWindowState(dragged_window_); | |
| 432 if (dragged_window_->parent() != dock_container_) { | 434 if (dragged_window_->parent() != dock_container_) { |
| 433 dragged_window_->AddObserver(this); | 435 dragged_window_->AddObserver(this); |
| 434 wm::GetWindowState(dragged_window_)->AddObserver(this); | 436 dragged_state->AddObserver(this); |
| 435 } | 437 } |
| 436 is_dragged_from_dock_ = window->parent() == dock_container_; | 438 is_dragged_from_dock_ = window->parent() == dock_container_; |
| 437 DCHECK(!is_dragged_window_docked_); | 439 DCHECK(!is_dragged_window_docked_); |
| 440 | |
| 441 // Resize all windows that are flush with the dock edge together if one of | |
| 442 // them gets resized. | |
| 443 if (dragged_window_->bounds().width() == docked_width_ && | |
| 444 (dragged_state->drag_details()->bounds_change & | |
| 445 WindowResizer::kBoundsChange_Resizes) && | |
| 446 (dragged_state->drag_details()->size_change_direction & | |
| 447 WindowResizer::kBoundsChangeDirection_Horizontal)) { | |
| 448 for (size_t i = 0; i < dock_container_->children().size(); ++i) { | |
| 449 aura::Window* window1(dock_container_->children()[i]); | |
| 450 if (IsUsedByLayout(window1) && | |
| 451 window1 != dragged_window_ && | |
| 452 window1->bounds().width() == docked_width_) { | |
| 453 wm::GetWindowState(window1)->set_bounds_changed_by_user(false); | |
|
oshima
2014/01/10 23:07:28
so this will trigger resizing later on when the dr
varkha
2014/01/10 23:26:43
This allows the window to be flexible about its si
| |
| 454 } | |
| 455 } | |
| 456 } | |
| 438 } | 457 } |
| 439 | 458 |
| 440 void DockedWindowLayoutManager::DockDraggedWindow(aura::Window* window) { | 459 void DockedWindowLayoutManager::DockDraggedWindow(aura::Window* window) { |
| 441 DCHECK(!IsPopupOrTransient(window)); | 460 DCHECK(!IsPopupOrTransient(window)); |
| 442 OnDraggedWindowDocked(window); | 461 OnDraggedWindowDocked(window); |
| 443 Relayout(); | 462 Relayout(); |
| 444 } | 463 } |
| 445 | 464 |
| 446 void DockedWindowLayoutManager::UndockDraggedWindow() { | 465 void DockedWindowLayoutManager::UndockDraggedWindow() { |
| 447 DCHECK(!IsPopupOrTransient(dragged_window_)); | 466 DCHECK(!IsPopupOrTransient(dragged_window_)); |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1266 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1248 const gfx::Rect& keyboard_bounds) { | 1267 const gfx::Rect& keyboard_bounds) { |
| 1249 // This bounds change will have caused a change to the Shelf which does not | 1268 // This bounds change will have caused a change to the Shelf which does not |
| 1250 // propagate automatically to this class, so manually recalculate bounds. | 1269 // propagate automatically to this class, so manually recalculate bounds. |
| 1251 Relayout(); | 1270 Relayout(); |
| 1252 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1271 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1253 } | 1272 } |
| 1254 | 1273 |
| 1255 } // namespace internal | 1274 } // namespace internal |
| 1256 } // namespace ash | 1275 } // namespace ash |
| OLD | NEW |