Index: ash/common/wm/workspace/workspace_window_resizer.cc |
diff --git a/ash/common/wm/workspace/workspace_window_resizer.cc b/ash/common/wm/workspace/workspace_window_resizer.cc |
index bee0bb465bbc43dc61e7894ec244b06f7b367fbd..1f42dd64304ed2b06db3937ee9826c939afec58c 100644 |
--- a/ash/common/wm/workspace/workspace_window_resizer.cc |
+++ b/ash/common/wm/workspace/workspace_window_resizer.cc |
@@ -9,11 +9,8 @@ |
#include <utility> |
#include <vector> |
-#include "ash/common/ash_switches.h" |
#include "ash/common/metrics/user_metrics_action.h" |
#include "ash/common/wm/default_window_resizer.h" |
-#include "ash/common/wm/dock/docked_window_layout_manager.h" |
-#include "ash/common/wm/dock/docked_window_resizer.h" |
#include "ash/common/wm/panels/panel_window_resizer.h" |
#include "ash/common/wm/window_positioning_utils.h" |
#include "ash/common/wm/window_state.h" |
@@ -67,7 +64,7 @@ std::unique_ptr<WindowResizer> CreateWindowResizer( |
// It may be possible to refactor and eliminate chaining. |
std::unique_ptr<WindowResizer> window_resizer; |
- if (!window_state->IsNormalOrSnapped() && !window_state->IsDocked()) |
+ if (!window_state->IsNormalOrSnapped()) |
return std::unique_ptr<WindowResizer>(); |
int bounds_change = |
@@ -80,7 +77,6 @@ std::unique_ptr<WindowResizer> CreateWindowResizer( |
window->GetParent() ? window->GetParent()->GetShellWindowId() : -1; |
if (window->GetParent() && |
(parent_shell_window_id == kShellWindowId_DefaultContainer || |
- parent_shell_window_id == kShellWindowId_DockedContainer || |
parent_shell_window_id == kShellWindowId_PanelContainer)) { |
window_resizer.reset( |
WorkspaceWindowResizer::Create(window_state, std::vector<WmWindow*>())); |
@@ -89,15 +85,9 @@ std::unique_ptr<WindowResizer> CreateWindowResizer( |
} |
window_resizer = window->GetShell()->CreateDragWindowResizer( |
std::move(window_resizer), window_state); |
- if (window->GetType() == ui::wm::WINDOW_TYPE_PANEL) |
+ if (window->GetType() == ui::wm::WINDOW_TYPE_PANEL) { |
window_resizer.reset( |
PanelWindowResizer::Create(window_resizer.release(), window_state)); |
- if (window_resizer && window->GetParent() && !window->GetTransientParent() && |
- (parent_shell_window_id == kShellWindowId_DefaultContainer || |
- parent_shell_window_id == kShellWindowId_DockedContainer || |
- parent_shell_window_id == kShellWindowId_PanelContainer)) { |
- window_resizer.reset( |
- DockedWindowResizer::Create(window_resizer.release(), window_state)); |
} |
return window_resizer; |
} |
@@ -389,7 +379,6 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent, |
snap_type_ = SNAP_NONE; |
snap_phantom_window_controller_.reset(); |
edge_cycler_.reset(); |
- SetDraggedWindowDocked(false); |
} |
} |
@@ -415,18 +404,15 @@ void WorkspaceWindowResizer::CompleteDrag() { |
details().restore_bounds.IsEmpty() ? initial_bounds |
: details().restore_bounds); |
} |
- if (!dock_layout_->is_dragged_window_docked()) { |
- // TODO(oshima): Add event source type to WMEvent and move |
- // metrics recording inside WindowState::OnWMEvent. |
- const wm::WMEvent event(snap_type_ == SNAP_LEFT |
- ? wm::WM_EVENT_SNAP_LEFT |
- : wm::WM_EVENT_SNAP_RIGHT); |
- window_state()->OnWMEvent(&event); |
- shell_->RecordUserMetricsAction(snap_type_ == SNAP_LEFT |
- ? UMA_DRAG_MAXIMIZE_LEFT |
- : UMA_DRAG_MAXIMIZE_RIGHT); |
- snapped = true; |
- } |
+ // TODO(oshima): Add event source type to WMEvent and move |
+ // metrics recording inside WindowState::OnWMEvent. |
+ const wm::WMEvent event(snap_type_ == SNAP_LEFT ? wm::WM_EVENT_SNAP_LEFT |
+ : wm::WM_EVENT_SNAP_RIGHT); |
+ window_state()->OnWMEvent(&event); |
+ shell_->RecordUserMetricsAction(snap_type_ == SNAP_LEFT |
+ ? UMA_DRAG_MAXIMIZE_LEFT |
+ : UMA_DRAG_MAXIMIZE_RIGHT); |
+ snapped = true; |
} |
if (!snapped) { |
@@ -444,7 +430,7 @@ void WorkspaceWindowResizer::CompleteDrag() { |
window_state()->SaveCurrentBoundsForRestore(); |
window_state()->Restore(); |
} |
- } else if (!dock_layout_->is_dragged_window_docked()) { |
+ } else { |
// The window was not snapped and is not snapped. This is a user |
// resize/drag and so the current bounds should be maintained, clearing |
// any prior restore bounds. When the window is docked the restore bound |
@@ -510,8 +496,6 @@ WorkspaceWindowResizer::WorkspaceWindowResizer( |
did_lock_cursor_ = true; |
} |
- dock_layout_ = DockedWindowLayoutManager::Get(GetTarget()); |
- |
// Only support attaching to the right/bottom. |
DCHECK(attached_windows_.empty() || (details().window_component == HTRIGHT || |
details().window_component == HTBOTTOM)); |
@@ -875,28 +859,13 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, |
if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { |
snap_phantom_window_controller_.reset(); |
edge_cycler_.reset(); |
- if (snap_type_ == SNAP_NONE) { |
- SetDraggedWindowDocked(false); |
+ if (snap_type_ == SNAP_NONE) |
return; |
- } |
} |
DCHECK(snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT); |
- DockedAlignment desired_alignment = (snap_type_ == SNAP_LEFT) |
- ? DOCKED_ALIGNMENT_LEFT |
- : DOCKED_ALIGNMENT_RIGHT; |
- const bool can_dock = |
- ash::switches::DockedWindowsEnabled() && |
- dock_layout_->CanDockWindow(GetTarget(), desired_alignment) && |
- dock_layout_->GetAlignmentOfWindow(GetTarget()) != DOCKED_ALIGNMENT_NONE; |
- if (!can_dock) { |
- // If the window cannot be docked, undock the window. This may change the |
- // workspace bounds and hence |snap_type_|. |
- SetDraggedWindowDocked(false); |
- snap_type_ = GetSnapType(location); |
- } |
const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap(); |
- if (!can_snap && !can_dock) { |
+ if (!can_snap) { |
snap_type_ = SNAP_NONE; |
snap_phantom_window_controller_.reset(); |
edge_cycler_.reset(); |
@@ -914,23 +883,10 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location, |
// Update phantom window with snapped or docked guide bounds. |
// Windows that cannot be snapped or are less wide than kMaxDockWidth can get |
// docked without going through a snapping sequence. |
- gfx::Rect phantom_bounds; |
- const bool should_dock = |
- can_dock && (!can_snap || |
- GetTarget()->GetBounds().width() <= |
- DockedWindowLayoutManager::kMaxDockWidth || |
- edge_cycler_->use_second_mode() || |
- dock_layout_->is_dragged_window_docked()); |
- if (should_dock) { |
- SetDraggedWindowDocked(true); |
- phantom_bounds = GetTarget()->GetParent()->ConvertRectFromScreen( |
- dock_layout_->dragged_bounds()); |
- } else { |
- phantom_bounds = |
- (snap_type_ == SNAP_LEFT) |
- ? wm::GetDefaultLeftSnappedWindowBoundsInParent(GetTarget()) |
- : wm::GetDefaultRightSnappedWindowBoundsInParent(GetTarget()); |
- } |
+ gfx::Rect phantom_bounds = |
+ (snap_type_ == SNAP_LEFT) |
+ ? wm::GetDefaultLeftSnappedWindowBoundsInParent(GetTarget()) |
+ : wm::GetDefaultRightSnappedWindowBoundsInParent(GetTarget()); |
if (!snap_phantom_window_controller_) { |
snap_phantom_window_controller_.reset( |
@@ -993,20 +949,6 @@ WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( |
return SNAP_NONE; |
} |
-void WorkspaceWindowResizer::SetDraggedWindowDocked(bool should_dock) { |
- if (should_dock) { |
- if (!dock_layout_->is_dragged_window_docked()) { |
- window_state()->set_bounds_changed_by_user(false); |
- dock_layout_->DockDraggedWindow(GetTarget()); |
- } |
- } else { |
- if (dock_layout_->is_dragged_window_docked()) { |
- dock_layout_->UndockDraggedWindow(); |
- window_state()->set_bounds_changed_by_user(true); |
- } |
- } |
-} |
- |
bool WorkspaceWindowResizer::AreBoundsValidSnappedBounds( |
wm::WindowStateType snapped_type, |
const gfx::Rect& bounds_in_parent) const { |