| 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/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 if (window != dragged_window_ && !IsPopupOrTransient(window)) | 376 if (window != dragged_window_ && !IsPopupOrTransient(window)) |
| 377 return alignment_; | 377 return alignment_; |
| 378 } | 378 } |
| 379 // No docked windows remain other than possibly the window being dragged. | 379 // No docked windows remain other than possibly the window being dragged. |
| 380 // Return |NONE| to indicate that windows may get docked on either side. | 380 // Return |NONE| to indicate that windows may get docked on either side. |
| 381 return DOCKED_ALIGNMENT_NONE; | 381 return DOCKED_ALIGNMENT_NONE; |
| 382 } | 382 } |
| 383 | 383 |
| 384 bool DockedWindowLayoutManager::CanDockWindow(aura::Window* window, | 384 bool DockedWindowLayoutManager::CanDockWindow(aura::Window* window, |
| 385 SnapType edge) { | 385 SnapType edge) { |
| 386 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 386 if (!switches::UseDockedWindows()) |
| 387 switches::kAshEnableDockedWindows)) { | |
| 388 return false; | 387 return false; |
| 389 } | |
| 390 // Don't allow interactive docking of windows with transient parents such as | 388 // Don't allow interactive docking of windows with transient parents such as |
| 391 // modal browser dialogs. | 389 // modal browser dialogs. |
| 392 if (IsPopupOrTransient(window)) | 390 if (IsPopupOrTransient(window)) |
| 393 return false; | 391 return false; |
| 394 // If a window is wide and cannot be resized down to maximum width allowed | 392 // If a window is wide and cannot be resized down to maximum width allowed |
| 395 // then it cannot be docked. | 393 // then it cannot be docked. |
| 396 // TODO(varkha). Prevent windows from changing size programmatically while | 394 // TODO(varkha). Prevent windows from changing size programmatically while |
| 397 // they are docked. The size will take effect only once a window is undocked. | 395 // they are docked. The size will take effect only once a window is undocked. |
| 398 // See http://crbug.com/307792. | 396 // See http://crbug.com/307792. |
| 399 if (window->bounds().width() > kMaxDockWidth && | 397 if (window->bounds().width() > kMaxDockWidth && |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1070 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1073 const gfx::Rect& keyboard_bounds) { | 1071 const gfx::Rect& keyboard_bounds) { |
| 1074 // This bounds change will have caused a change to the Shelf which does not | 1072 // This bounds change will have caused a change to the Shelf which does not |
| 1075 // propagate automatically to this class, so manually recalculate bounds. | 1073 // propagate automatically to this class, so manually recalculate bounds. |
| 1076 Relayout(); | 1074 Relayout(); |
| 1077 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1075 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1078 } | 1076 } |
| 1079 | 1077 |
| 1080 } // namespace internal | 1078 } // namespace internal |
| 1081 } // namespace ash | 1079 } // namespace ash |
| OLD | NEW |